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

This commit is contained in:
Sanjay Tripathi 2013-12-27 16:37:26 +05:30
parent 5eda091530
commit 46c6b91832

View File

@ -464,8 +464,6 @@ public class CloudStackPrimaryDataStoreLifeCycleImpl implements PrimaryDataStore
HypervisorType hType = null; HypervisorType hType = null;
if (hostPoolRecords.size() > 0) { if (hostPoolRecords.size() > 0) {
hType = getHypervisorType(hostPoolRecords.get(0).getHostId()); hType = getHypervisorType(hostPoolRecords.get(0).getHostId());
} else {
return false;
} }
// Remove the SR associated with the Xenserver // 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"); throw new CloudRuntimeException("Failed to delete storage pool on host");
} }