bug CS-15859: put a check on volume limit

This commit is contained in:
Abhinandan Prateek 2012-08-06 17:50:29 +05:30
parent edf747495b
commit 4146b4273d
1 changed files with 4 additions and 2 deletions

View File

@ -3423,8 +3423,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
idList.add(new IdentityProxy(oldAccount, oldAccount.getAccountId(), "accountId"));
throw new InvalidParameterValueException("The account with the specified id should be same domain for moving VM between two accounts.", idList);
}
// don't allow to move the vm if there are existing PF/LB/Static Nat rules, or vm is assigned to static Nat ip
List<PortForwardingRuleVO> pfrules = _portForwardingDao.listByVm(cmd.getVmId());
if (pfrules != null && pfrules.size() > 0){
@ -3454,6 +3453,9 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
//VV 2: check if account/domain is with in resource limits to create a new vm
_resourceLimitMgr.checkResourceLimit(newAccount, ResourceType.user_vm);
//VV 3: check if volumes are with in resource limits
_resourceLimitMgr.checkResourceLimit(newAccount, ResourceType.volume, _volsDao.findByInstance(cmd.getVmId()).size());
// VV 4: Check if new owner can use the vm template
VirtualMachineTemplate template = _templateDao.findById(vm.getTemplateId());
if (!template.isPublicTemplate()) {