Usage: ./ghettoQuickMigrate.sh [-s SOURCE_ESX] [-d DESTINATION_ESX] [-i CONFIG_FILE_TO_OUTPUT] [-c CONFIG_FILE]
OPTIONS:
-s Source ESXi 3.5u2+ Server IP or Hostname
-d Destination ESXi 3.5u2+ Server IP or Hostname
-i Generate a configuration file
-c Configuration file to be executed
(e.g.)
Generate configuration file
./ghettoQuickMigrate.sh -s himalaya.primp-industries.com -d olga.resnet.ucsb.edu -i migrationConf
Execute configuration file
./ghettoQuickMigrate.sh -c migrationConf
[vi-admin@vima-primp-industries ~]$ sudo vifp addserver olga.resnet.ucsb.edu
root@olga.resnet.ucsb.edu's password:
[vi-admin@vima-primp-industries ~]$
[vi-admin@vima-primp-industries ~]$ sudo vifp listservers
olga.resnet.ucsb.edu
himalaya.primp-industries.com
[vi-admin@vima-primp-industries ~]$ vifpinit olga.resnet.ucsb.edu
[vi-admin@vima-primp-industries ~]$ ./ghettoQuickMigrate.sh -s olga.resnet.ucsb.edu -d kalina.resnet.ucsb.edu -i migrationConf
Retrieving info from: olga.resnet.ucsb.edu ...
Generating virtual machine list (this may take some time)....
1) quickMigrate-1
2) quickMigrate-2
3) quickMigrate-3
4) exit
Please select VM(s) to be migrated (e.g. 1,2,3,4,5 or 1,2,3-5):
[vi-admin@vima-primp-industries ~]$ ./ghettoQuickMigrate.sh -s olga.resnet.ucsb.edu -d kalina.resnet.ucsb.edu -i migrationConf
Retrieving info from: olga.resnet.ucsb.edu ...
Generating virtual machine list (this may take some time)....
1) quickMigrate-1
2) quickMigrate-2
3) quickMigrate-3
4) exit
Please select VM(s) to be migrated (e.g. 1,2,3,4,5 or 1,2,3-5):
1-3
Selected VM(s):
1) quickMigrate-1
2) quickMigrate-2
3) quickMigrate-3
Please confirm the quick migration of the listed 3 VM(s) from "olga.resnet.ucsb.edu" to "kalina.resnet.ucsb.edu"? (y or n)
y
--------------------------------------------------------------------
SOURCE :: |olga.resnet.ucsb.edu|
--------------------------------------------------------------------
quickMigrate-1 [ ]
quickMigrate-2 [ queued ]
quickMigrate-3 [ queued ]
--------------------------------------------------------------------
TARGET :: |kalina.resnet.ucsb.edu|
--------------------------------------------------------------------
====================================================================
Migrating quickMigrate-1
Status: Suspending
0/3 VM(s) migrated -- 3 VM(s) left to migrate
--------------------------------------------------------------------
SOURCE :: |olga.resnet.ucsb.edu|
--------------------------------------------------------------------
quickMigrate-2 [#### ]
quickMigrate-3 [ queued ]
--------------------------------------------------------------------
TARGET :: |kalina.resnet.ucsb.edu|
--------------------------------------------------------------------
quickMigrate-1 [ migrated ]
====================================================================
Migrating quickMigrate-2
Status: Unregistering
1/3 VM(s) migrated -- 2 VM(s) left to migrate
--------------------------------------------------------------------
SOURCE :: |olga.resnet.ucsb.edu|
--------------------------------------------------------------------
quickMigrate-3 [ queued ]
--------------------------------------------------------------------
TARGET :: |kalina.resnet.ucsb.edu|
--------------------------------------------------------------------
quickMigrate-1 [ migrated ]
quickMigrate-2 [######## ]
====================================================================
Migrating quickMigrate-2
Status: Resuming
2/3 VM(s) migrated -- 1 VM(s) left to migrate
--------------------------------------------------------------------
SOURCE :: |olga.resnet.ucsb.edu|
--------------------------------------------------------------------
--------------------------------------------------------------------
TARGET :: |kalina.resnet.ucsb.edu|
--------------------------------------------------------------------
quickMigrate-1 [ migrated ]
quickMigrate-2 [ migrated ]
quickMigrate-3 [ migrated ]
====================================================================
3/3 VM(s) migrated
Start time: Mon Jan 26 00:58:34 PST 2009
End time: Mon Jan 26 01:00:00 PST 2009
Duration : 1.43 Minutes
fpjs,
The document states clearly that you need to have shared storage amongst the ESX/ESXi hosts that you're attempting the "quick migration", if you do not, it will not work. The VM is just unregistered and should still be residing on the original ESXi host that you tried to migrate from. You should be able to go into the datastore and browse for the VM and re-register.
Note, VMware ESXi 3.5u4 was just released and the internal API seems to have been fixed and VI API will have only read-only access when using the free licensed version of ESXi. This script will most likely not work on U4, please be advised if you're going to upgrade. I have not had a chance to verify but I believe this will be the case: http://tinyurl.com/cxayy6 U3 will continue to have this hole in the API to provide both read/write access to the VI API.
Hello,
can I use this script to migrate VMs between two ESXi 4.0 hypervisors?
I have not tested on ESX(i) 4.0, I know there have been some changes to vMA 4.0 and it may or may not work but have not had any time to really test the various scripts I've written for ESX(i) 4.0
I've tried to use this script in vMA 4.0 but I'm getting error related to perl toolkit:
Could not locate /usr/lib/vmware-viperl/apps/vm/vminfo.pl, please ensure system has VI Perl Toolkit installed.
With vMA 4.0, the path has changed to /usr/lib/vmware-vcli/apps/ and you just need to update that in the script. Again, one of the few changes from VIMA 1.0 to vMA 4.0
Now I'm getting this error:
"In order for this script to function, modifications to two VI Perl Toolkit scripts must be made. These scripts will be duplicated for modification and the process will require your sudo password:
ERROR: It seems that the original scripts: "/usr/lib/vmware-vcli/apps/vm/vmcontrol.pl" or "/usr/share/doc/vmware-viperl/samples/vm/vmregister.pl" may have been modified, new required modifications can not be completed."
It looks like it try to ask for a password but I can't enter it because script is closing right away
Like I said before, there are going to be differences in the scripts I expect which is probably the bulk of the work. Good Luck
Right, this does not work very well.
I just tried to move a machine from an ESXi standalone server that sits outside my vCenter foundation. The machine disappeared and I can't start up a new machine with the old hard drive, network binding fails :-/