Q
Manage Learn to apply best practices and optimize your operations.

What happens when you violate affinity or anti-affinity rules?

Just because VM placement is flexible doesn't mean you should take it for granted. Affinity rule conflicts can take a serious toll on the functionality of multiple VMware platforms.

It isn't difficult to create affinity and anti-affinity rules for VMs and host systems, but it's important to consider...

some of the potential pitfalls and problems you might encounter along the way. One common example is VM-VM affinity rule conflicts. It's certainly possible to create multiple VM-VM affinity rules, but it is also possible for these rules to conflict.

For example, a conflict occurs when one rule keeps two VMs together on the same system, while another rule inadvertently keeps those same two VMs apart on the same system. Conflicting rules cannot run together. Older rules typically take precedence over newer rules, and anti-affinity rules typically take precedence over affinity rules. Administrators can edit or disable conflicting rules.

VM-host rule conflicts can also occur. VM-host rules are all applied equally. Suppose the same VM is included in two different VM-host affinity rules specifying two different host groups; the VM can only run on hosts included in the two different host groups. As with VM-VM rules, the older VM-host rules usually take precedence over newer rules. VMware platforms, like Distributed Resource Scheduler (DRS), vSphere High Availability (HA) and vSphere Distributed Power Management (DPM) will never violate a must or must not rule -- though they can violate should or should not rules.

The effects of rule conflicts

Rule conflicts and other unintended violations can cause functional or performance problems -- DRS, HA and DPM might not operate as intended. For example, DRS won't migrate VMs to enable a host maintenance mode if the migration violates a must or must not rule. Similarly, DRS won't spin up VMs, DRS won't migrate VMs for load balancing, vSphere HA won't fail over VMs and vSphere DPM won't migrate VMs to put hosts into standby mode if these operations result in a must or must not rule violation.

The easiest way to prevent functional problems due to rule violations is to use should or should not (preferential) rules rather than must or must not (required) rules. You should review rules, compare them against other rules and then test in a nonproduction environment before you deploy them in production. In addition, allocate enough hosts to the DRS group to ensure that rule snafus don't cause computing shortfalls. An administrator can employ alarms to report rule violations. For example, add an alarm to a VM using the VM is violating VM-host affinity rule as an event trigger.

Affinity rules can't read minds

It's important to point out that VM-host and VM-VM rules do not understand why those rules are implemented in the first place. That's beyond the scope of affinity and anti-affinity rules. For example, if you implement VM-host affinity rules to ensure that specific VMs only run on hosts with properly licensed software, the rules do not monitor whether those hosts are actually licensed properly or not. It's up to the business to correlate the rules to the reasons that provoked those rules. This might require a higher level of policymaking or periodic review to ensure that rules are still necessary and appropriate.

VM placement and migration are incredibly flexible -- that's one of the attributes that makes virtualization so rewarding for the enterprise. But flexible VM placement doesn't mean random VM placement.

VM placement and migration are incredibly flexible -- these attributes contribute to why virtualization is so rewarding for the enterprise. But flexible VM placement doesn't mean random VM placement. New and failover instances should never be placed entirely by chance. A virtualization administrator can take advantage of VMware's DRS and HA affinity and anti-affinity rules to govern the way that VMs are placed with respect to hosts and other VMs. Still, there are limitations and issues that administrators must consider when working with affinity.

Next Steps

Prevent load-balancing hiccups by being prepared

Keep things running smoothly with smart HA and DRS rules

Save money by consolidating servers with DPM

This was last published in September 2017

Dig Deeper on DRS and DPM

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Join the conversation

1 comment

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

What safeguards do you have in place to avoid improper VM placement?
Cancel

-ADS BY GOOGLE

SearchServerVirtualization

SearchVirtualDesktop

SearchDataCenter

SearchCloudComputing

Close