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).
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.
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.