In the last couple of months, I have noticed an increase in customer interests in using the Cross vCenter vMotion (xVC-vMotion) capability that was introduced back in vSphere 6.0. In my opinion, I still think this is probably one of the coolest features of that release. There is no longer the limitation of restricting your Virtual Machine mobility from within a single vCenter Server, but you can now live migrate a running VM across different vCenter Servers.
The primary method to start a xVC-vMotion is by using the vSphere Web Client which requires your vCenter Servers Servers to be part of the same SSO Domain and will automatically enable the new Enhanced Linked Mode (ELM) feature. ELM allows you to easily manage and view all of your vCenter Servers from within the vSphere Web Client as shown in the example screenshot below.
However, the vSphere Web Client is not the only way to start a xVC-vMotion, you can also automate it through the use of the vSphere API. In fact, there is even an "Extended" capability of xVC-vMotion that is not very well known which I have written about here which allows to live migrate a running VM across two different vCenter Servers that are NOT part of the same SSO Domain. This Extended xVC-vMotion (unofficially I am calling it ExVC-vMotion) is only available when using the vSphere API as the vSphere Web Client is unable to display vCenter Servers that are part of another SSO Domain. Below is a quick diagram to help illustrate the point in which VM1 can be seamlessly migrated between different vCenter Servers from within the same SSO Domain as well as between different vCenter Servers that are not part of the same SSO Domain.
Note: For additional details and requirements for Cross vCenter vMotion, please have a look at this VMware KB 210695 for more information.
Given the amount of interest recently and some of the feedback on my original ExVC-vMotion script which I had written about here, I figured it was time to refactor my code so that it could easily support both ExVC-vMotion as well as standard xVC-vMotion. In addition, I have also added support for migrating to and from a Distributed Virtual Switch (VDS), where as previously the example only supported Virtual Standard Switch (VSS). Lastly, the script now also supports migrating a VM that is configured with multiple vNICs.
The new script is now called xMove-VM.ps1 and is even more simpler than my original script. You will need to edit the script and update the following variables:
|vmname||Name of the VM to migrate|
|sourceVC||The hostname or IP Address of the source vCenter Server in which the VM currently resides in|
|sourceVCUsername||Username to the Source vCenter Server|
|sourceVCPassword||Password to the Source vCenter Server|
|destVC||The hostname or IP Address of the Destination vCenter Server in which to migrate the VM to|
|destVCUsername||Username to the Destination vCenter Server|
|destVCpassword||Password to the Destination vCenter server|
|datastorename||Name of the vSphere Datastore to migrate the VM to|
|clustername||Name of the vSphere Cluster name to migrate the VM to|
|vmhostname||Name of the ESXi host to migrate the VM to|
|vmnetworkname||Name of the vSphere Network(s). in the order in of the vNIC interfaces to migrate the VM to|
|switchname||Name of the vSphere Switch to migrate the VM to that is comma separated and ordered by vNIC|
|switchtype||The type of vSphere Switch (vss or vds)|
Here is a screenshot of running the script:
Note: When changing the type of vSphere Switch, the following combinations will are supported by the script as well as using the vSphere Web Client: VDS to VDS, VSS to VSS and VSS to VDS. VDS to VSS is not supported using the UI or API.
Here are some additional xVC-vMotion and vMotion articles that may also useful to be aware of:
- Are Affinity/Anti-Affinity rules preserved during Cross vCenter vMotion (xVC-vMotion)?
- Duplicate MAC Address concerns with xVC-vMotion in vSphere 6.0
- Auditing vMotion Migrations