Cross vCenter VM Mobility - CLI

Communities:

Cross vCenter VM Mobility - CLI is a command line interface (CLI) tool that can be used to migrate or clone a VM from one host to another host managed by a linked or isolated vCenter (VC) instance. It has been built using vSphere Java-based SDK APIs.

Currently, as of vSphere 6.0, the vSphere HTML5 Web Client allows users to perform Cross-VC operations like migration and cloning if two VCs are linked. If VCs are not linked, users cannot view the infrastructure across multiple VCs and thus, cannot utilize this functionality through UI. This Fling provides a way for users to access this vSphere feature through simple CLI commands. It also supports cross-cluster placement and shared storage vMotion between two VCs.

  • JDK 1.7 or above
  • Two vCenter instances with ESX 6.0
  • Windows : Windows Server 2003 or above
  • Linux : RHEL 7.x or above, Ubuntu 11.04 or above

How to Run
----------
1. Set JAVA_HOME (preferably jdk1.7 or above)
2. Run the below command from extracted folder,

Linux : /home/user1/xvc-mobility-cli>sh xvc-mobility.sh
Windows : C:\xvc-mobility-cli>xvc-mobility.bat

Commands

xvc-mobility -svc <source-vc-ip> -su <source-vc-username> -dvc
<destination-vc-ip> -du <destination-vc-username> -vms <vm-names> -dh
<destination-host> -dds <destination-datastore> -op relocate
Note :- VC Passwords will be asked on the prompt. Don't use this tool to
migrate linked clones between VCs.

Parameters

-op : operation - <required> {relocate, clone}
-svc : source vc ip/dns name/url - <required>
-su : source vc username - <required>
-dvc : destination vc ip/dns name/url - <required>
-du : destination vc username - <required>
-vms : one or more vm names separated by comma - <required>
-cln : clone vm name - [required for clone operation]
-dcl : destination drs cluster - [required when dest host is not given]
-dh : destination host - [required when dest drs-cluster is not given]
-dds : destination datastore - [optional but required for multiple vms to relocate]
-swt : destination switch type - [optional {vss / vds}]
-dnw : destination network switch name - [required when switch type is given]

Notes

  • Arguments can be specified either through command line or
    config/config.properties, command line arguments take precedence
  • -dcl or -dh must be provided. if -dh is provided and -dds is not provided
    then vm's datastore is assumed to be shared between source and
    destination hosts and migrate happens only at host level.
  • both -dh and -dds are mandatory for multiple vms to relocate.
  • if -op is clone, then -cln(clone vm name) is mandatory
  • only one vm can be cloned at a time
  • special characters must be enclosed in double quotes.

Version 1.2

  • Support to pass password as command line arguments for vm migrate/clone automation

Version 1.1

  • Updated the code to chose destination network details while clone/relocate a vm to destination VC.
Add a Comment
Report a Bug