mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Bug 10377 - API listAccounts return vmtotal=-14
This commit is contained in:
parent
a1622d9f75
commit
1bfe6d8d72
@ -1077,8 +1077,6 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
||||
|
||||
_haMgr.cancelDestroy(vm, vm.getHostId());
|
||||
|
||||
_accountMgr.incrementResourceCount(account.getId(), ResourceType.user_vm);
|
||||
|
||||
try {
|
||||
if (!_itMgr.stateTransitTo(vm, VirtualMachine.Event.RecoveryRequested, null)) {
|
||||
s_logger.debug("Unable to recover the vm because it is not in the correct state: " + vmId);
|
||||
@ -1113,6 +1111,9 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
||||
UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_VM_CREATE, vm.getAccountId(), vm.getDataCenterIdToDeployIn(), vm.getId(), vm.getHostName(), vm.getServiceOfferingId(), vm.getTemplateId(), vm
|
||||
.getHypervisorType().toString());
|
||||
_usageEventDao.persist(usageEvent);
|
||||
|
||||
_accountMgr.incrementResourceCount(account.getId(), ResourceType.user_vm);
|
||||
|
||||
txn.commit();
|
||||
|
||||
return _vmDao.findById(vmId);
|
||||
@ -1638,6 +1639,8 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
||||
_usageEventDao.persist(usageEvent);
|
||||
String msg = "Failed to deploy Vm with Id: " + vmId;
|
||||
_alertMgr.sendAlert(AlertManager.ALERT_TYPE_USERVM, vm.getDataCenterIdToDeployIn(), vm.getPodIdToDeployIn(), msg, msg);
|
||||
|
||||
_accountMgr.decrementResourceCount(vm.getAccountId(), ResourceType.user_vm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -796,10 +796,6 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
|
||||
}
|
||||
} finally {
|
||||
if (startedVm == null) {
|
||||
// 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);
|
||||
}
|
||||
if (canRetry) {
|
||||
try {
|
||||
changeState(vm, Event.OperationFailed, null, work, Step.Done);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user