Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1449B10413 for ; Wed, 31 Jul 2013 01:05:44 +0000 (UTC) Received: (qmail 7693 invoked by uid 500); 31 Jul 2013 01:05:44 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 7676 invoked by uid 500); 31 Jul 2013 01:05:43 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 7669 invoked by uid 99); 31 Jul 2013 01:05:43 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Jul 2013 01:05:43 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id AFC91830ABE; Wed, 31 Jul 2013 01:05:43 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: mchen@apache.org To: commits@cloudstack.apache.org Message-Id: <765b7d3d0fe140cf89d82d566631a9ea@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/4.2 to a9efec6 Date: Wed, 31 Jul 2013 01:05:43 +0000 (UTC) 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 Authored: Tue Jul 30 18:05:08 2013 -0700 Committer: Min Chen 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());