Use this topic when workloads should co-locate, HA placement appears to ignore a preferred relationship, or an affinity rule reduces the number of viable recovery hosts.
Affinity
Affinity expresses co-location intent. It can reduce latency or keep tightly coupled components together, but it can also concentrate a failure domain. Platforms may implement affinity as a hard requirement, soft preference, group rule or scheduler hint; exact enforcement must be verified before relying on it for availability behavior.
1. Affinity keeps related VMs together (e.g. app and cache).
2. Use soft rules where possible.
3. Hard rules can block HA.
4. Document reasons.
5. Review regularly.
rule → placement decisions
Test the rule with reduced host capacity and review whether the resulting shared failure domain matches the application design.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
It does not show the rule can always be satisfied during larger failures or that co-location improves application availability.
Next check: Test the rule with reduced host capacity and review whether the resulting shared failure domain matches the application design.
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification path Verify boundary
rule definition → VM/resource membership → candidate hosts → scheduler evaluation → co-location outcome → workload test
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Affinity preference ≠ guaranteed co-location unless enforcement is hard.
- Co-location can increase correlated failure impact.
- An affinity rule can conflict with capacity or other placement rules.
- Rule configured ≠ rule currently satisfiable.
ha-manager rules list— Proxmox affinity rules (newer versions)(Get-ClusterGroup <vm>).AntiAffinityClassNames— Hyper-V anti-affinityGet-DrsRule (PowerCLI)— vSphere DRS rules
ReferenceImportant terms & boundaries2 sections · depth on demand
What this shows and what it does not
Affinity configured ≠ enforced; enforced ≠ always satisfiable; co-located ≠ more available.
Affinity describes placement relationship, not application dependency. Application architecture still determines whether co-location is desirable.
In depth
Affinity rules keep VMs together on the same host — e.g. an application server with its cache for low-latency traffic, or VMs bound to licensed hosts (VM–host affinity).
# vSphere: Cluster > Configure > VM/Host Rules (Keep VMs together; VMs to Hosts must/should)
# Proxmox 8.x HA groups: restrict VMs to a set of nodes with priorities
ha-manager groupadd licensed --nodes 'pve1:2,pve2:1' --restricted 1
Use "should" rules where possible; "must" rules can block HA restarts when the required hosts are down.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in High Availability → Affinity. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://libvirt.org/docs.html · confidence 94%Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
High Availability → Affinity reference map
Fast HA boundaries for High Availability → Affinity.
| Boundary | Meaning | Evidence limit |
|---|---|---|
| Intent | Keep resources together | Policy objective |
| Strength | Hard vs soft/best-effort | Platform-specific |
| Candidate impact | May reduce eligible hosts | Can hurt failover flexibility |
| Outcome | Observed co-location | Verify under failure |