Another day - another dirty - quicky.
If you have a Windows 2016 Hyper-V cluster and a bunch of VMs you may have noticed an effect of auto balance feature. It evaluates a node’s load based on some heuristics and then moves compute resources to a better node. More details can be found here. It is enabled by default but can be easily adjusted if need be.
In my environment I need to rebalance VMs based on two factors:
- balance VMs based on their storage resources (where their VHDs reside) - i.e. after some maintenance
- balance VMs based on their compute resources (owner node) - i.e. After some over trigger-happy operator creating a bunch of VMs on single node and then cluster feature balancing them. This is a fairly easy task when you know WHAT to move where. But I’m lazy so I want the lazy job made for me.
If I need to align VMs compute to where their storage is (LiveMigrate that is) I use this:
And if I need to move storage to where compute is (Storage Migration) I prefer this snippet:
No more unnecesary IOPS