itsexe
Enthusiast
Enthusiast

Difference between Affinity and Anti-Affinity Rules?

Hi All,

I have three question please help me in these

Question 1- What is the difference between Affinity and Anti-Affinity rules and from where we create them?

Question 2- The below document from VMware states that High Availability does not consult DRS rules for affinity or anti-affinity when a virtual machine is powering on. If anti-affinity rules cant achieve that than what is the purpose of document.& why can only we create rules with 4 servers because as per this document "This requires at least four hosts to support a Microsoft Cluster of two virtual machines"

                    VMware KB: Affinity or anti-affinity DRS rules are not applied during a virtual ...

Question 3- I have two ESXi hosts with Windows clustered VM's VM-A running on ESXi host 1 and VM-B is running on ESXi host 2 how can i make sure that VMHA should not reboot these VM's  on other host in case of one Server failure.


Regards,

Khurram Shahzad

Regards, Khurram Shahzad
3 Replies
admin
Immortal
Immortal

Please find the response inline:

Question 1- What is the difference between Affinity and Anti-Affinity rules and from where we create them?

Affinitty rule means both the VMs will stick to the same host always. These VMs cannot be separated either by a vMotion or Automated DRS.

Anti-Affinity rule means both the VMs will stay on separate ESXi hosts. They will never be together except in HA if the number of hosts in cluster are less.

Question 2- The below document from VMware states that High Availability does not consult DRS rules for affinity or anti-affinity when a virtual machine is powering on. If anti-affinity rules cant achieve that than what is the purpose of document.& why can only we create rules with 4 servers because as per this document "This requires at least four hosts to support a Microsoft Cluster of two virtual machines"

                    VMware KB: Affinity or anti-affinity DRS rules are not applied during a virtual ...

Yes HA does not consult DRS for any rules while powering on since HA is a scenario where your host is impacted due to a network outage. So in HA by default your clustered VM network is impacted. So vCenter drives your VM to ensure it is up and running by moving to another host which is running good. But once VM is powered on, DRS will migrate the VM to satisfy the rules. By design, HA takes precedence over DRS.

Question 3- I have two ESXi hosts with Windows clustered VM's VM-A running on ESXi host 1 and VM-B is running on ESXi host 2 how can i make sure that VMHA should not reboot these VM's  on other host in case of one Server failure.

Yes you can do that by going to the "Virtual machine options" under "vSphere HA" and below disabling the HA for the concerned VM.

itsexe
Enthusiast
Enthusiast

Hi Aakhash,

Thanks for your reply in such detail can you please also answer my queries below:

1- If the VM is a windows clustered VM with RDM's than in this case what is the purpose of creating anti-afinity rule when that VM with RDM can not be vMotioned so DRS has no chance of moving it.

2.VMware KB: Affinity or anti-affinity DRS rules are not applied during a virtual machine power-on The article is making me confuse because in start its giving solution to a problem i.e." Affinity or anti-affinitry DRS rules are not applied during a VM power on" and than it says "High Availability does not consult DRS rules for affinity or anti-affinity when a virtual machine is powering on" so what is the objective. Can you please guide If i follow the same document will it help me to stop moving the VM's to other host during HA(Please note that I have only two hosts in cluster).


3. Disabling HA for a particular VM is done through "Virtual Machine Options (VM Restart Priority/Host Isolation Responce)" or "VM Monitoring" inside HA cluster settings?

Regards, Khurram Shahzad
0 Kudos
admin
Immortal
Immortal


Please find the response inline:

1- If the VM is a windows clustered VM with RDM's than in this case what is the purpose of creating anti-afinity rule when that VM with RDM can not be vMotioned so DRS has no chance of moving it.

Now that would depend. If the concerned RDM device is presented to both the hosts, then it can be vMotioned. Please refer kb 1005241.

2.VMware KB: Affinity or anti-affinity DRS rules are not applied during a virtual machine power-on The article is making me confuse because in start its giving solution to a problem i.e." Affinity or anti-affinitry DRS rules are not applied during a VM power on" and than it says "High Availability does not consult DRS rules for affinity or anti-affinity when a virtual machine is powering on" so what is the objective. Can you please guide If i follow the same document will it help me to stop moving the VM's to other host during HA(Please note that I have only two hosts in cluster).

Please check recommendation 3 if you have 2 host based cluster and you want the anti affinity rule to be maintained and HA does not manipulate the VMs.

3. Disabling HA for a particular VM is done through "Virtual Machine Options (VM Restart Priority/Host Isolation Responce)" or "VM Monitoring" inside HA cluster settings?

On the Section VM Restart Priority/Host Isolation Response, there is a section Virtual machine options below on the same wizard which is by default "Use Cluster Settings". Set the concerned VM to "Leave Powered On"

0 Kudos