This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch 4.19
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.19 by this push:
new 517cddcb15c Fix error message if specific host does not have capacity
(#9218)
517cddcb15c is described below
commit 517cddcb15cbbd95300e31ac5f5331140515bcd4
Author: Harikrishna <[email protected]>
AuthorDate: Thu Jun 13 12:38:51 2024 +0530
Fix error message if specific host does not have capacity (#9218)
---
server/src/main/java/com/cloud/vm/UserVmManagerImpl.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
index 4d966d8e745..a8810dea54e 100644
--- a/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
@@ -5409,7 +5409,12 @@ public class UserVmManagerImpl extends ManagerBase
implements UserVmManager, Vir
final ServiceOfferingVO offering =
serviceOfferingDao.findById(vm.getId(), vm.getServiceOfferingId());
Pair<Boolean, Boolean> cpuCapabilityAndCapacity =
_capacityMgr.checkIfHostHasCpuCapabilityAndCapacity(destinationHost, offering,
false);
if (!cpuCapabilityAndCapacity.first() ||
!cpuCapabilityAndCapacity.second()) {
- String errorMsg = "Cannot deploy the VM to specified host " +
hostId + "; host has cpu capability? " + cpuCapabilityAndCapacity.first() + ",
host has capacity? " + cpuCapabilityAndCapacity.second();
+ String errorMsg;
+ if (!cpuCapabilityAndCapacity.first()) {
+ errorMsg = String.format("Cannot deploy the VM to
specified host %d, requested CPU and speed is more than the host capability",
hostId);
+ } else {
+ 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);
+ }
s_logger.info(errorMsg);
if (!AllowDeployVmIfGivenHostFails.value()) {
throw new InvalidParameterValueException(errorMsg);