mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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.
This commit is contained in:
parent
505ab2eebe
commit
d9ce49b1f1
@ -145,6 +145,9 @@ public abstract class AbstractStoragePoolAllocator extends AdapterBase implement
|
|||||||
|
|
||||||
protected List<StoragePool> reOrder(List<StoragePool> pools,
|
protected List<StoragePool> reOrder(List<StoragePool> pools,
|
||||||
VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan) {
|
VirtualMachineProfile<? extends VirtualMachine> vmProfile, DeploymentPlan plan) {
|
||||||
|
if (pools == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
Account account = null;
|
Account account = null;
|
||||||
if (vmProfile.getVirtualMachine() != null) {
|
if (vmProfile.getVirtualMachine() != null) {
|
||||||
account = vmProfile.getOwner();
|
account = vmProfile.getOwner();
|
||||||
|
|||||||
@ -59,6 +59,9 @@ public class ClusterScopeStoragePoolAllocator extends AbstractStoragePoolAllocat
|
|||||||
Long podId = plan.getPodId();
|
Long podId = plan.getPodId();
|
||||||
Long clusterId = plan.getClusterId();
|
Long clusterId = plan.getClusterId();
|
||||||
|
|
||||||
|
if (clusterId == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if (dskCh.getTags() != null && dskCh.getTags().length != 0) {
|
if (dskCh.getTags() != null && dskCh.getTags().length != 0) {
|
||||||
s_logger.debug("Looking for pools in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId
|
s_logger.debug("Looking for pools in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId
|
||||||
+ " having tags:" + Arrays.toString(dskCh.getTags()));
|
+ " having tags:" + Arrays.toString(dskCh.getTags()));
|
||||||
|
|||||||
@ -96,6 +96,9 @@ public class LocalStoragePoolAllocator extends AbstractStoragePoolAllocator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (plan.getClusterId() == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
List<StoragePoolVO> availablePools = _storagePoolDao.findLocalStoragePoolsByTags(plan.getDataCenterId(),
|
List<StoragePoolVO> availablePools = _storagePoolDao.findLocalStoragePoolsByTags(plan.getDataCenterId(),
|
||||||
plan.getPodId(), plan.getClusterId(), dskCh.getTags());
|
plan.getPodId(), plan.getClusterId(), dskCh.getTags());
|
||||||
for (StoragePoolVO pool : availablePools) {
|
for (StoragePoolVO pool : availablePools) {
|
||||||
|
|||||||
@ -46,6 +46,11 @@ public class RandomStoragePoolAllocator extends AbstractStoragePoolAllocator {
|
|||||||
long dcId = plan.getDataCenterId();
|
long dcId = plan.getDataCenterId();
|
||||||
Long podId = plan.getPodId();
|
Long podId = plan.getPodId();
|
||||||
Long clusterId = plan.getClusterId();
|
Long clusterId = plan.getClusterId();
|
||||||
|
|
||||||
|
if (clusterId == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
s_logger.debug("Looking for pools in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId);
|
s_logger.debug("Looking for pools in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId);
|
||||||
List<StoragePoolVO> pools = _storagePoolDao.listBy(dcId, podId, clusterId, ScopeType.CLUSTER);
|
List<StoragePoolVO> pools = _storagePoolDao.listBy(dcId, podId, clusterId, ScopeType.CLUSTER);
|
||||||
if (pools.size() == 0) {
|
if (pools.size() == 0) {
|
||||||
|
|||||||
@ -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
|
// 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.
|
// can be live migrated while the virtual machine stays on the same host.
|
||||||
List<StoragePoolVO> storagePools = _poolDao.findPoolsByTags(volume.getDataCenterId(),
|
List<StoragePoolVO> storagePools = null;
|
||||||
volume.getPodId(), srcVolumePool.getClusterId(), 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);
|
storagePools.remove(srcVolumePool);
|
||||||
for (StoragePoolVO pool : storagePools) {
|
for (StoragePoolVO pool : storagePools) {
|
||||||
if (pool.isShared()) {
|
if (pool.isShared()) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user