We're using VMWare Convertor in our infrastructure and have another product interfacing with it to enable us to flex the settings of a VM Guest (Disk,RAM and CPU). We've been asked to be able to maintain the UUID from source to guest as our backup infrastructure depends on it.
After much Google/Bing time I've found I need to use the preserveIdentity property in the xml we're submitting to the Web Service API. Found the details here:
An example of the xml we're submitting (values in between stars, are replaced just before the xml gets submitted to convertor):
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<ConverterServerConversionManagerCreateJob xmlns="urn:converter">
<_this type="ConverterServerConversionConversionManager">ConversionManager</_this>
<spec>
<name>Server Automation Flex Job - *serverName*</name>
<source>
<location xsi:type="ConverterComputerSpecLiveComputerLocation">
<hostname>*serverNameFullyQualified*</hostname>
<username>*serverUsername*</username>
<password>*serverPassword*</password>
<osType>*serverOSType*</osType>
<verifyPeer>false</verifyPeer>
<sslThumbprint>*sourceSSLThumbprint*</sslThumbprint>
</location>
</source>
<conversionParams>
<doClone>true</doClone>
<cloningParams>
<target>
<name>*guestName*</name>
<location xsi:type="ConverterTargetVmSpecManagedVmLocation">
<vimConnect>
<hostname>*VCServer*</hostname>
<credentials xsi:type="ConverterVimConnectionSpecLoginVimCredentials">
<username>*VCUsername*</username>
<password>*VCPassword*</password>
</credentials>
<verifyPeer>false</verifyPeer>
<sslThumbprint>*targetSSLThumbprint*</sslThumbprint>
</vimConnect>
<vmFolder type="Folder">*folderID*</vmFolder>
<host type="HostSystem">*hostID*</host>
<computeResource type="ClusterComputeResource">*clusterID*</computeResource>
<vmFolderName>*sourceVmFolder*</vmFolderName>
<resourcePoolName>*targetVMwareResourcePool*</resourcePoolName>
<computeResourceName>*targetVMwareCluster*</computeResourceName>
</location>
<hardwareVersion>*targetVmHardwareVersion*</hardwareVersion>
</target>
<storageParams>
*storageParamsXML*
</storageParams>
<networkParams>
<preserveNicCount>true</preserveNicCount>
<preserveNicMapping>true</preserveNicMapping>
</networkParams>
<basicHardwareParams>
<numCPUs>*newCPUValue*</numCPUs>
<numCoresPerSocket>1</numCoresPerSocket>
<memoryMB>*newMemoryValueInMB*</memoryMB>
</basicHardwareParams>
<doSynchronize>false</doSynchronize>
<preserveIdentity>false</preserveIdentity>
</cloningParams>
<doReconfig>true</doReconfig>
<doInstallTools>false</doInstallTools>
<doCustomize>false</doCustomize>
<doUninstallAgent>false</doUninstallAgent>
<powerOnTargetVM>true</powerOnTargetVM>
<removeRestoreCheckpoints>true</removeRestoreCheckpoints>
<throttlingParams>
<cpuThrottling>none</cpuThrottling>
</throttlingParams>
</conversionParams>
<p2vSourceModificationSpec>
<shutdownSource>true</shutdownSource>
</p2vSourceModificationSpec>
<parentFolder type="ConverterServerConversionConversionFolder">ConversionFolder</parentFolder>
</spec>
</ConverterServerConversionManagerCreateJob>
</soapenv:Body>
</soapenv:Envelope>
I've tried putting the preserveIdentity element in a number of places and got the same error back from our tools of:
HTTP/1.1 500 Internal server error
<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <soapenv:Fault><faultcode>ServerFaultCode</faultcode><faultstring> Unexpected element tag "preserveIdentity" seen while parsing serialized DataObject of type converter.params.CloningParams at line 20, column 5 while parsing property "cloningParams" of static type ConverterCloningParams while parsing serialized DataObject of type converter.params.ConversionParams at line 18, column 4 while parsing property "conversionParams" of static type ConverterConversionParams while parsing serialized DataObject of type converter.server.conversion.ConversionJobSpec at line 6, column 3 while parsing call information for method ConverterServerConversionManagerCreateJob at line 4, column 2 while parsing SOAP body at line 3, column 1 while parsing SOAP envelope at line 2, column 0 while parsing HTTP request for method createJob on object of type converter.server.conversion.ConversionManager at line 1, column 0</faultstring><detail><InvalidRequestFault xmlns="urn:converter" xsi:type="vim25:InvalidRequest" xmlns:vim25="urn:vim25"></InvalidRequestFault></detail></soapenv:Fault> </soapenv:Body> </soapenv:Envelope>
Can anyone help?
After testing, still not worked so used the vSphere API to read then write the UUID in instead:
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><ReconfigVM_Task xmlns="urn:vim25"><_this type="VirtualMachine">*VmId*</_this><spec><uuid>*newUUID*</uuid></spec></ReconfigVM_Task></soap:Body></soap:Envelope>
oh and the xml above where preserveIdentity is set to false was my last test of desperation to see what happened. It's been true in all other tests, with the same result.
Could you repeat conversion with latest Converter 5.5?
Hello
do you try this using the SDK (with C# or java code) or just tweaking the SOAP XML?
If it is the first case - I managed to submit with preserveIdentity set - it preserves "uuid" in target config spec but doesn't preserve "instanceUuid". This looks like a bug (though nobody seems to have hit it before). Is that your issue?
If you are trying to tweak the SOAP XML, then I'd recommend you start using the SDK 😉
Regards,
Plamen
Looks to have been that the preserveIdentity node needed to be before the doSynchronise part in ConfigParams.
After testing, still not worked so used the vSphere API to read then write the UUID in instead:
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><ReconfigVM_Task xmlns="urn:vim25"><_this type="VirtualMachine">*VmId*</_this><spec><uuid>*newUUID*</uuid></spec></ReconfigVM_Task></soap:Body></soap:Envelope>