-
Notifications
You must be signed in to change notification settings - Fork 304
Description
/kind bug
What steps did you take and what happened:
We tried to set spec.numCoresPerSocket: 0 value for a VSphereMachineTemplate. We wanted to assign that value to 0 because that's the same value vSphere interface assigns when we a VM's CPU Topology is configured to Assigned at power on. We confirmed that through the Developer Center -> Code Capture recording after manually cloning the machine from the template, the same flow the operator does. Using the Golang for the Code Capture output shows something like this:
//---------------ReconfigVM_Task---------------
var spec = types.VirtualMachineConfigSpec{}
spec.NumCoresPerSocket = 0
spec.DeviceChange = []types.BaseVirtualDeviceConfigSpec{}
var spec_VirtualNuma = &types.VirtualMachineVirtualNuma{}
spec.VirtualNuma = spec_VirtualNuma
var req = &types.ReconfigVM_Task{}
req.This = managedObject
req.Spec = spec
methods.ReconfigVM_Task(ctx, r, req)Instead, every time we tried to create a new VM with the above template, it would instead set numCoresPerSocket to the same value as numCPUs.
What did you expect to happen:
We expected the value of 0 to be respected as that is the way vSphere does.
Anything else you would like to add:
I've done a some local setup changing the portion of the code that does the the assignment of numCoresPerSocket. I've changed from
.
.
if numCoresPerSocket == 0 {
.
.to
.
.
if numCoresPerSocket < 0 {
.
.and that made the CPU Topology from the Template I'm using be respected, instead of forcefully assigning to the same number of CPUs the machine has. I'm not sure if that's the correct way but for now it works for me, I can create a Template with the CPU Topology configured to Assigned at power on and that works for my use case.
Environment:
- Cluster-api-provider-vsphere version: 1.14.0
- Kubernetes version: (use
kubectl version): 1.32.8 - OS (e.g. from
/etc/os-release): Ubuntu 24.04.3 LTS