VMware
1 2 Previous Next 15 Replies Last post: Jan 27, 2009 9:46 AM by s1xth  

"Quick" migration script for VM(s) running on ESXi 3.5u2+ posted: Jan 26, 2009 8:37 AM

Click to view lamw's profile Champion 2,803 posts since
Nov 27, 2007
Morning,

Check out the new script here

=========================================================================
--William
VMware ESX/ESXi scripts and resources at: http://engineering.ucsb.edu/~duonglt/vmware/

Click to view s1xth's profile Expert 478 posts since
Jul 29, 2008
Wow. I gotta get this in my test environment, this looks sick, cant wait to try it out!
Click to view s1xth's profile Expert 478 posts since
Jul 29, 2008
William...maybe you could help me. I am stuck at this point with this error message...


VI Fast Pass "vifpinit" has not been executed for either "vifpinit.acme.com" or "vifpinit.acme.com"!
Please run the following once prior to executing this script:

vifpinit test.acme.com
or
vifpinit test2.acme.com

You can check your environmental variables to ensure the following have been defined:

env | grep VI

VI_SERVER, VI_PROTOCOL, VI_PORTNUMBER, VI_SERVICEPATH, VI_USERNAME and VI_PASSWORD

I DID run the vifpinit on each server, when I run the env | grep VI I get the following output. Now I THINK the reason this is failing is because its trying to use the wrong VI_USERNAME and Password to access the server....how can I change these variables? It seems like it can not access the servers....I think...


--vi-admin@vimatest ~--$ env | grep VI

VI_SERVER=test.acme.com
VI_PROTOCOL=https
VI_PORTNUMBER=443
VI_SERVICEPATH=/sdk
VI_USERNAME=vi-admin00
VI_PASSWORD=526330fcfdfca0bf

Click to view s1xth's profile Expert 478 posts since
Jul 29, 2008
Ok, well I did everything you asked for and everything came back fine.

I ran this command and it displayed information about the server. I can list the two servers when I run the listserver command, so they are definitly being managed correctly. Any other ideas on what could be prevently my from running the script from that point of the script? Both servers are listed as being managed by VIMA. O and after I execute it the first time nothing happens, it just runs and drops to a blank prompt.
/usr/lib/vmware-viperl/apps/host/hostinfo.pl --server test.acme.com
Click to view s1xth's profile Expert 478 posts since
Jul 29, 2008

I am stuck here when I try to run the script. But BOTH servers ARE in the list and have had vifpinit run on them.

VI Fast Pass "vifpinit" has not been executed for either "vifpinit.acme.com" or "vifpinit.acme.com"!
Please run the following once prior to executing this script:

vifpinit test.acme.com
or
vifpinit test2.acme.com

You can check your environmental variables to ensure the following have been defined:

env | grep VI

VI_SERVER, VI_PROTOCOL, VI_PORTNUMBER, VI_SERVICEPATH, VI_USERNAME and VI_PASSWORD

Click to view s1xth's profile Expert 478 posts since
Jul 29, 2008
Yeah its odd....I went back through everything a coouple of times (granted I am multi-tasking here). I am going to try to take a look at it closer tonight if I get some time and see what exactly could be causing that, its odd because both servers are listed as being registered to the VIMA. It doesnt matter that I am running VIMA on VMWare player does it? (i never had an issue using that before..but jw)....and just so you know I am running Update 3 of ESXi on BOTH servers.
Click to view s1xth's profile Expert 478 posts since
Jul 29, 2008
Actually....I am running via ssh...so I will try it right from the VIMA and see if that works. I'll let you know! Thanks for the help!
Click to view s1xth's profile Expert 478 posts since
Jul 29, 2008
Ok...I have good news. I got the script to work, but now I am stuck with another issue. Let me explain what I was doing wrong first. I was running vifpinit on BOTH servers THAN trying run the script. I re-read you directions (which by the way are EXCELLENT) and I missed the step where you only ran the init on ONE server, the source, ran the script and it worked, partially.

My issue now, like I said I ran the script, it connected to my SOURCE server, I was able to select the VM I wanted to migrate, and it migrated it to the DETINATION server. Although, when I log into the DESTINATION server the VM is NOT there. At the bottom of the "recent tasks window" I have the following error listed..

Register Virtual Machine ha-datacenter X-The Object or item referred to could not be found. intiated by vi-admin00

Not sure why this is happening. The vm still resides on the SOURCE server, BUT I have to go into the datastore and re-register the .vmx file. The VMis no where on the DESTINATION server.The script does everything and reports NO errors at all.

Any idea? I dont think I am missing anything....let me know if you need more information.

Thanks!


EDIT: Ahhhh CRAP! I didnt read this part, sorry! ...*migrations of virtual machines residing on shared storage between the hosts. *These are two different machines, NOT sharing storage, so this script will not work correct between two NON-shared storage devices.

Really nice script though, maybe once I get some shared storage I can utilize something like this. :-)

VMware Developer

SDKs, APIs, Videos, Learn and much more in the Developer community.

Learn More

Developer Sample Code

Increase your developer productivity with VMware API sample code.

Learn More

VMworld Sessions & Labs

Online access to the latest VMworld Sessions & Labs and online services.

Learn more

Purchase PSO Credits Online

Purchase credits to redeem training and consulting services online.

Buy Now

Community Hardware Software

View reported configurations or report your own.

Learn More

VMware vSphere

Come witness the next giant leap in virtualization.

Register Today

Communities