You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mc...@apache.org on 2013/07/31 03:13:35 UTC

git commit: updated refs/heads/master to 622a9e1

Updated Branches:
  refs/heads/master a8360e41c -> 622a9e1b9


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/622a9e1b
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/622a9e1b
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/622a9e1b

Branch: refs/heads/master
Commit: 622a9e1b9573b5b993d495ea881eeb047e3d180d
Parents: a8360e4
Author: Min Chen <mi...@citrix.com>
Authored: Tue Jul 30 18:05:08 2013 -0700
Committer: Min Chen <mi...@citrix.com>
Committed: Tue Jul 30 18:08:05 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/622a9e1b/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());