Skip to content

Add a soft host-tag VM placement preference (affinity processor) - #14083

Open
nagaboinaramgopal wants to merge 1 commit into
apache:mainfrom
nagaboinaramgopal:pr/host-tag-affinity
Open

Add a soft host-tag VM placement preference (affinity processor)#14083
nagaboinaramgopal wants to merge 1 commit into
apache:mainfrom
nagaboinaramgopal:pr/host-tag-affinity

Conversation

@nagaboinaramgopal

@nagaboinaramgopal nagaboinaramgopal commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a new affinity group processor for a soft host-tag placement preference. A group of type "host tag affinity" uses the group name as a host tag, and when a member VM deploys, hosts in its zone with that tag get a higher deployment priority. It is only a preference: no host is excluded, deployment still works when no tagged host is free, and check() never fails a destination. This is the soft counterpart to the existing strict host tag on service and disk offerings. The raised priority is a planner hint and is not used by automatic DRS.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

N/A

How Has This Been Tested?

Unit tests cover the three paths: tagged hosts get a higher priority, no matching tag is a no-op, and check() returns true.

Also on a live lab with three KVM hosts in one zone: tagged a single host, created a "host tag affinity" group named after the tag, and deployed. All the VMs in the group landed on the tagged host, and a VM outside the group landed on an untagged host.

How did you try to break this feature and the system with this change?

Deployed with no host carrying the tag: the processor does nothing and the VM still deploys. Ran a VM outside the group to confirm the untagged host was a valid target, so the tag preference is what steered placement, not a lack of options. Since it only raises priority and never excludes a host, a full or missing tagged host cannot block a deployment.

Adds a host-tag affinity processor. An affinity group of type "host tag
affinity" takes the group name as a host tag; when a member VM is deployed,
routing hosts carrying that tag in the VM's zone get their deployment
priority raised. It is a preference and not a constraint: no host is ever
added to the avoid set, so deployment still succeeds when no tagged host is
available, and check() never fails a planned destination. The raised
priority is not consulted by automatic DRS.

Unit tests cover the three paths: tagged hosts get priority raised (nothing
excluded), an empty match is a no-op, and check() returns true.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant