Skip to content

Commit 1a47719

Browse files
authored
kvm: set cpu topology only if cpucore per socket is positive value (#4527)
This PR fixes a regression issue in #4497 In cloudstack 4.14 or before, the cpu topology is set only when cpucore per socket is set (to 4 or 6). in other conditions, there is no cpu topology in vm xml definition. with #4497, vm will have cpu topology in its xml definition, if cpucore per socket is not set. <topology sockets='<vm cpu cores>' cores='1' threads='1'/> Not sure if it causes any issue. I think it would be better not to add this part in vm xml definition if cpucore per socket is not set.
1 parent 93f3d35 commit 1a47719

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4239,10 +4239,10 @@ private void setCpuTopology(CpuModeDef cmd, int vcpus, Map<String, String> detai
42394239
numCoresPerSocket = 6;
42404240
} else if (vcpus % 4 == 0) {
42414241
numCoresPerSocket = 4;
4242-
} else {
4243-
numCoresPerSocket = 1;
42444242
}
42454243
}
4246-
cmd.setTopology(numCoresPerSocket, vcpus / numCoresPerSocket);
4244+
if (numCoresPerSocket > 0) {
4245+
cmd.setTopology(numCoresPerSocket, vcpus / numCoresPerSocket);
4246+
}
42474247
}
42484248
}

0 commit comments

Comments
 (0)