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.
vCenter Server
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.
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 :
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.