Updated Branches: refs/heads/master bd6f706b7 -> b0a1528c5
CLOUDSTACK-5349: Volume create usage event and resource count werent getting registered. Check its type rather than it is UserVm since the code is coming from VirtualMachineManager. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b0a1528c Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b0a1528c Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b0a1528c Branch: refs/heads/master Commit: b0a1528c5a73271ed862e307c9d43a8e6766158d Parents: bd6f706 Author: Nitin Mehta <[email protected]> Authored: Wed Dec 4 11:01:33 2013 -0800 Committer: Nitin Mehta <[email protected]> Committed: Wed Dec 4 11:01:33 2013 -0800 ---------------------------------------------------------------------- .../engine/orchestration/VolumeOrchestrator.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b0a1528c/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java index fdc2d23..a10dc66 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java @@ -524,10 +524,17 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati vol = _volsDao.persist(vol); // Save usage event and update resource count for user vm volumes - if (vm instanceof UserVm) { - - UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VOLUME_CREATE, vol.getAccountId(), vol.getDataCenterId(), vol.getId(), vol.getName(), offering.getId(), - null, size, Volume.class.getName(), vol.getUuid()); + if (vm.getType() == VirtualMachine.Type.User) { + UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VOLUME_CREATE, + vol.getAccountId(), + vol.getDataCenterId(), + vol.getId(), + vol.getName(), + offering.getId(), + null, + size, + Volume.class.getName(), + vol.getUuid()); _resourceLimitMgr.incrementResourceCount(vm.getAccountId(), ResourceType.volume); _resourceLimitMgr.incrementResourceCount(vm.getAccountId(), ResourceType.primary_storage, new Long(vol.getSize())); @@ -564,7 +571,7 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati vol = _volsDao.persist(vol); // Create event and update resource count for volumes if vm is a user vm - if (vm instanceof UserVm) { + if (vm.getType() == VirtualMachine.Type.User) { Long offeringId = null;
