Home > vSphere API > Moving Virtual Machine Back From Distributed Virtual Switch

Moving Virtual Machine Back From Distributed Virtual Switch

After blogging about moving virtual machines from a standard virtual switch to a distributed virtual switch, I saw a new question in VI Java API forum on how to roll it back. Technically, I don’t see any reason why one should switch back because using distributed virtual switch gives you a lot of benefits. But the decision is not mine but yours. Whatever you want to do, we help do it easily.

The method involved is still the ReconfigVM_Task() defined with VirtualMachine managed object. The difference comes with the parameter, mainly the backing. When it comes to Web Service API, it’s better to show either code or SOAP message. To me, SOAP message is even better because you can reference it even using toolkit like PowerCLI.

Time to learn how to "Google" and manage your VMware and clouds in a fast and secure

HTML5 App

The following is recorded with Onyx. Based on this SOAP request, I think you can easily write code to achieve the same.

<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:Header>
    <operationID>7655B948-0000008D</operationID>
  </soap:Header>
  <soap:Body>
    <ReconfigVM_Task xmlns="urn:internalvim25">
      <_this xsi:type="ManagedObjectReference" type="VirtualMachine" serverGuid="BA9CE658-75F7-4A99-ACE6-99EB1376B94A">vm-344</_this>
      <spec>
        <changeVersion>2011-04-04T02:30:28.604558Z</changeVersion>
        <deviceChange>
          <operation>edit</operation>
          <device xsi:type="VirtualE1000">
            <key>4003</key>
            <deviceInfo>
              <label>Network adapter 4</label>
              <summary>vm.device.VirtualE1000.DistributedVirtualPortBackingInfo.summary</summary>
            </deviceInfo>
            <backing xsi:type="VirtualEthernetCardNetworkBackingInfo">
              <deviceName>VM Network</deviceName>
            </backing>
            <connectable>
              <startConnected>true</startConnected>
              <allowGuestControl>true</allowGuestControl>
              <connected>false</connected>
              <status>untried</status>
            </connectable>
            <controllerKey>100</controllerKey>
            <unitNumber>10</unitNumber>
            <addressType>assigned</addressType>
            <macAddress>00:50:56:bf:00:26</macAddress>
            <wakeOnLanEnabled>true</wakeOnLanEnabled>
          </device>
        </deviceChange>
      </spec>
    </ReconfigVM_Task>
  </soap:Body>
</soap:Envelope>

  1. Prateek
    June 29th, 2011 at 19:05 | #1

    Hi am trying to use a OVFManagerImportVAppFromUrl.java as a reference to deploy an OVF on my host i.e. ESX 5.0. I am using VIM25 SDK. I am facing this error
    “Server returned HTTP response code: 500 for URL: https://10.20.112.129/nfc/524ff388-80dc-5a00-43af-994d7a0fac30/disk-1.vmdk” This is a I/O exception, Before firing this exception a VM without an Operating system is deployed on host. Could any one tell me what might be the problem.

  2. June 29th, 2011 at 21:21 | #2

    Hi Prateek,

    Where did you get the Java code/sample? Thanks!

    -Steve

  3. amogh
    January 14th, 2013 at 23:44 | #3

    how to get cluster data for eg name,uuid from vcenter?

  4. amogh
    January 14th, 2013 at 23:52 | #4

    i am using vijava.. new to this tool,plz help me

  1. No trackbacks yet.