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 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
This commit is contained in:
Devdeep Singh 2012-07-09 17:43:04 +05:30
parent 9ad450e0f7
commit 3f7911d569
1 changed files with 3 additions and 2 deletions

View File

@ -2233,8 +2233,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) {
@ -2264,7 +2265,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");
}
boolean isIso = Storage.ImageFormat.ISO == template.getFormat();
if (isIso && !template.isBootable()) {
throw new InvalidParameterValueException("Installing from ISO requires an ISO that is bootable: " + template.getId());
}