Quantcast
Channel: VMware Communities : Unanswered Discussions - vCenter™ Server
Viewing all articles
Browse latest Browse all 3506

How to deploy a VM from a template, with a VMXNET3 network adapter type, using a curl command (with SOAP) ?

$
0
0

Hello everybody,

 

I have an issue when I try to deploy a VM from a template with a curl command (with SOAP), when adding/modifying/deleting a VMXNET3 network adapter type.

 

Here is my code :

 

SOAPCMD="<soap:Envelope xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body>    <CloneVM_Task xmlns=\"urn:internalvim25\">      <_this xsi:type=\"ManagedObjectReference\" type=\"VirtualMachine\" serverGuid=\"CB16B7E4-FC91-4AA3-840F-4A5D2AC4D212\">vm-2769</_this>      <folder type=\"Folder\" serverGuid=\"CB16B7E4-FC91-4AA3-840F-4A5D2AC4D212\">group-v854</folder>      <name>testvm</name>      <spec>        <location>          <datastore type=\"Datastore\" serverGuid=\"CB16B7E4-FC91-4AA3-840F-4A5D2AC4D212\">datastore-307</datastore>          <pool type=\"ResourcePool\" serverGuid=\"CB16B7E4-FC91-4AA3-840F-4A5D2AC4D212\">resgroup-294</pool>          <disk>            <diskId>2000</diskId>            <datastore type=\"Datastore\" serverGuid=\"CB16B7E4-FC91-4AA3-840F-4A5D2AC4D212\">datastore-307</datastore>          </disk>        </location>        <template>false</template>        <config>          <name>testvm</name>          <files>            <vmPathName>[IE407_Lun_209A]</vmPathName>          </files>          <numCPUs>2</numCPUs>          <memoryMB>2048</memoryMB>          <deviceChange>            <operation>remove</operation>            <device xsi:type=\"VirtualVmxnet3\">              <key>4000</key>              <deviceInfo>                <label>Network adapter 1</label>                <summary>VM Network</summary>              </deviceInfo>              <backing xsi:type=\"VirtualEthernetCardNetworkBackingInfo\">                <deviceName>LAN_AD_14</deviceName>                <useAutoDetect>false</useAutoDetect>                <inPassthroughMode>false</inPassthroughMode>              </backing>              <connectable>                <startConnected>true</startConnected>                <allowGuestControl>true</allowGuestControl>                <connected>false</connected>                <status>untried</status>              </connectable>              <controllerKey>100</controllerKey>              <unitNumber>7</unitNumber>              <addressType>assigned</addressType>              <macAddress>XX:XX:XX:XX:XX:XX</macAddress>              <wakeOnLanEnabled>false</wakeOnLanEnabled>            </device>          </deviceChange>        </config>        <customization>          <options xsi:type=\"CustomizationLinuxOptions\" />          <identity xsi:type=\"CustomizationLinuxPrep\">            <hostName xsi:type=\"CustomizationFixedName\">              <name>testvm</name>            </hostName>            <domain>domain.com</domain>            <timeZone>Europe/Paris</timeZone>  </soap:Body></soap:Envelope>"
curl -b cookie.txt -s -k -d "${SOAPCMD}" -X POST https://${VIRTUALCENTER}/sdk/vimService.wsdl

 

Here is my error message :

 

<?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>

Unable to find specified dynamic type &quot;VirtualVmxnet3&quot;

Specified dynamic type VirtualVmxnet3 is not a DataObject type.

 

while parsing serialized DataObject of type vim.vm.device.VirtualDevice

at line 26, column 12

 

while parsing property &quot;device&quot; of static type VirtualDevice

 

while parsing serialized DataObject of type vim.vm.device.VirtualDeviceSpec

at line 24, column 10

 

while parsing property &quot;deviceChange&quot; of static type ArrayOfVirtualDeviceConfigSpec

 

while parsing serialized DataObject of type vim.vm.ConfigSpec

at line 17, column 8

 

while parsing property &quot;config&quot; of static type VirtualMachineConfigSpec

 

while parsing serialized DataObject of type vim.vm.CloneSpec

at line 7, column 6

 

while parsing call information for method CloneVM_Task

at line 3, column 4

 

while parsing SOAP body

at line 2, column 0

 

while parsing SOAP envelope

at line 1, column 0

 

while parsing HTTP request for method clone

on object of type vim.VirtualMachine

at line 1, column 0</faultstring><detail><InvalidRequestFault xmlns="urn:internalvim25" xsi:type="InvalidRequest"></InvalidRequestFault></detail></soapenv:Fault>

</soapenv:Body>

</soapenv:Envelope>

 

I tried with network adapters types : E1000 and VMXNET (VirtualE1000 and VirtualVmxnet) , and it worked fine!

But I don't know why it do not find VirtualVmxnet3 DataObject type.

 

I tried to run a tool to capture SOAP requests when deploying the VM via vSphere client, and I got exactly the content of SOAPCMD variable in my code.

 

Can someone help me?


Viewing all articles
Browse latest Browse all 3506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>