CLOUDSTACK-4402: [deleteStoragePool] There is no way to delete Primary storage 
if the last host with which it was associated is already removed.


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

Branch: refs/heads/master
Commit: 46c6b9183269a411818dfdf286c20b7ac2b852bd
Parents: 5eda091
Author: Sanjay Tripathi <[email protected]>
Authored: Fri Dec 27 16:37:26 2013 +0530
Committer: Sanjay Tripathi <[email protected]>
Committed: Fri Dec 27 17:12:38 2013 +0530

----------------------------------------------------------------------
 .../lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java       | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/46c6b918/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java
----------------------------------------------------------------------
diff --git 
a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java
 
b/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java
index a8108bd..7da36b0 100644
--- 
a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java
+++ 
b/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java
@@ -464,8 +464,6 @@ public class CloudStackPrimaryDataStoreLifeCycleImpl 
implements PrimaryDataStore
         HypervisorType hType = null;
         if (hostPoolRecords.size() > 0) {
             hType = getHypervisorType(hostPoolRecords.get(0).getHostId());
-        } else {
-            return false;
         }
 
         // Remove the SR associated with the Xenserver
@@ -486,7 +484,7 @@ public class CloudStackPrimaryDataStoreLifeCycleImpl 
implements PrimaryDataStore
             }
         }
 
-        if (!deleteFlag) {
+        if (!hostPoolRecords.isEmpty() && !deleteFlag) {
             throw new CloudRuntimeException("Failed to delete storage pool on 
host");
         }
 

Reply via email to