From e001d7e5774b2fdb9d9ffdaf4ede0c2eabf3320f Mon Sep 17 00:00:00 2001 From: kishan Date: Tue, 7 Sep 2010 13:19:14 +0530 Subject: [PATCH] bug : 6095 Show proper error when vm create fails due to insufficient capacity --- .../manager/allocator/impl/UserConcentratedAllocator.java | 2 +- server/src/com/cloud/vm/UserVmManagerImpl.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/server/src/com/cloud/agent/manager/allocator/impl/UserConcentratedAllocator.java b/server/src/com/cloud/agent/manager/allocator/impl/UserConcentratedAllocator.java index db609ed23c8..ff19d794e12 100755 --- a/server/src/com/cloud/agent/manager/allocator/impl/UserConcentratedAllocator.java +++ b/server/src/com/cloud/agent/manager/allocator/impl/UserConcentratedAllocator.java @@ -142,7 +142,7 @@ public class UserConcentratedAllocator implements PodAllocator { } if (availablePods.size() == 0) { - s_logger.debug("There are no pods with enough memory/CPU capacity in zone" + zone.getName()); + s_logger.debug("There are no pods with enough memory/CPU capacity in zone " + zone.getName()); return null; } else { // Return a random pod diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index 35cbf0bab8b..3d9a29ac097 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -1299,6 +1299,10 @@ public class UserVmManagerImpl implements UserVmManager { podsToAvoid.add(pod.first().getId()); } + if(pod == null){ + throw new ResourceAllocationException("Create VM " + ((vm == null) ? vmId : vm.toString()) + " failed. There are no pods with enough CPU/memory"); + } + if ((vm == null) || (poolid == 0)) { throw new ResourceAllocationException("Create VM " + ((vm == null) ? vmId : vm.toString()) + " failed due to no Storage Pool is available"); }