7 Replies Latest reply on Apr 2, 2014 9:33 AM by Brian Knutsson

    How to X-vMotion / Enhanced vMotion etc.

    Brian Knutsson Enthusiast
    vExpert

      Hi,

       

      Has anyone had any success figuring out how to do a vMotion operation on a VM without shared storage? I am surprised why there are no sample workflow for this standard operation.

       

      /Brian

        • 1. Re: How to X-vMotion / Enhanced vMotion etc.
          ChristianWehner Hot Shot
          VMware Employees

          Hi Brian,

           

          you can figure it out by using onyx Onyx – VMware Labs run onyx, start a session to your vCenter and start a vMotion like you need it. Onyx will present you the API calls which are needed to do this non shared storage vMotion. And onyx will present it to you in javascript so you can copy/paste it direct to the vCO and run it in most the cases

           

          If you need any help on getting the onyx output running, you can post the output here and there will be one who can help you

           

          Cheers, Chris

          • 2. Re: How to X-vMotion / Enhanced vMotion etc.
            Brian Knutsson Enthusiast
            vExpert

            Last time I checked the Web Client was not supported by Onyx, so I don't see how that is going to help me.

            • 3. Re: How to X-vMotion / Enhanced vMotion etc.
              ChristianWehner Hot Shot
              VMware Employees

              Onyx is now supported for version 5.5.x so you are able to test this I'm not sure it works through the Web Client but with the installed Client it is working.

              • 4. Re: How to X-vMotion / Enhanced vMotion etc.
                Brian Knutsson Enthusiast
                vExpert

                Hi Christian,

                 

                Let me enlighten you.

                 

                • You cannot use Onyx with the Web Client.
                • You cannot do X-vMotion from the gui client, that was what I was trying to hint you.

                 

                On the bright side, I got this from VMware:

                 

                From vCO, you need to invoke:  RelocateVM_Task

                Here is sample script:

                var spec = new VcVirtualMachineRelocateSpec();

                spec.datastore = Server.findForType("VC:Datastore", managedObject.vimHost.id + "/datastore-383");;

                spec.host = Server.findForType("VC:HostSystem", managedObject.vimHost.id + "/host-382");;

                spec.disk = System.getModule("com.vmware.onyx").array(VcVirtualMachineRelocateSpecDiskLocator, 1);

                spec.disk[0] = new VcVirtualMachineRelocateSpecDiskLocator();

                spec.disk[0].diskId = 2000;

                spec.disk[0].datastore = Server.findForType("VC:Datastore", managedObject.vimHost.id + "/datastore-383");;

                managedObject.relocateVM_Task(spec, VcVirtualMachineMovePriority.defaultPriority);  // VirtualMachine

                 

                I have not tried it out yet, but I wanted to share this anyway. I will report back when I have testet it.

                1 person found this helpful
                • 5. Re: How to X-vMotion / Enhanced vMotion etc.
                  Brian Knutsson Enthusiast
                  vExpert

                  Ok, so I figured out that I need to import the Onyx module to get it working.

                   

                  Like described in the Readme.html from Onyx download:

                  To use the generated JavaScript in a vCO workflow

                  • Create a new module in the Actions tab named "com.vmware.onyx".
                  • Right-click on the new module and add the action  array.action  that is located in  "<Onyx directory>\Extensions\Onyx.Interpreters.VcoJavaScript".
                  • Copy the generated script into a scripting task and modify it to suit your needs.

                   

                  I also figured out that I need to create an input parameter VC:VirtualMachine called managedObject.

                  I have exchanged the host-<id> to the moref id of the destination host. I got this from powerCLI with the following command:

                  get-vmhost myHost | get-view

                   

                  I have exchanged the datastore-<id> with my destination datastore-id. I got this from powerCLI with the following command:

                  get-datastore myDatastore | get-view

                   

                  And the it worked. I just need to get vCO to fill in the blanks, so I do not need to use powershell. Does anyone know how to do this?

                   

                  The javascript lines in question are these:

                  spec.datastore = Server.findForType("VC:Datastore", managedObject.vimHost.id + "/datastore-383");;

                  spec.host = Server.findForType("VC:HostSystem", managedObject.vimHost.id + "/host-382");;

                  • 6. Re: How to X-vMotion / Enhanced vMotion etc.
                    Burke- Virtuoso
                    VMware Employees

                    first off, when dealing with Onyx code, I personally prefer to replace "managedObject" with a more meaningful variable name... in this case, I would change it to "vm".

                     

                    As for the two lines you mention, assuming you have a VC:Datastore object variable named "datastore" and a VC:HostSystem object variable named "hostSystem", those values (name-number) can be obtained by:

                    datastore.id

                    hostSystem.id

                    1 person found this helpful
                    • 7. Re: How to X-vMotion / Enhanced vMotion etc.
                      Brian Knutsson Enthusiast
                      vExpert

                      Thank you Burke. In the meantime I figured that out myself.

                       

                      Here is a package with a working workflow for doing X-vMotion.

                       

                      I hope it helps someone.

                       

                      dk.atea.extra_v1.0.package

                      http://ge.tt/7qPXj3W1/v/0