Spaceman1984 commented on a change in pull request #4447:
URL: https://github.com/apache/cloudstack/pull/4447#discussion_r518515461



##########
File path: 
plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/XenServerGuru.java
##########
@@ -98,7 +98,12 @@ public VirtualMachineTO implement(VirtualMachineProfile vm) {
         if (userVmVO != null) {
             HostVO host = hostDao.findById(userVmVO.getHostId());
             if (host != null) {
-                
to.setVcpuMaxLimit(MaxNumberOfVCPUSPerVM.valueIn(host.getClusterId()));
+                // Max cpu cannot be more than host capability
+                if (host.getCpus() < 
MaxNumberOfVCPUSPerVM.valueIn(host.getClusterId()))
+                    to.setVcpuMaxLimit(host.getCpus());

Review comment:
       I tested XCP-NG 7.6 and Xenserver 7.6, I was unable to start a VM with 
more vCPUs than pCPUs.
   
![XCP-NG](https://user-images.githubusercontent.com/49917670/98325437-7d082100-1ff7-11eb-92c3-025412e7da43.png)
   
![Xenserver](https://user-images.githubusercontent.com/49917670/98325446-81343e80-1ff7-11eb-819c-2aa7567b2065.png)
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to