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.
VMware vSphere
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.
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.
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.
| Feature / Scenario | "Must" Rule (Hard Rule) | "Should" Rule (Soft Rule) |
| Constraint Type | Mandatory | Preferential |
| Normal Operations (DRS) | VMs kept on designated hosts | VMs kept on designated hosts |
| HA Respects Rule? | Yes, strictly | No, prioritizes availability |
| Host Group Failure Impact | VMs remain powered off | VMs restarted on other healthy cluster hosts |
| Primary Use Case | Strict licensing or compliance boundaries | General performance and logical workload grouping |
Here is the tech-doc which shows the configuration:
Create a VM-Host Affinity Rule