Storage vMotion fails for a SDRS cluster with Error: “This operation would violate a virtual machine affinity/anti-affinity rule”
search cancel

Storage vMotion fails for a SDRS cluster with Error: “This operation would violate a virtual machine affinity/anti-affinity rule”

book

Article ID: 420837

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

When attempting to migrate virtual machines or their disks within SDRS enabled datastore cluster, the operation doesn't proceed and gives the following error:
Datastore Faults error: This operation would violate a virtual machine affinity/anti-affinity rule

This issue occurs even when the datastore cluster’s “Keep VMDKs Together” setting is disabled, and can prevent VM creation, relocation, or SDRS based migrations.

Environment

vCenter Server

Cause

The failure occurs due to affinity rules enforced when disks have storage policies (storage profiles) attached.

VMs with storage profiles on their disks become “affined.” These disks are expected to be placed together on the same datastore. This affinity behavior is enforced regardless of the datastore cluster’s “Keep VMDKs Together” setting.

Even if the cluster level option is disabled, storage policies force disks to stay on the same datastore.

Current SDRS implementation enforces placement of affined disks together for initial placement operations (create, relocate, clone, reconfigure). When SDRS detects that disks would land on different datastores, it throws a RuleViolation fault. This is expected behavior to maintain compliance with storage policy requirements.

Resolution

To allow migrating disks independently within the same datastore cluster, you can override the affinity enforcement by modifying an SDRS advanced option.

Steps to Relax Affinity Enforcement :

  • Browse to the SDRS cluster in the vSphere Client.
  • Click Configure.
  • Under Services, select Storage DRS and click Edit.
  • Expand Advanced Options.
  • In the Option column, type ForceAffinePoweron.
  • In the Value column, type 0.
  • Click ADD
  • Click OK.

This change relaxes the enforcement for initial placement operations including:

VM creation
VM relocation
Cloning
Reconfiguration

Once set, SDRS will allow individual VM disks to be placed on different datastores within the same datastore cluster without triggering RuleViolation errors.

Note: This change only affects initial placement behavior. Existing storage policies and compliance mechanisms should still be reviewed to ensure they meet operational requirements.