VM compute vMotion fails with the error "The virtual machine has CPU and/or memory affinities configured "
search cancel

VM compute vMotion fails with the error "The virtual machine has CPU and/or memory affinities configured "

book

Article ID: 400005

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

When attempting to migrate a VM to any of the hosts in the environment the compatibility fails with the follow error:

Validate compatibility from the below KB:

vMotion fails during validation stage of migration with error: Compatibility Check Failure

Environment

VMware vSphere 7.x

VMware vSphere 8.x

 

Cause

The virtual machine has a CPU affinity configuration defined. This setting restricts the VM to run on specific physical CPU cores, preventing it from being migrated to another host that may not meet the exact CPU mapping.

You can validate for powered on VMs from the vmx file searching for sched.cpu.affinity :

Resolution

To allow vMotion, the CPU affinity settings must be removed or modified:

  1. Power off the virtual machine.

  2. Remove CPU affinity configuration:

    • Via vSphere UI:

      • Edit the VM settings > VM Options > Advanced > Configuration Parameters.

      • Remove any parameters such as sched.cpu.affinity.

    • Or via direct .vmx file edit :

      • Browse to the vmx file of the VM at /vmfs/volumes/<DATASTORE_NAME>/<VM_NAME>
      • Take a backup of the .vmx file:
        • cp VM_name.vmx VM_name.vmx.bkp
      • Remove or comment out any sched.cpu.affinity entries.

  3. Power on the VM and retry the vMotion.

 

Reference KB to edit the .vmx file of the VM using vi editor: 

https://knowledge.broadcom.com/external/article/345284/editing-files-on-an-esxi-host-using-vi.html

 

Additional Information