Bug 9273: resource cont going -ve

adding addtional check that ensure we decrease the count in advanceStart only on new vm creation.
This commit is contained in:
Murali Reddy 2011-04-22 01:19:23 +05:30
parent 3b75abbde7
commit 435c20c0cc

View File

@ -738,7 +738,8 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
}
} finally {
if (startedVm == null) {
if (vm.getType().equals(VirtualMachine.Type.User)) {
// decrement only for user VM's and newly created VM
if (vm.getType().equals(VirtualMachine.Type.User) && (vm.getLastHostId() == null)) {
_accountMgr.decrementResourceCount(vm.getAccountId(), ResourceType.user_vm);
}
changeState(vm, Event.OperationFailed, null, work, Step.Done);