Understanding VM-Host Affinity Rules: "Must" (Hard) vs. "Should" (Soft) Rules
search cancel

Understanding VM-Host Affinity Rules: "Must" (Hard) vs. "Should" (Soft) Rules

book

Article ID: 447700

calendar_today

Updated On:

Products

VMware vCenter Server VMware vSphere ESX 8.x

Issue/Introduction

This article clarifies the operational differences between Hard ("Must run on hosts in group") and Soft ("Should run on hosts in group") VM-Host affinity rules in VMware vSphere. Specifically, it details how vSphere High Availability (HA) and Distributed Resource Scheduler (DRS) respond to these constraints during normal operations and host failure events.

Environment

VMware vSphere

Cause

In vSphere clusters, VM-Host affinity rules dictate the placement of Virtual Machines (VMs) onto specific groups of ESXi hosts. Administrators can configure these rules as either mandatory (Hard) or preferential (Soft). Understanding how these rule types interact with HA and DRS is critical for ensuring proper workload availability and compliance.

Resolution

1. Hard Rules: "Must run on hosts in group"

A "Must" rule is a mandatory constraint. It dictates that the specified VMs are strictly restricted to the designated host group.

  • DRS Behavior: DRS will only migrate or place the VMs on the hosts defined within the host group.

  • vSphere HA Behavior: HA strictly respects hard rules.

  • Failure Scenario: If all hosts within the designated host group fail, HA will not attempt to restart the affected VMs on hosts outside of the group. The VMs will deliberately remain powered down because restarting them elsewhere would violate the mandatory constraint. Use this rule type when compliance or licensing requirements strictly prohibit a VM from running on certain hardware.

2. Soft Rules: "Should run on hosts in group"

A "Should" rule is a preferential constraint. It indicates a strong preference for VM placement without enforcing an absolute restriction during emergencies.

  • DRS Behavior: During normal operations, DRS will actively migrate and maintain your VMs on the designated host group. For day-to-day operations, this effectively "pins" the VMs to the hosts, functioning similarly to a hard rule.

  • vSphere HA Behavior: HA is permitted to violate a soft rule to ensure business continuity.

  • Failure Scenario: If the hosts within the designated host group fail, HA will prioritize getting the VMs back online over rule compliance. HA will automatically restart the affected VMs on any healthy, available host in the broader cluster. Use this rule type when you prefer workloads to run on specific hosts for performance or logical grouping, but availability is your ultimate priority.

Quick Comparison Matrix

Feature / Scenario"Must" Rule (Hard Rule)"Should" Rule (Soft Rule)
Constraint TypeMandatoryPreferential
Normal Operations (DRS)VMs kept on designated hostsVMs kept on designated hosts
HA Respects Rule?Yes, strictlyNo, prioritizes availability
Host Group Failure ImpactVMs remain powered offVMs restarted on other healthy cluster hosts
Primary Use CaseStrict licensing or compliance boundariesGeneral performance and logical workload grouping

Additional Information

Here is the tech-doc which shows the configuration:

Create a VM-Host Affinity Rule