From 993852c5dfa7e406707d04429f7c63855d314e33 Mon Sep 17 00:00:00 2001 From: Devdeep Singh Date: Mon, 9 Jul 2012 17:43:04 +0530 Subject: [PATCH] CS-15429: Create instance should fail if it results in exceeding volume resource limits for a user/domain-admin. Additional fix needed if an instance is being created from an ISO. If an instance is created from an iso disk offering id is not null and only one root volume disk is created. Making a fix to pass the right resource count for an instance being created from an iso. Reviewed-By: Rajesh --- server/src/com/cloud/vm/UserVmManagerImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index ee008041108..324ce536bbb 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -2265,8 +2265,9 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager } // check if account/domain is with in resource limits to create a new vm + boolean isIso = Storage.ImageFormat.ISO == template.getFormat(); _resourceLimitMgr.checkResourceLimit(owner, ResourceType.user_vm); - _resourceLimitMgr.checkResourceLimit(owner, ResourceType.volume, (diskOfferingId == null ? 1 : 2)); + _resourceLimitMgr.checkResourceLimit(owner, ResourceType.volume, (isIso || diskOfferingId == null ? 1 : 2)); //verify security group ids if (securityGroupIdList != null) { @@ -2296,7 +2297,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager if (listZoneTemplate == null || listZoneTemplate.isEmpty()) { throw new InvalidParameterValueException("The template " + template.getId() + " is not available for use", null); } - boolean isIso = Storage.ImageFormat.ISO == template.getFormat(); + if (isIso && !template.isBootable()) { throw new InvalidParameterValueException("Installing from ISO requires an ISO that is bootable: ", null); }