vmpmotion.pl [download]
Storage VMotion is a new feature in ESX 3.5 that allows you to move your VM's .vmdk files from one VMFS datastore to another with no downtime. While the idea is brilliant and can save you from the dreaded downtime, the implementation that VMware has put together for the initial release of ESX 3.5.0 is pretty kludgey. If you have to move any number of VMs from one datastore to another you may find yourself cursing VMware for not adding this functionality to VirtualCenter and reserving it for the Remote CLI which also made its debut with the ESX 3.5.0 VC 2.5 release. I have written a small wrapper script for the Remote CLI which simplfies the use of Storage VMotion. The VMware process looks like this:
vicfg:~# svmotion --url=https://vc.yourdomain.com/sdk --username=dominic \ --password=password --datacenter='MyDatacenter' \ --vm="[source-datastore] vm1/vm1.vmx:destination-datastore"
The script is a bit more friendly, just edit the script to include your VC url, username, password, cluster and Datacenter, then you will be prompted with a list of VMs to choose from, and a list of target datastore to choose from. Output will look similar to the following
vicfg:~# ./vmpmotion.pl cluster: dominic [0] vm1 : [dominic-lun01] vm1/vm1.vmx [1] vm2 : [dominic-lun02] vm2/vm2.vmx Enter selection: 0 You selected vm1 [0] dominic-lun01 [1] dominic-lun02 Enter target : 1 You selected dominic-lun02 Performing Storage VMotion of vm1 to dominic-lun02
To install, just copy this script to your RemoteCLI host, and then make the script executable:
vicfg:~# chmod +x vmpmotion.pl vicfg:~# ./vmpmotion.pl
Remember to test this process out on a development server. It has worked well for me and saved me lots of time, hopefully it will do the same for you. I am not responsible for your (mis)use of this script. If you have any comments or feedback feel free to drop me an email at dominic@vmprofessional.com.