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.

Lost VMs or Containers? Too Many Consoles? Too Slow GUI? 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>

This entry was posted in vSphere API and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

4 Comments

  1. Prateek
    Posted June 29, 2011 at 7:05 pm | Permalink

    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. Posted June 29, 2011 at 9:21 pm | Permalink

    Hi Prateek,

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

    -Steve

  3. amogh
    Posted January 14, 2013 at 11:44 pm | Permalink

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

  4. amogh
    Posted January 14, 2013 at 11:52 pm | Permalink

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

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

  • NEED HELP?


    My company has created products like vSearch ("Super vCenter"), vijavaNG APIs, EAM APIs, ICE tool. We also help clients with virtualization and cloud computing on customized development, training. Should you, or someone you know, need these products and services, please feel free to contact me: steve __AT__ doublecloud.org.

    Me: Steve Jin, VMware vExpert who authored the VMware VI and vSphere SDK by Prentice Hall, and created the de factor open source vSphere Java API while working at VMware engineering. Companies like Cisco, EMC, NetApp, HP, Dell, VMware, are among the users of the API and other tools I developed for their products, internal IT orchestration, and test automation.