Network offering usage event should be logged for UserVms only
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/42cecbb0 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/42cecbb0 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/42cecbb0 Branch: refs/heads/vmware-disk-controllers Commit: 42cecbb000416978a7edcef5d8c664dac4b52277 Parents: 84c25f7 Author: Kishan Kavala <kis...@apache.org> Authored: Fri Nov 21 12:10:50 2014 +0530 Committer: Kishan Kavala <kis...@apache.org> Committed: Wed Jan 7 12:29:11 2015 +0530 ---------------------------------------------------------------------- .../src/com/cloud/vm/VirtualMachineManagerImpl.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/42cecbb0/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java ---------------------------------------------------------------------- diff --git a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java index e9cd79c..8accebe 100644 --- a/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/engine/orchestration/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -2925,8 +2925,11 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac s_logger.debug("Nic is plugged successfully for vm " + vm + " in network " + network + ". Vm is a part of network now"); long isDefault = (nic.isDefaultNic()) ? 1 : 0; // insert nic's Id into DB as resource_name - UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_ASSIGN, vmVO.getAccountId(), vmVO.getDataCenterId(), vmVO.getId(), - Long.toString(nic.getId()), network.getNetworkOfferingId(), null, isDefault, VirtualMachine.class.getName(), vmVO.getUuid(), vm.isDisplay()); + if(VirtualMachine.Type.User.equals(vmVO.getType())) { + //Log usage event for user Vms only + UsageEventUtils.publishUsageEvent(EventTypes.EVENT_NETWORK_OFFERING_ASSIGN, vmVO.getAccountId(), vmVO.getDataCenterId(), vmVO.getId(), + Long.toString(nic.getId()), network.getNetworkOfferingId(), null, isDefault, VirtualMachine.class.getName(), vmVO.getUuid(), vm.isDisplay()); + } return nic; } else { s_logger.warn("Failed to plug nic to the vm " + vm + " in network " + network);