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
4922eda764
commit
8eb9ee6a8b
@ -1081,8 +1081,6 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
|||||||
|
|
||||||
_haMgr.cancelDestroy(vm, vm.getHostId());
|
_haMgr.cancelDestroy(vm, vm.getHostId());
|
||||||
|
|
||||||
_accountMgr.incrementResourceCount(account.getId(), ResourceType.user_vm);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!_itMgr.stateTransitTo(vm, VirtualMachine.Event.RecoveryRequested, null)) {
|
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);
|
s_logger.debug("Unable to recover the vm because it is not in the correct state: " + vmId);
|
||||||
@ -1117,6 +1115,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
|
UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_VM_CREATE, vm.getAccountId(), vm.getDataCenterIdToDeployIn(), vm.getId(), vm.getHostName(), vm.getServiceOfferingId(), vm.getTemplateId(), vm
|
||||||
.getHypervisorType().toString());
|
.getHypervisorType().toString());
|
||||||
_usageEventDao.persist(usageEvent);
|
_usageEventDao.persist(usageEvent);
|
||||||
|
|
||||||
|
_accountMgr.incrementResourceCount(account.getId(), ResourceType.user_vm);
|
||||||
|
|
||||||
txn.commit();
|
txn.commit();
|
||||||
|
|
||||||
return _vmDao.findById(vmId);
|
return _vmDao.findById(vmId);
|
||||||
@ -1642,6 +1643,8 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
|||||||
_usageEventDao.persist(usageEvent);
|
_usageEventDao.persist(usageEvent);
|
||||||
String msg = "Failed to deploy Vm with Id: " + vmId;
|
String msg = "Failed to deploy Vm with Id: " + vmId;
|
||||||
_alertMgr.sendAlert(AlertManager.ALERT_TYPE_USERVM, vm.getDataCenterIdToDeployIn(), vm.getPodIdToDeployIn(), msg, msg);
|
_alertMgr.sendAlert(AlertManager.ALERT_TYPE_USERVM, vm.getDataCenterIdToDeployIn(), vm.getPodIdToDeployIn(), msg, msg);
|
||||||
|
|
||||||
|
_accountMgr.decrementResourceCount(vm.getAccountId(), ResourceType.user_vm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -805,10 +805,6 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
|
|||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (startedVm == null) {
|
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) {
|
if (canRetry) {
|
||||||
try {
|
try {
|
||||||
changeState(vm, Event.OperationFailed, null, work, Step.Done);
|
changeState(vm, Event.OperationFailed, null, work, Step.Done);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user