Tag Archives: drs

is vSphere HA aware of DRS affinity rules?

Recently I was exploring vSphere HA interop with DRS affinity rules. It is quite interesting to know that as of vCenter server 5.5, how vSphere HA deals with various DRS affinity rules.

Here are the current DRS rules we can configure on the DRS cluster:
1. VM-VM affinity rule: This rule is intended to keep group of VMs together on single host.

2. VM-VM anti-affinity rule: This rule is intended to keep group of VMs away from each other all the time.

3. VM-Host affinity rule: This rule restricts to run a group of VMs on a group of Host. It is mean that, VMs in VM group should/must always be running on hosts in Host Group. This rule can be hard/must or soft/should rule.

4. VM-Host anti affinity rule: This rule is exactly opposite to above VM-Host Affinity rule. This rule does not allow  to  run a group of VMs on a group of Host. This rule can be hard/must or soft/should rule.

Now question is : whether vSphere HA aware of DRS affinity rules? Answer is “Yes”, as of vSphere 5.5, vSphere HA is aware of 2 DRS rules. Here are the rules those are honored by vSphere HA.

1 . VM-Host must affinity/anti-affinity rule

2.  VM-VM anti-affinity rule.

vSphere HA honors these rules, it is mean that, in case of host failure, if re-starting VMs on available host  leads to rule violation, vSphere HA will not re-start VMs those were on the failed host. vSphere HA will raise the error instead.

Example: Say , you have a HA-DRS enabled cluster of 2 hosts (H1, H2) & with 2 VMs (VM1-H1, VM2-H2) one on each host in powered on state. Now you configured VM-Host must affinity rule :HostGroup:H1 & VMGroup:VM1. It is mean that VM1 must always run on H1. Once you configure this rule, say, H1 host got failed. Now vSphere HA will try to restart the VM on H2 but as HA knows that VM-Host rule is configured, it will not restart the VM1 on H2.

It is important to note that, by default, VM-Host must affinity/anti-affinity is honored by vSphere HA. You just need to configure VM-host must affinity/anti-affinity rule but in order to make VM-VM anti-affinity rule vSphere HA aware, you will have to configure one HA advanced option “das.respectVmVmAntiAffinityRules” to true. (default value of this advanced option is false). I repeat this is a HA advanced option, not the DRS advanced option. You can configure this option from web client through this workflow (Cluster>>Manage>>vSphere HA>>Advanced option). However, you can configure this option from Desktop client as well.

It is also important to note that, even when DRS is disabled on cluster, HA continues to honor them. As per the current design, we can not disable these rules when DRS is disabled. Hence care must be taken while disabling DRS, you can disable these rule when you disable DRS or when you want to disable these rules, enable DRS for a while in conservative migration threshold mode & disable these rules.

As I specified earlier, in case of host failure, HA will not restart VMs if that is going to violate the configured rule. Hence, admin need be to very cautious while configuring these rules as these rule can have availability impact. These rules should be configured when it is absolutely required.