Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to migrate a bunch of VMs from one ESX 3.5 Cluster to another. Storage needs to be migrated from one iSCSI SAN to another, as well as the VMs.

Hosts on Cluster A have access to one iSCSI SAN but not the destination. Hosts on Cluster B have access to both SANs.

Manually I can do this by powering down a VM, doing the migration with the storage specified to migrate as well, then powering up the VM in the new cluster.

I know I can do this with multiple scheduled tasks, but the power on task cannot tell whether the migration has completed. I'd have to guess the appropriate times.

How can I create a scheduled task that will do all this, with each step waiting till the preceding one has finished?

Bonus points if anyone can suggest how I can also reconfigure the Network label used by the network card of the VM as part of the scheduled task - the new cluster has the port groups named differently, so I am not sure the VM will connect to the new Port Group correctly after migration completes (at least the manual migration tool is flagging a potential issue here).

share|improve this question
    
I figured out that it was better to create a port group on each host in Cluster B with the same name as the port group on Cluster A. This port group goes on the same virtual switch as the new port group. Then when moving the VM, it is able to start up and talk on the network, and I can switch to the new port group when convenient. Not quite automated, but a lot simpler. –  dunxd Sep 28 '10 at 8:05
    
Hey dunxd, would you be opposed to a Powershell/powerCLI script? I can probably automate the entire process for you... –  JakeRobinson Sep 28 '10 at 15:04
    
Info would be great. Does Powershell/CLI work for ESX 3.5, or is that something I need vSphere for? –  dunxd Sep 28 '10 at 15:13
    
It works fine with VI 3.5. I am assuming since you have clusters, you also have a virtualcenter server, which makes it even easier. –  JakeRobinson Sep 28 '10 at 15:20
    
Yes - Virtual Center server 2.5 in place. –  dunxd Sep 28 '10 at 15:20

2 Answers 2

up vote 1 down vote accepted

I agree with Jake. VMware's PowerCLI is very good, and will give you the control you need.

As for "how I can also reconfigure the Network label used by the network card of the VM as part of the scheduled task" - sounds like you need to rename the portgroup on the original host.

Without access to PowerCLI here, I think it's something like:

$objHost = Get-VMhost -name "<FQDN>"
foreach ($objPortGroup in (Get-VirtualPortGroup -VMhost $objHost)) {
if ( $objPortGroup -eq "old name" ) {
$objPortGroup | Set-VirtualPortGroup -Name "new name" -confirm:$false
}
}

Like I say, this is untested, and I appreciate it's not as concise as some PowerCLI example, but I go for clarity over cleverness.

share|improve this answer

Powershell/PowerCLI script using the relocateVM method.

vmware thread here. It could easily be modified to add the poweroff/poweron tasks, you could have it read from a csv file with names of servers you want to migrate, or just create a seperate windows scheduled task for each server.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.