Home > Blogs > VMware vSphere Blog


“vMotion without shared storage” API

My colleague Frank Denneman recently asked me whether there was a new vSphere API for the new enhancement made to vMotion in vSphere 5.1, which would allow you to migrate a live running virtual machine without the need of shared storage. The simple answer is no, the new enhancement to vMotion operation has been integrated into the existing Storage vMotion API call which is the RelocateVM_Task method.

If you specify both the datastore and host property in the VirtualMachineRelocateSpec to the RelocateVM_Task method, you will be performing a combined vMotion + Storage vMotion. If you just specify the datastore property, then a regular Storage vMotion will be performed. For a regular vMotion operation, you will need to use the MigrateVM_Task method. To get more details, please refer to the vSphere API Reference Guide.

To demonstrate how the RelocateVM_Task method works for a combined vMotion + Storage vMotion, I created a simple vSphere SDK for Perl script called migrateVM.pl. You will need a system with the vCLI installed or use the vMA appliance.

Disclaimer: These script are provided for informational/educational purposes only. It should be thoroughly tested before attempting to use in a production environment.

In the example below, I have two ESXi 5.1 hosts (172.30.0.243 & 172.30.0.251) and they both contain only local datastores (local-datastore-2 & local-datastore-3). I will be migrating a virtual machine called FRANK which resides on one of the ESXi host on local storage to the other ESXi host with only local storage.

FRANK currently resides on ESXi host 172.30.0.251 and datastore local-datastore-3 as seen in the screenshot of our vSphere Web Client.

Now we perform the combined vMotion + Storage vMotion by connecting to our vCenter Server and specifying the –vmname (Virtual Machine to migrate), –vihost (ESXi host to migrate to) and –datastore (datastore to migrate to ) property.

If we go back and refresh the vSphere Web Client, we should see a RELOCATED tasks completion and the FRANK virtual machine has been moved to ESXi host 172.30.0.243 and datastore local-datastore-2.

Get notification of new blog postings and more by following lamw on Twitter:  @lamw

17 thoughts on ““vMotion without shared storage” API

  1. Pingback: Welcome to vSphere-land! » vSphere 5.1 Link-O-Rama

  2. Gabi

    Hi,

    It is superb but do we have any NIC recommendation setups/designs?

    Would be great to find out what config is required and minimum NICs?

    Thanks,

    Gabi

    Reply
    1. William LamWilliam Lam Post author

      If you want to leverage the new vMotion w/o Shared Storage, you will need both a vCenter Server 5.1 + ESXi 5.1. If you just want to perform a regular vMotion, then the script can be modified to run against vSphere 4.x

      Reply
  3. Arun

    I can able to migrate all vms from one host to another without shared storage, but i can’t do the same for the following servers (vCenter, View Connector, View Security & View Transfer server). Is there any limitation for these servers.

    Reply
  4. Carl

    Is there a form of ‘incremental transfer’ occurring.
    For instance – can I ‘pre-transfer’ from ESX-Server-A to ESX-Server-B, the storage at midnight –

    Therefore – If at Midday I want to flip a VM from ESX-Server-A to ESX-Server-B, then I wont have to wait for (say) 1TB to transfer – just the increments that may have accumulated since midnight

    Reply
  5. Vasiliy

    William,
    Do you know if SDK provides a way to test CPU compatibility before invoking relocate task so you don’t have migration failure due to CPU mismatch?

    Reply
  6. Paul Van Goethem

    I used your script for migrating from one storage system (HP-EVA) to another (HP-3PAR) and at the same time also to new ESX hardwares (HP-Blades G8).
    Because the old and the new hardware are in different clusters I had to adapt the script: I had to specify the pool parameter :

    my $clusterName= “ESX51-CLU-02″; # to make a parameter from this …
    my $clusterView = Vim::find_entity_view(view_type => ‘ClusterComputeResource’, filter => {name => $clusterName});

    # relocate spec for both datastore, host
    my $spec = VirtualMachineRelocateSpec->new(datastore => $datastore_view, host => $host_view, pool => $clusterView->resourcePool);

    thanks for the script !
    Paul

    Reply
    1. Anderson

      Sir,
      Can you help me ?? I got error “Unable to find ESXi Host: xx Server FQDN”; what’s problem ??

      Which version is vSphete and vCenter ??

      if you can, please e-mail to me

      Thanks a lot

      Reply
  7. Greg Schultz

    Paul, trying to implement a cluster to cluster migration using your suggestion. Can you provide an example script of how to accomplish?

    Reply
  8. Anderson

    Dear William,

    I got a error message, “Unable to find ESXi Host: xx Server FQDN”; what’s problem ?? Can you help me !! vSphere 5.1U1 w/ vCenter 5.1 1c

    Reply

Leave a Reply

Your email address will not be published. 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=""> <strike> <strong>