cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [1/2] git commit: updated refs/heads/4.9 to de7a06e
Date Wed, 07 Dec 2016 18:47:56 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.9 2e5373b7f -> de7a06efe


CLOUDSTACK-9646: No usage is generated for uploaded templates/volumes from local

published usage events on successful upload of template or volume.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/aed59433
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/aed59433
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/aed59433

Branch: refs/heads/4.9
Commit: aed59433a2ef73666e162df84efe717d9e2d7bfa
Parents: f231c8c
Author: Rajani Karuturi <rajani.karuturi@accelerite.com>
Authored: Wed Sep 7 12:21:23 2016 +0530
Committer: Rajani Karuturi <rajani.karuturi@accelerite.com>
Committed: Mon Dec 5 10:51:23 2016 +0530

----------------------------------------------------------------------
 .../cloud/storage/ImageStoreUploadMonitorImpl.java   | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/aed59433/server/src/com/cloud/storage/ImageStoreUploadMonitorImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/ImageStoreUploadMonitorImpl.java b/server/src/com/cloud/storage/ImageStoreUploadMonitorImpl.java
index 2d9f544..10406b5 100755
--- a/server/src/com/cloud/storage/ImageStoreUploadMonitorImpl.java
+++ b/server/src/com/cloud/storage/ImageStoreUploadMonitorImpl.java
@@ -26,6 +26,8 @@ import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
 import com.cloud.configuration.Resource;
+import com.cloud.event.EventTypes;
+import com.cloud.event.UsageEventUtils;
 import com.cloud.user.ResourceLimitService;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
@@ -309,6 +311,12 @@ public class ImageStoreUploadMonitorImpl extends ManagerBase implements
ImageSto
                             stateMachine.transitTo(tmpVolume, Event.OperationSucceeded, null,
_volumeDao);
                             _resourceLimitMgr.incrementResourceCount(volume.getAccountId(),
Resource.ResourceType.secondary_storage, answer.getVirtualSize());
 
+                            // publish usage events
+                            UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VOLUME_UPLOAD,
tmpVolume.getAccountId(),
+                                    tmpVolumeDataStore.getDataStoreId(), tmpVolume.getId(),
tmpVolume.getName(),
+                                    null, null, tmpVolumeDataStore.getPhysicalSize(), tmpVolumeDataStore.getSize(),
+                                    Volume.class.getName(), tmpVolume.getUuid());
+
                             if (s_logger.isDebugEnabled()) {
                                 s_logger.debug("Volume " + tmpVolume.getUuid() + " uploaded
successfully");
                             }
@@ -389,6 +397,13 @@ public class ImageStoreUploadMonitorImpl extends ManagerBase implements
ImageSto
                             _templateDao.update(tmpTemplate.getId(), templateUpdate);
                             stateMachine.transitTo(tmpTemplate, VirtualMachineTemplate.Event.OperationSucceeded,
null, _templateDao);
                             _resourceLimitMgr.incrementResourceCount(template.getAccountId(),
Resource.ResourceType.secondary_storage, answer.getVirtualSize());
+                            //publish usage event
+                            String etype = EventTypes.EVENT_TEMPLATE_CREATE;
+                            if (tmpTemplate.getFormat() == Storage.ImageFormat.ISO) {
+                                etype = EventTypes.EVENT_ISO_CREATE;
+                            }
+                            UsageEventUtils.publishUsageEvent(etype, tmpTemplate.getAccountId(),
tmpTemplateDataStore.getDataStoreId(), tmpTemplate.getId(), tmpTemplate.getName(), null, null,
+                                    tmpTemplateDataStore.getPhysicalSize(), tmpTemplateDataStore.getSize(),
VirtualMachineTemplate.class.getName(), tmpTemplate.getUuid());
 
                             if (s_logger.isDebugEnabled()) {
                                 s_logger.debug("Template " + tmpTemplate.getUuid() + " uploaded
successfully");


Mime
View raw message