Updated Branches: refs/heads/master d1c01a79a -> 7bdf541bd
CLOUDSTACK-4157 Failure to add zone wide primary storage pool is leaving storage pool in database Signed-off-by: Sateesh Chodapuneedi <sate...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7bdf541b Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7bdf541b Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7bdf541b Branch: refs/heads/master Commit: 7bdf541bd7103c9f5b0bec0bec1b241515b82589 Parents: d1c01a7 Author: Sateesh Chodapuneedi <sate...@apache.org> Authored: Wed Aug 7 17:40:57 2013 +0530 Committer: Sateesh Chodapuneedi <sate...@apache.org> Committed: Wed Aug 7 17:42:13 2013 +0530 ---------------------------------------------------------------------- .../lifecycle/CloudStackPrimaryDataStoreLifeCycleImpl.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7bdf541b/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 2c8c871..3cc709a 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 @@ -60,7 +60,6 @@ import com.cloud.storage.StoragePool; import com.cloud.storage.StoragePoolAutomation; import com.cloud.storage.StoragePoolDiscoverer; import com.cloud.storage.StoragePoolHostVO; -import com.cloud.storage.StoragePoolStatus; import com.cloud.storage.dao.StoragePoolHostDao; import com.cloud.storage.dao.StoragePoolWorkDao; import com.cloud.storage.dao.VolumeDao; @@ -408,13 +407,21 @@ public class CloudStackPrimaryDataStoreLifeCycleImpl implements PrimaryDataStore @Override public boolean attachZone(DataStore dataStore, ZoneScope scope, HypervisorType hypervisorType) { List<HostVO> hosts = _resourceMgr.listAllUpAndEnabledHostsInOneZoneByHypervisor(hypervisorType, scope.getScopeId()); + s_logger.debug("In createPool. Attaching the pool to each of the hosts."); + List<HostVO> poolHosts = new ArrayList<HostVO>(); for (HostVO host : hosts) { try { this.storageMgr.connectHostToSharedPool(host.getId(), dataStore.getId()); + poolHosts.add(host); } catch (Exception e) { s_logger.warn("Unable to establish a connection between " + host + " and " + dataStore, e); } } + if (poolHosts.isEmpty()) { + s_logger.warn("No host can access storage pool " + dataStore + " in this zone."); + primaryDataStoreDao.expunge(dataStore.getId()); + throw new CloudRuntimeException("Failed to create storage pool as it is not accessible to hosts."); + } this.dataStoreHelper.attachZone(dataStore, hypervisorType); return true; }