diff --git a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java index 7fcf88584693..5895f6069b56 100644 --- a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java +++ b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java @@ -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 {