We are currently attempting to create a VM by cloning a VM template, and then assign that new VM to a portgroup. We have the cloning working fine, but we are running into an issue with reconfiguring the VM to belong to the new portgroup.
Basically, VMs for clients will have their own VLAN so we have 1 portgroup per VLAN. We place the cloned VM into the portgroup for the customer.
Below is the soap call that's being sent to our vCenter 5.1 box:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:vim25" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns1:ReconfigVM_Task>
<ns1:_this xsi:type="ns1:VirtualMachine" type="VirtualMachine">vm-106</ns1:_this><ns1:spec>
<ns1:name>centos-6-x64-nocpanel</ns1:name>
<ns1:deviceChange>
<ns1:operation xsi:type="ns1:ManagedObjectReference" type="VirtualDeviceConfigSpecOperation">edit</ns1:operation>
<ns1:device>
<ns1:key>4001</ns1:key>
<ns1:backing xsi:type="ns1:VirtualEthernetCardDistributedVirtualPortBackingInfo"><ns1:port>
<ns1:switchUuid>xxxxxx</ns1:switchUuid>
<ns1:portgroupKey>dvportgroup-107</ns1:portgroupKey>
</ns1:port>
</ns1:backing>
<ns1:connectable>
<ns1:startConnected>true</ns1:startConnected>
<ns1:allowGuestControl>true</ns1:allowGuestControl>
<ns1:connected>true</ns1:connected>
<ns1:status>ok</ns1:status>
</ns1:connectable>
<ns1:unitNumber>8</ns1:unitNumber>
</ns1:device>
</ns1:deviceChange>
</ns1:spec>
</ns1:ReconfigVM_Task>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
We are getting this error:
Reconfigure virtual machine centos-6-x64-nocpanel
Invalid operation for device '0'
vmadmin
VCENTER-A
7/31/2013 9:12:06 PM
7/31/2013 9:12:06 PM
7/31/2013 9:12:07 PM
Does anyone know why we are getting that error? If so, could you provide me with the appropriate soap call change(s) so that it works?
Note: If I remove the deviceChange portion, the call completes fine (I can rename the VM to whatever I want). But once I put the deviceChange portion in, I get the error.
Any help is greatly appreciated!