I didn't see this brought up in past discussions. Is there any way to use Move-VM to move a VM to a new host, but keep it in the same resource pool?
We have VirtualCenter and multiple hosts and want to simply move a VM from one host to another manually (with DRS disabled for the time being). We're doing some VMotion testing.
When using Move-VM with the destination being the new host, it moves the VM out of its resource pool and under the Data Center object. We can certainly run another Move-VM command to move it "back" into its resource pool, but I'm not sure why it does this to begin with.
Any ideas?
Thanks!
Eric K. Miller, Genesis Hosting Solutions, LLC
- Lease part of our ESX cluster!
The current Move-VM cmdlet is definitely not doing what the SDK MigrateVM_Task method is doing.
It looks as if Move-VM is using the RelocateVM_Task method instead.
This seems to be confirmed by the vpxd log when the Move-VM cmdlet is executed.
And Move-VM doesn't seem to use the targetpool feature that both of the SDK methods are using.
Perhaps someone knowledgeable cares to explain the apparent limitations of the Move-VM cmdlet ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
What argument are you using for -destination? Are you using something like -destination (get-vmhost hostiwant | get-resourcepool pooliwant)?
We're using the following 2 commands in a row to accomplish the 1 task:
Get-VM "Test Machine" | Move-VM -Destination (Get-VMHost esxhost06.genesishosting.com)
Get-VM "Test Machine" | Move-VM -Destination (Get-ResourcePool -Name "Test Resource Pool")
Eric K. Miller, Genesis Hosting Solutions, LLC
- Lease part of our ESX cluster!
We're using the following 2 commands in a row to accomplish the 1 task:
Get-VM "Test Machine" | Move-VM -Destination (Get-VMHost esxhost06.genesishosting.com)
Get-VM "Test Machine" | Move-VM -Destination (Get-ResourcePool -Name "Test Resource Pool")
Eric K. Miller, Genesis Hosting Solutions, LLC
The trouble with identically named pools is getting the one you want. Could you try
Get-VM "Test Machine" | Move-VM -Destination (Get-VMHost esxhost06.genesishosting.com | Get-ResourcePool -Name "Test Resource Pool")
to see if it does what you want?
Thanks for the help!
We don't have any identically named pools. Did you see something in my example that looked like that?
Adding both Get-VMHost and Get-ResourcePool in an "or" like you wrote resulted in only an attempted move to the resource pool. VC ignored the host move. Since the VM is already in that resource pool, it basically did nothing.
Eric K. Miller, Genesis Hosting Solutions, LLC
- Lease part of our ESX cluster!
Carter, your suggestion is OK if you want to move the VM to another individual ESX host.
But it doesn't seem to work when you want to move a VM to another ESX host in the same cluster.
The resource pool belongs to the cluster in this case.
And the VM, if not already in there, is moved to the resource pool but stays on the same ESX host.
And this is, at least for us, to most frequent "move" we are doing.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Also, I noticed that the Move-VM that moves a VM between hosts performs a "Relocate Virtual Machine Storage" task. When other Storage VMotion tasks are happening, VirtualCenter's concurrency control blocks the Move-VM for a significant amount of time (shows an "In Progress" status for "waiting" tasks), especially if the running Storage VMotion tasks take 30 minutes or more (larger VMs obviously).
I really wish VMware would provide some parameters for over-riding these concurrency controls. We find that in many cases, they don't benefit us at all from a performance perspective and usually cause unnecessary delays. VMware's support indicated that there is no over-ride and that it's hard-coded.
Eric K. Miller, Genesis Hosting Solutions, LLC
- Lease part of our ESX cluster!
Agreed. The ability to control the relocation of the storage is important. We want to move our VM from ESX1 to ESX2, and both see the same datastore that holds the VM, so there shouldn't be any need to relocation storage.
If you use the PowerScripter plugin (www.powerscripter.net), you could right click on a virtual machine and run the following script. If you don´t have Cluster, you could change the foreach to DataCenter. My issue is, that a get-vmhost -resourcepool $respool is giving no objects -otherwise it would be a lot easier because no knowledge about DataCenter or Cluster would ne needed.
#--hideoutput
$vm = $_
$vmhost = get-vmhost -VM $vm
$respool = Get-ResourcePool -VM $vm
foreach ($hostrp in (Get-Cluster -VM $vm | get-vmhost)) {
if ($hostrp.name -ne $vmhost.name)
{
Move-VM $vm -Destination $hostrp
Move-VM $vm -Destination $respool
break
}
}
Dennis
PowerScripter - customize VI client or VirtualCenter