You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by re...@apache.org on 2015/10/26 19:17:55 UTC

[1/2] git commit: updated refs/heads/master to 4fe56da

Repository: cloudstack
Updated Branches:
  refs/heads/master f241455a6 -> 4fe56daf4


CLOUDSTACK-8889: delete volume doesnt decrement primary store resource count

Primary Storage count for an account does not decrease when a Data Disk
is deleted belonging to the account unless the VM to which volume
belonged is destroyed

The resource counts are updated even before the disk is actually deleted
resulting in the same value.
Moved the resource counts updation to after the expunge operation as
thats when the disk is actually deleted.

all the tests in test/integration/component/test_ps_limits.py now pass


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

Branch: refs/heads/master
Commit: 29dfeac857e454fac3f987e5a4194480091af716
Parents: f241455
Author: Rajani Karuturi <ra...@citrix.com>
Authored: Mon Sep 21 16:11:15 2015 +0530
Committer: Rajani Karuturi <ra...@citrix.com>
Committed: Mon Oct 26 17:40:27 2015 +0530

----------------------------------------------------------------------
 server/src/com/cloud/storage/VolumeApiServiceImpl.java | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/29dfeac8/server/src/com/cloud/storage/VolumeApiServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
index d4e8c99..6fe0a14 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -1222,13 +1222,6 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
                 if (instanceId == null || (vmInstance.getType().equals(VirtualMachine.Type.User))) {
                     // Decrement the resource count for volumes and primary storage belonging user VM's only
                     _resourceLimitMgr.decrementResourceCount(volume.getAccountId(), ResourceType.volume, volume.isDisplayVolume());
-                    /* If volume is in primary storage, decrement primary storage count else decrement secondary
-                     storage count (in case of upload volume). */
-                    if (volume.getFolder() != null || volume.getPath() != null || volume.getState() == Volume.State.Allocated) {
-                        _resourceLimitMgr.recalculateResourceCount(volume.getAccountId(), volume.getDomainId(), ResourceType.primary_storage.getOrdinal());
-                    } else {
-                        _resourceLimitMgr.recalculateResourceCount(volume.getAccountId(), volume.getDomainId(), ResourceType.secondary_storage.getOrdinal());
-                    }
                 }
             }
             // Mark volume as removed if volume has not been created on primary or secondary
@@ -1243,6 +1236,8 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
                 s_logger.info("Expunging volume " + volume.getId() + " from primary data store");
                 AsyncCallFuture<VolumeApiResult> future = volService.expungeVolumeAsync(volOnPrimary);
                 future.get();
+                //decrement primary storage count
+                _resourceLimitMgr.recalculateResourceCount(volume.getAccountId(), volume.getDomainId(), ResourceType.primary_storage.getOrdinal());
             }
             // expunge volume from secondary if volume is on image store
             VolumeInfo volOnSecondary = volFactory.getVolume(volume.getId(), DataStoreRole.Image);
@@ -1250,6 +1245,8 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
                 s_logger.info("Expunging volume " + volume.getId() + " from secondary data store");
                 AsyncCallFuture<VolumeApiResult> future2 = volService.expungeVolumeAsync(volOnSecondary);
                 future2.get();
+                //decrement secondary storage count
+                _resourceLimitMgr.recalculateResourceCount(volume.getAccountId(), volume.getDomainId(), ResourceType.secondary_storage.getOrdinal());
             }
             // delete all cache entries for this volume
             List<VolumeInfo> cacheVols = volFactory.listVolumeOnCache(volume.getId());


[2/2] git commit: updated refs/heads/master to 4fe56da

Posted by re...@apache.org.
Merge pull request #860 from karuturi/CLOUDSTACK-8889

CLOUDSTACK-8889: delete volume doesnt decrement primary store resource countPrimary Storage count for an account does not decrease when a Data Disk
is deleted belonging to the account unless the VM to which volume
belonged is destroyed

The resource counts are updated even before the disk is actually deleted
resulting in the same value.
Moved the resource counts updation to after the expunge operation as
thats when the disk is actually deleted.

Testing:
 Earlier, test_create_multiple_volumes in test/integration/component/test_ps_limits.py failed  with error AssertionError: Resource count 37 should match with the expected resource count 32

Before

Test create multiple volumes ... === TestName: test_create_multiple_volumes_1_root_domain_admin | Status : FAILED ===
FAIL
Test create multiple volumes ... === TestName: test_create_multiple_volumes_2_child_domain_admin | Status : FAILED ===
FAIL

After the Fix

Test create multiple volumes ... === TestName: test_create_multiple_volumes_1_root_domain_admin | Status : SUCCESS ===
ok
Test create multiple volumes ... === TestName: test_create_multiple_volumes_2_child_domain_admin | Status : SUCCESS ===
ok

----------------------------------------------------------------------
Ran 2 tests in 334.823s

OK

* pr/860:
  CLOUDSTACK-8889: delete volume doesnt decrement primary store resource count

Signed-off-by: Remi Bergsma <gi...@remi.nl>


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

Branch: refs/heads/master
Commit: 4fe56daf4b2d7daa9318db3d5db244834bf0b305
Parents: f241455 29dfeac
Author: Remi Bergsma <gi...@remi.nl>
Authored: Mon Oct 26 19:16:24 2015 +0100
Committer: Remi Bergsma <gi...@remi.nl>
Committed: Mon Oct 26 19:16:25 2015 +0100

----------------------------------------------------------------------
 server/src/com/cloud/storage/VolumeApiServiceImpl.java | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
----------------------------------------------------------------------