mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge release branch 4.18 to main
* 4.18: xen/xcpng: set vmr.VCPUsMax to minimum of global setting and host cpu cores (#7887)
This commit is contained in:
commit
40d7da6707
@ -17,7 +17,6 @@
|
||||
package com.cloud.hypervisor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -96,14 +95,7 @@ public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru,
|
||||
if (userVmVO != null) {
|
||||
HostVO host = hostDao.findById(userVmVO.getHostId());
|
||||
if (host != null) {
|
||||
List<HostVO> clusterHosts = hostDao.listByClusterAndHypervisorType(host.getClusterId(), host.getHypervisorType());
|
||||
HostVO hostWithMinSocket = clusterHosts.stream().min(Comparator.comparing(HostVO::getCpuSockets)).orElse(null);
|
||||
Integer vCpus = MaxNumberOfVCPUSPerVM.valueIn(host.getClusterId());
|
||||
if (hostWithMinSocket != null && hostWithMinSocket.getCpuSockets() != null &&
|
||||
hostWithMinSocket.getCpuSockets() < vCpus) {
|
||||
vCpus = hostWithMinSocket.getCpuSockets();
|
||||
}
|
||||
to.setVcpuMaxLimit(vCpus);
|
||||
to.setVcpuMaxLimit(MaxNumberOfVCPUSPerVM.valueIn(host.getClusterId()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1338,7 +1338,7 @@ public abstract class CitrixResourceBase extends ServerResourceBase implements S
|
||||
vmr.VCPUsMax = (long)vmSpec.getCpus();
|
||||
} else {
|
||||
if (vmSpec.getVcpuMaxLimit() != null) {
|
||||
vmr.VCPUsMax = (long)vmSpec.getVcpuMaxLimit();
|
||||
vmr.VCPUsMax = Math.min(vmSpec.getVcpuMaxLimit(), (long) _host.getCpus());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user