CLOUDSTACK-1966: Primary Storage Limits are not validated while deploying the VM

Signed-off-by: Abhinandan Prateek <aprateek@apache.org>
This commit is contained in:
Sanjay Tripathi 2013-04-16 16:57:28 +05:30 committed by Abhinandan Prateek
parent fad55c5bea
commit 0ddeb65fdf
1 changed files with 5 additions and 0 deletions

View File

@ -2264,9 +2264,14 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
// check if account/domain is with in resource limits to create a new vm
boolean isIso = Storage.ImageFormat.ISO == template.getFormat();
long size = _templateHostDao.findByTemplateId(template.getId()).getSize();
if (diskOfferingId != null) {
size += _diskOfferingDao.findById(diskOfferingId).getDiskSize();
}
resourceLimitCheck(owner, new Long(offering.getCpu()), new Long(offering.getRamSize()));
_resourceLimitMgr.checkResourceLimit(owner, ResourceType.volume, (isIso
|| diskOfferingId == null ? 1 : 2));
_resourceLimitMgr.checkResourceLimit(owner, ResourceType.primary_storage, new Long (size));
// verify security group ids
if (securityGroupIdList != null) {