diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index 9ba38e486e2..377ced9ae0f 100755 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -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 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()) {