From c2902db0b11c9bc8cf11e38aee8b4f683fe39cea Mon Sep 17 00:00:00 2001 From: Prachi Damle Date: Fri, 17 Jan 2014 11:56:04 -0800 Subject: [PATCH] CLOUDSTACK-5895: CreateVolumeFromSnapshot can fail in a multiple pod environment with tagged storagepool Changes: After finding the storagepool suitable to create the volume, we should not look for more pods --- .../engine/orchestration/VolumeOrchestrator.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java index edc598531dc..1b8bd72b431 100644 --- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java +++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java @@ -339,6 +339,12 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati while ((pool = findStoragePool(dskCh, dc, pod.first(), null, null, null, poolsToAvoid)) != null) { break; } + if (pool != null) { + if (s_logger.isDebugEnabled()) { + s_logger.debug("Found a suitable pool for create volume: " + pool.getId()); + } + break; + } } } @@ -802,7 +808,7 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati } catch (NoTransitionException e) { s_logger.debug("Unable to destroy existing volume: " + e.toString()); } - + return newVolume; } }); @@ -1262,7 +1268,7 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati } return true; } - + public static final ConfigKey MaxVolumeSize = new ConfigKey(Long.class, "storage.max.volume.size", "Storage", @@ -1341,7 +1347,7 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati VolumeVO vol = _volsDao.findById(volumeId); return dataStoreMgr.getPrimaryDataStore(vol.getPoolId()).getUuid(); } - + @Override public void updateVolumeDiskChain(long volumeId, String path, String chainInfo) { VolumeVO vol = _volsDao.findById(volumeId); @@ -1351,10 +1357,10 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati return; if(!vol.getPath().equalsIgnoreCase(path)) needUpdate = true; - + if(chainInfo != null && (vol.getChainInfo() == null || !chainInfo.equalsIgnoreCase(vol.getChainInfo()))) needUpdate = true; - + if(needUpdate) { s_logger.info("Update volume disk chain info. vol: " + vol.getId() + ", " + vol.getPath() + " -> " + path + ", " + vol.getChainInfo() + " -> " + chainInfo);