Updated Branches: refs/heads/master 16b7509a2 -> 301c91c09
CLOUDSTACK-3189: Primary storage usage is not getting decremented after deleting the DATA volumes. When a volume is created the resource usage for it gets incremented. If it is deleted without being attached to a volume, the decrement doesn't take place. Fixed the delete volume code to decrement resource usage for a volume in allocated state too. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/301c91c0 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/301c91c0 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/301c91c0 Branch: refs/heads/master Commit: 301c91c099957b77dd1127484446f9fe69b53e39 Parents: 16b7509 Author: Sanjay Tripathi <[email protected]> Authored: Fri Jun 28 14:32:27 2013 +0530 Committer: Devdeep Singh <[email protected]> Committed: Mon Jul 1 23:41:10 2013 +0530 ---------------------------------------------------------------------- server/src/com/cloud/storage/VolumeManagerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/301c91c0/server/src/com/cloud/storage/VolumeManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/storage/VolumeManagerImpl.java b/server/src/com/cloud/storage/VolumeManagerImpl.java index 30fb322..d90e798 100644 --- a/server/src/com/cloud/storage/VolumeManagerImpl.java +++ b/server/src/com/cloud/storage/VolumeManagerImpl.java @@ -1347,7 +1347,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager { ResourceType.volume); /* If volume is in primary storage, decrement primary storage count else decrement secondary storage count (in case of upload volume). */ - if (volume.getFolder() != null) { + if (volume.getFolder() != null || volume.getState() == Volume.State.Allocated) { _resourceLimitMgr.decrementResourceCount(volume.getAccountId(), ResourceType.primary_storage, new Long(volume.getSize())); } else {
