mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-7870: When Vm deployments fail and end in error state volume count should be decremented
(cherry picked from commit a8b89bea4f)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
54d08a8e29
commit
4ea0dcda9b
|
|
@ -1464,6 +1464,7 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
|
|||
} else {
|
||||
volService.destroyVolume(volume.getId());
|
||||
}
|
||||
// FIXME - All this is boiler plate code and should be done as part of state transition. This shouldn't be part of orchestrator.
|
||||
// publish usage event for the volume
|
||||
UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VOLUME_DELETE, volume.getAccountId(), volume.getDataCenterId(), volume.getId(), volume.getName(),
|
||||
Volume.class.getName(), volume.getUuid(), volume.isDisplayVolume());
|
||||
|
|
|
|||
|
|
@ -4812,7 +4812,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||
newVol = volumeMgr.allocateDuplicateVolume(root, null);
|
||||
}
|
||||
|
||||
// Create Usage event for the newly created volume
|
||||
// 1. Save usage event and update resource count for user vm volumes
|
||||
_resourceLimitMgr.incrementResourceCount(newVol.getAccountId(), ResourceType.volume, newVol.isDisplay());
|
||||
_resourceLimitMgr.incrementResourceCount(newVol.getAccountId(), ResourceType.primary_storage, newVol.isDisplay(), new Long(newVol.getSize()));
|
||||
// 2. Create Usage event for the newly created volume
|
||||
UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_VOLUME_CREATE, newVol.getAccountId(), newVol.getDataCenterId(), newVol.getId(), newVol.getName(), newVol.getDiskOfferingId(), template.getId(), newVol.getSize());
|
||||
_usageEventDao.persist(usageEvent);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue