Skip to content

Commit 6f81cc3

Browse files
harikrishna-patnaladhslove
authored andcommitted
Fix error message if specific host does not have capacity (apache#9218)
1 parent 0fcbb64 commit 6f81cc3

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

server/src/main/java/com/cloud/vm/UserVmManagerImpl.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5780,7 +5780,12 @@ public Pair<UserVmVO, Map<VirtualMachineProfile.Param, Object>> startVirtualMach
57805780
final ServiceOfferingVO offering = serviceOfferingDao.findById(vm.getId(), vm.getServiceOfferingId());
57815781
Pair<Boolean, Boolean> cpuCapabilityAndCapacity = _capacityMgr.checkIfHostHasCpuCapabilityAndCapacity(destinationHost, offering, false);
57825782
if (!cpuCapabilityAndCapacity.first() || !cpuCapabilityAndCapacity.second()) {
5783-
String errorMsg = "Cannot deploy the VM to specified host " + hostId + "; host has cpu capability? " + cpuCapabilityAndCapacity.first() + ", host has capacity? " + cpuCapabilityAndCapacity.second();
5783+
String errorMsg;
5784+
if (!cpuCapabilityAndCapacity.first()) {
5785+
errorMsg = String.format("Cannot deploy the VM to specified host %d, requested CPU and speed is more than the host capability", hostId);
5786+
} else {
5787+
errorMsg = String.format("Cannot deploy the VM to specified host %d, host does not have enough free CPU or RAM, please check the logs", hostId);
5788+
}
57845789
logger.info(errorMsg);
57855790
if (!AllowDeployVmIfGivenHostFails.value()) {
57865791
throw new InvalidParameterValueException(errorMsg);

0 commit comments

Comments
 (0)