From 46c6b9183269a411818dfdf286c20b7ac2b852bd Mon Sep 17 00:00:00 2001 From: Sanjay Tripathi Date: Fri, 27 Dec 2013 16:37:26 +0530 Subject: [PATCH] CLOUDSTACK-4402: [deleteStoragePool] There is no way to delete Primary storage if the last host with which it was associated is already removed. --- .../lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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 a8108bddd37..7da36b0cf56 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"); }