Want to migrate a bunch of VMs to specific hosts in cluster. All VMs in cluster use full memory reservations. Consequently if I migrate VMs using MOVE-VM I end up with some vMotions failing due to lack of resources on destination (the destination will eventually have enough room for VMs, but due to order of migrations may not have enough at time move attempted).
Just ordering VMs by desitnation host with least memory wont work as the host with the least memory could have VMs that are in to be migration list as well, causing a temporary lack of resources.
Is there any way to have MOVE-VM prevalidate the move? I was hoping the -whatif argument could do this, it doesnt appear it can?
Not with the Move-VM cmdlet I'm afraid.
There are a number of API methods that allow you to select the optimal host and datastore for a VM migration.
But from your explanation I gather that you need more than just checking if the destination has sufficient resources (memory being the major one).
Ideally I guess would be to simulate the target situation, and from there use a kind of an optimalisation algorithm.
Very interesting, but definitely not simple :smileygrin:
Thanks as always!
I figured that was the answer, but wanted to check.
I'm currently planning on taking the list of VMs, gathering list of hosts and sorting by memory ascending, moving first VM to destination host if it fits, if it doesnt fit set VM aside and try at end of loop, and continuining through until complete.
This is for a DRS script I am writing. DRS doesnt do a good job a balancing all VM vCPU settings per host, instead relying on dynamic migrations to move hot vCPU usage VMs intraday via vMotion. Intraday vMotion is not an option for me. So wanted to have an aggressive DRS placement/rebalance (scheduled) script to make recommendations.
Script makes VM migration recommendations to balance VMs across hosts in cluster by: VMs, vCPU, CPU reservation, VM vCPU sizes, and large vCPU VMs (> 8 vCPU). After running the script the each of those specs should be balanced across all host in cluster.