Updated Branches:
refs/heads/4.2 13ec10caa -> 8439209ba
CLOUDSTACK-3264: [ZWPS]NPE while finding storage pools for migration
Description:
Filter primary storage pools based on zonewide/clusterwide configuration
when considering pools to list for storage migration of volumes.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/cb96d709
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/cb96d709
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/cb96d709
Branch: refs/heads/4.2
Commit: cb96d70967832d50af0350ca896b011519b66755
Parents: 13ec10c
Author: Vijayendra Bhamidipati <[email protected]>
Authored: Mon Jul 8 13:15:23 2013 -0700
Committer: Edison Su <[email protected]>
Committed: Fri Jul 12 15:21:40 2013 -0700
----------------------------------------------------------------------
.../storage/allocator/AbstractStoragePoolAllocator.java | 3 +++
.../allocator/ClusterScopeStoragePoolAllocator.java | 3 +++
.../storage/allocator/LocalStoragePoolAllocator.java | 3 +++
.../storage/allocator/RandomStoragePoolAllocator.java | 5 +++++
server/src/com/cloud/server/ManagementServerImpl.java | 10 ++++++++--
5 files changed, 22 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb96d709/engine/storage/src/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java
----------------------------------------------------------------------
diff --git
a/engine/storage/src/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java
b/engine/storage/src/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java
index e16703e..89e0974 100755
---
a/engine/storage/src/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java
+++
b/engine/storage/src/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java
@@ -145,6 +145,9 @@ public abstract class AbstractStoragePoolAllocator extends
AdapterBase implement
protected List<StoragePool> reOrder(List<StoragePool> pools,
VirtualMachineProfile<? extends VirtualMachine> vmProfile,
DeploymentPlan plan) {
+ if (pools == null) {
+ return null;
+ }
Account account = null;
if (vmProfile.getVirtualMachine() != null) {
account = vmProfile.getOwner();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb96d709/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java
----------------------------------------------------------------------
diff --git
a/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java
b/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java
index 0933adc..41afa83 100644
---
a/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java
+++
b/engine/storage/src/org/apache/cloudstack/storage/allocator/ClusterScopeStoragePoolAllocator.java
@@ -59,6 +59,9 @@ public class ClusterScopeStoragePoolAllocator extends
AbstractStoragePoolAllocat
Long podId = plan.getPodId();
Long clusterId = plan.getClusterId();
+ if (clusterId == null) {
+ return null;
+ }
if (dskCh.getTags() != null && dskCh.getTags().length != 0) {
s_logger.debug("Looking for pools in dc: " + dcId + " pod:" +
podId + " cluster:" + clusterId
+ " having tags:" + Arrays.toString(dskCh.getTags()));
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb96d709/engine/storage/src/org/apache/cloudstack/storage/allocator/LocalStoragePoolAllocator.java
----------------------------------------------------------------------
diff --git
a/engine/storage/src/org/apache/cloudstack/storage/allocator/LocalStoragePoolAllocator.java
b/engine/storage/src/org/apache/cloudstack/storage/allocator/LocalStoragePoolAllocator.java
index ef9e84e..4056fe7 100644
---
a/engine/storage/src/org/apache/cloudstack/storage/allocator/LocalStoragePoolAllocator.java
+++
b/engine/storage/src/org/apache/cloudstack/storage/allocator/LocalStoragePoolAllocator.java
@@ -96,6 +96,9 @@ public class LocalStoragePoolAllocator extends
AbstractStoragePoolAllocator {
}
}
} else {
+ if (plan.getClusterId() == null) {
+ return null;
+ }
List<StoragePoolVO> availablePools =
_storagePoolDao.findLocalStoragePoolsByTags(plan.getDataCenterId(),
plan.getPodId(), plan.getClusterId(), dskCh.getTags());
for (StoragePoolVO pool : availablePools) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb96d709/plugins/storage-allocators/random/src/org/apache/cloudstack/storage/allocator/RandomStoragePoolAllocator.java
----------------------------------------------------------------------
diff --git
a/plugins/storage-allocators/random/src/org/apache/cloudstack/storage/allocator/RandomStoragePoolAllocator.java
b/plugins/storage-allocators/random/src/org/apache/cloudstack/storage/allocator/RandomStoragePoolAllocator.java
index 76ce663..fda787f 100644
---
a/plugins/storage-allocators/random/src/org/apache/cloudstack/storage/allocator/RandomStoragePoolAllocator.java
+++
b/plugins/storage-allocators/random/src/org/apache/cloudstack/storage/allocator/RandomStoragePoolAllocator.java
@@ -46,6 +46,11 @@ public class RandomStoragePoolAllocator extends
AbstractStoragePoolAllocator {
long dcId = plan.getDataCenterId();
Long podId = plan.getPodId();
Long clusterId = plan.getClusterId();
+
+ if (clusterId == null) {
+ return null;
+ }
+
s_logger.debug("Looking for pools in dc: " + dcId + " pod:" + podId +
" cluster:" + clusterId);
List<StoragePoolVO> pools = _storagePoolDao.listBy(dcId, podId,
clusterId, ScopeType.CLUSTER);
if (pools.size() == 0) {
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cb96d709/server/src/com/cloud/server/ManagementServerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/server/ManagementServerImpl.java
b/server/src/com/cloud/server/ManagementServerImpl.java
index 36b3879..58e4b44 100755
--- a/server/src/com/cloud/server/ManagementServerImpl.java
+++ b/server/src/com/cloud/server/ManagementServerImpl.java
@@ -1258,8 +1258,14 @@ public class ManagementServerImpl extends ManagerBase
implements ManagementServe
// Get all the pools available. Only shared pools are considered
because only a volume on a shared pools
// can be live migrated while the virtual machine stays on the
same host.
- List<StoragePoolVO> storagePools =
_poolDao.findPoolsByTags(volume.getDataCenterId(),
- volume.getPodId(), srcVolumePool.getClusterId(), null);
+ List<StoragePoolVO> storagePools = null;
+
+ if (srcVolumePool.getClusterId() == null) {
+ storagePools =
_poolDao.findZoneWideStoragePoolsByTags(volume.getDataCenterId(), null);
+ } else {
+ storagePools =
_poolDao.findPoolsByTags(volume.getDataCenterId(), volume.getPodId(),
srcVolumePool.getClusterId(), null);
+ }
+
storagePools.remove(srcVolumePool);
for (StoragePoolVO pool : storagePools) {
if (pool.isShared()) {