Updated Branches: refs/heads/4.2 2d87e6437 -> a9efec640
CLOUDSTACK-3949:[Object_Store_Refactor][Usage] No usage event is generated for registered ISO. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a9efec64 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a9efec64 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a9efec64 Branch: refs/heads/4.2 Commit: a9efec6403a6b97e25bb2b50ea5f78305402bf8d Parents: 2d87e64 Author: Min Chen <[email protected]> Authored: Tue Jul 30 18:05:08 2013 -0700 Committer: Min Chen <[email protected]> Committed: Tue Jul 30 18:05:34 2013 -0700 ---------------------------------------------------------------------- server/src/com/cloud/template/HypervisorTemplateAdapter.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a9efec64/server/src/com/cloud/template/HypervisorTemplateAdapter.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/template/HypervisorTemplateAdapter.java b/server/src/com/cloud/template/HypervisorTemplateAdapter.java index d106e91..21a0f6e 100755 --- a/server/src/com/cloud/template/HypervisorTemplateAdapter.java +++ b/server/src/com/cloud/template/HypervisorTemplateAdapter.java @@ -214,6 +214,10 @@ public class HypervisorTemplateAdapter extends TemplateAdapterBase { long accountId = tmplt.getAccountId(); if (template.getSize() != null) { // publish usage event + String etype = EventTypes.EVENT_TEMPLATE_CREATE; + if (tmplt.getFormat() == ImageFormat.ISO) { + etype = EventTypes.EVENT_ISO_CREATE; + } // get physical size from template_store_ref table long physicalSize = 0; DataStore ds = template.getDataStore(); @@ -227,7 +231,7 @@ public class HypervisorTemplateAdapter extends TemplateAdapterBase { Scope dsScope = ds.getScope(); if (dsScope.getScopeType() == ScopeType.ZONE) { if (dsScope.getScopeId() != null) { - UsageEventUtils.publishUsageEvent(EventTypes.EVENT_TEMPLATE_CREATE, template.getAccountId(), dsScope.getScopeId(), template.getId(), template.getName(), null, + UsageEventUtils.publishUsageEvent(etype, template.getAccountId(), dsScope.getScopeId(), template.getId(), template.getName(), null, null, physicalSize, template.getSize(), VirtualMachineTemplate.class.getName(), template.getUuid()); } else{ @@ -235,7 +239,7 @@ public class HypervisorTemplateAdapter extends TemplateAdapterBase { } } else if (dsScope.getScopeType() == ScopeType.REGION) { // publish usage event for region-wide image store using a -1 zoneId for 4.2, need to revisit post-4.2 - UsageEventUtils.publishUsageEvent(EventTypes.EVENT_TEMPLATE_CREATE, template.getAccountId(), -1, template.getId(), template.getName(), null, null, + UsageEventUtils.publishUsageEvent(etype, template.getAccountId(), -1, template.getId(), template.getName(), null, null, physicalSize, template.getSize(), VirtualMachineTemplate.class.getName(), template.getUuid()); } _resourceLimitMgr.incrementResourceCount(accountId, ResourceType.secondary_storage, template.getSize());
