cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ni...@apache.org
Subject git commit: updated refs/heads/master to 835ca8e
Date Mon, 04 Aug 2014 23:40:32 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 8a2163305 -> 835ca8eea


CLOUDSTACK-7018: Restore VM - missing destroyed usage event for the destroyed root volume.
Also removed the resource count logic since we destroy the old root volume and create a new
one.


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

Branch: refs/heads/master
Commit: 835ca8eea86044cf66ad1d02e473257546664359
Parents: 8a21633
Author: Nitin Mehta <nitin.mehta@citrix.com>
Authored: Mon Aug 4 16:40:28 2014 -0700
Committer: Nitin Mehta <nitin.mehta@citrix.com>
Committed: Mon Aug 4 16:40:28 2014 -0700

----------------------------------------------------------------------
 server/src/com/cloud/vm/UserVmManagerImpl.java | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/835ca8ee/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index a9f8efd..05cc183 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -4732,9 +4732,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
         } else {
             newVol = volumeMgr.allocateDuplicateVolume(root, null);
         }
-        // 1. Save usage event and update resource count for user vm volumes
-        _resourceLimitMgr.incrementResourceCount(vm.getAccountId(), ResourceType.volume);
-        //2. Create Usage event for the newly created volume
+
+        // Create Usage event for the newly created volume
         UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_VOLUME_CREATE, newVol.getAccountId(),
newVol.getDataCenterId(), newVol.getId(), newVol.getName(), newVol.getDiskOfferingId(), templateId,
newVol.getSize());
         _usageEventDao.persist(usageEvent);
 
@@ -4742,11 +4741,11 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Vir
 
         _volsDao.attachVolume(newVol.getId(), vmId, newVol.getDeviceId());
 
-        /* Detach and destory the old root volume */
-
+        // Detach, destroy and create the usage event for the old root volume.
         _volsDao.detachVolume(root.getId());
-
         volumeMgr.destroyVolume(root);
+        UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VOLUME_DELETE, root.getAccountId(),
root.getDataCenterId(), root.getId(), root.getName(),
+                Volume.class.getName(), root.getUuid(), root.isDisplayVolume());
 
         // For VMware hypervisor since the old root volume is replaced by the new root volume,
force expunge old root volume if it has been created in storage
         if (vm.getHypervisorType() == HypervisorType.VMware) {


Mime
View raw message