How to separate Hyper-V virtual machines using anti-affinity

Sometimes you do not want to have two virtual machines running on the same Hyper-v host. For example when those two VM’s offer some sort of redundancy, like domain controllers. If case both DC’s run on the same host, and if you have only two DC’s in the domain, failure of the Hyper-V host will result in lose of the domain.

Fortunately when Hyper-V host are part of a fail-over cluster anti-affinity rules can be created. Not as easy as using the GUI in vCenter, but using a tool on the command line.

To separate your virtual machines called DC1 and DC1 , use the command below.

  • cluster group “dc1” /prop AntiAffinityClassNames=”domaincontrollers”
  • cluster group “dc2” /prop AntiAffinityClassNames=”domaincontrollers”

You can later view which AntiAffinityClassName you’ve assigned a virtual machine by looking at its cluster group properties:

  • cluster group “dc1” /prop

More info here

Taken from:

Add a Comment

Your email address will not be published. Required fields are marked *

Current ye@r *