incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kis...@apache.org
Subject git commit: bug CS-15648: For volumes created from snapshot, create usage event after successful volume status CS-15648: resolved fixed reviewed-by: Nitin
Date Tue, 14 Aug 2012 06:34:11 GMT
Updated Branches:
  refs/heads/master 29459549b -> 65c90227a


bug CS-15648: For volumes created from snapshot, create usage event after successful volume
status CS-15648: resolved fixed
reviewed-by: Nitin


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

Branch: refs/heads/master
Commit: 65c90227ae652f946f095167061035fb443ecb73
Parents: 2945954
Author: kishan <kishan@cloud.com>
Authored: Wed Aug 8 16:20:51 2012 +0530
Committer: kishan <kishan@cloud.com>
Committed: Tue Aug 14 11:58:07 2012 +0530

----------------------------------------------------------------------
 .../src/com/cloud/storage/StorageManagerImpl.java  |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/65c90227/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java
index 5a256dc..20dde8b 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -649,6 +649,9 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag
         Pair<VolumeVO, String> volumeDetails = createVolumeFromSnapshot(volume, snapshot);
         if (volumeDetails != null) {
             createdVolume = volumeDetails.first();
+        	UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_VOLUME_CREATE, createdVolume.getAccountId(),
createdVolume.getDataCenterId(), createdVolume.getId(), createdVolume.getName(), 
+        			                                   createdVolume.getDiskOfferingId(), null, createdVolume.getSize());
+        	_usageEventDao.persist(usageEvent);
         }
         return createdVolume;
     }
@@ -2019,8 +2022,11 @@ public class StorageManagerImpl implements StorageManager, Manager,
ClusterManag
         volume.setDomainId((caller == null) ? Domain.ROOT_DOMAIN : caller.getDomainId());
 
         volume = _volsDao.persist(volume);
-        UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_VOLUME_CREATE, volume.getAccountId(),
volume.getDataCenterId(), volume.getId(), volume.getName(), diskOfferingId, null, size);
-        _usageEventDao.persist(usageEvent);
+        if(cmd.getSnapshotId() == null){
+        	//for volume created from snapshot, create usage event after volume creation
+        	UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_VOLUME_CREATE, volume.getAccountId(),
volume.getDataCenterId(), volume.getId(), volume.getName(), diskOfferingId, null, size);
+        	_usageEventDao.persist(usageEvent);
+        }
 
         UserContext.current().setEventDetails("Volume Id: " + volume.getId());
 


Mime
View raw message