VMware Cloud Community
StephenMoll
Expert
Expert

Should it be possible to set CpuAffinity for VMs on Clustered Hosts?

My reading suggests that it shouldn't be possible. Indeed if you look in the webclient, it won't be possible to set CPU "Scheduling Affinity" there.

If you use PowerCLI however it is possible, and generates no errors.

Is this correct behaviour?

I'm using VCSA 6.7 with ESXi 6.5 hosts.

0 Kudos
4 Replies
depping
Leadership
Leadership

When DRS is enabled then this option doesn't/shouldn't work.

VMware Knowledge Base

0 Kudos
StephenMoll
Expert
Expert

I understand that. I just note that PowerCLI allows  the setting of these parameters without error.

i guess then, that if set this way, they will have no effect. Correct?

0 Kudos
LucD
Leadership
Leadership

This is not a PowerCLI thing, the API method also allows it.

$vm = get-vm -Name $vmName

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec

$spec.CpuAffinity = New-Object VMware.Vim.VirtualMachineAffinityInfo

$spec.CpuAffinity.AffinitySet = @()


$vm.ExtensionData.ReconfigVM($spec)


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
LucD
Leadership
Leadership

There is an effect, when you try to vMotion the VM (just like the KB Duncan referenced says), it will fail.

move-error.png

My conclusion, the API method (and hence the PowerCLI cmdlet built on it) allows to change the setting, irrespective if the VM is located in  a DRS enabled cluster or not.

But all future vMotions will fail.

The Web Client is apparently more intelligent, and doesn't allow you to create this situation.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos