Skip to content

Commit

Permalink
xen: set vmr.VCPUsMax to minimum of global setting and host cpu cores
Browse files Browse the repository at this point in the history
  • Loading branch information
weizhouapache committed Aug 28, 2023
1 parent 35b6566 commit dbc0aa7
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,12 @@ public VM createVmFromTemplate(final Connection conn, final VirtualMachineTO vmS
vmr.VCPUsMax = (long)vmSpec.getCpus();
} else {
if (vmSpec.getVcpuMaxLimit() != null) {
vmr.VCPUsMax = (long)vmSpec.getVcpuMaxLimit();
long vcpuMaxLimit = (long) vmSpec.getVcpuMaxLimit();
if (vcpuMaxLimit <= _host.getCpus()) {
vmr.VCPUsMax = vcpuMaxLimit;
} else {
vmr.VCPUsMax = (long) _host.getCpus();
}
}
}
} else {
Expand Down

0 comments on commit dbc0aa7

Please sign in to comment.