You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mi...@apache.org on 2012/09/18 05:15:48 UTC

[3/3] git commit: CLOUDSTACK-10 Deleting a disconnected primary storage results in partial removed state

CLOUDSTACK-10 Deleting a disconnected primary storage results in partial removed state


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

Branch: refs/heads/master
Commit: 955cbd97bc239c93f9e5c5f3953d0ced1d17e405
Parents: 11b4248
Author: Mice Xia <mi...@tcloudcomputing.com>
Authored: Tue Sep 18 11:11:13 2012 +0800
Committer: Mice Xia <mi...@tcloudcomputing.com>
Committed: Tue Sep 18 11:18:44 2012 +0800

----------------------------------------------------------------------
 .../src/com/cloud/storage/StorageManagerImpl.java  |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/955cbd97/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 83b2846..fc6fb5b 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -1503,7 +1503,10 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag
             s_logger.warn("Unable to find pool:" + id);
             throw new InvalidParameterValueException("Unable to find pool by id " + id);
         }
-
+        if(sPool.getStatus() != StoragePoolStatus.Maintenance){
+            s_logger.warn("Unable to delete storage id: " + id +" due to it is not in Maintenance state");
+            throw new InvalidParameterValueException("Unable to delete storage due to it is not in Maintenance state, id: " + id);           
+        }
         if (sPool.getPoolType().equals(StoragePoolType.LVM) || sPool.getPoolType().equals(StoragePoolType.EXT)) {
             s_logger.warn("Unable to delete local storage id:" + id);
             throw new InvalidParameterValueException("Unable to delete local storage id: " + id);
@@ -1545,8 +1548,6 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag
 
         // mark storage pool as removed (so it can't be used for new volumes creation), release the lock
         boolean isLockReleased = false;
-        sPool.setStatus(StoragePoolStatus.Removed);
-        _storagePoolDao.update(id, sPool);
         isLockReleased = _storagePoolDao.releaseFromLockTable(lock.getId());
         s_logger.trace("Released lock for storage pool " + id);