Skip to content

Commit 72bef48

Browse files
Fix error message if specific host does not have capacity
1 parent 3f2761e commit 72bef48

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5409,7 +5409,12 @@ public Pair<UserVmVO, Map<VirtualMachineProfile.Param, Object>> startVirtualMach
54095409
final ServiceOfferingVO offering = serviceOfferingDao.findById(vm.getId(), vm.getServiceOfferingId());
54105410
Pair<Boolean, Boolean> cpuCapabilityAndCapacity = _capacityMgr.checkIfHostHasCpuCapabilityAndCapacity(destinationHost, offering, false);
54115411
if (!cpuCapabilityAndCapacity.first() || !cpuCapabilityAndCapacity.second()) {
5412-
String errorMsg = "Cannot deploy the VM to specified host " + hostId + "; host has cpu capability? " + cpuCapabilityAndCapacity.first() + ", host has capacity? " + cpuCapabilityAndCapacity.second();
5412+
String errorMsg;
5413+
if (!cpuCapabilityAndCapacity.first()) {
5414+
errorMsg = String.format("Cannot deploy the VM to specified host %d, requested CPU and speed is more than the host capability", hostId);
5415+
} else {
5416+
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);
5417+
}
54135418
s_logger.info(errorMsg);
54145419
if (!AllowDeployVmIfGivenHostFails.value()) {
54155420
throw new InvalidParameterValueException(errorMsg);

0 commit comments

Comments
 (0)