mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-3942 NPE from findStoragePool method
Changes: - Added null checks for podId Conflicts: server/src/com/cloud/storage/StorageManagerImpl.java
This commit is contained in:
parent
c2192808aa
commit
a8360e41c0
|
|
@ -403,6 +403,16 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
|||
@Override
|
||||
public StoragePool findStoragePool(DiskProfile dskCh, final DataCenterVO dc, Pod pod, Long clusterId, Long hostId, VMInstanceVO vm,
|
||||
final Set<StoragePool> avoid) {
|
||||
Long podId = null;
|
||||
if (pod != null) {
|
||||
podId = pod.getId();
|
||||
} else if (clusterId != null) {
|
||||
ClusterVO cluster = _clusterDao.findById(clusterId);
|
||||
if (cluster != null) {
|
||||
podId = cluster.getPodId();
|
||||
}
|
||||
}
|
||||
|
||||
VirtualMachineProfile profile = new VirtualMachineProfileImpl(vm);
|
||||
for (StoragePoolAllocator allocator : _storagePoolAllocators) {
|
||||
|
||||
|
|
@ -410,7 +420,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
|||
for (StoragePool pool : avoid) {
|
||||
avoidList.addPool(pool.getId());
|
||||
}
|
||||
DataCenterDeployment plan = new DataCenterDeployment(dc.getId(), pod.getId(), clusterId, hostId, null, null);
|
||||
DataCenterDeployment plan = new DataCenterDeployment(dc.getId(), podId, clusterId, hostId, null, null);
|
||||
|
||||
final List<StoragePool> poolList = allocator.allocateToPool(dskCh, profile, plan, avoidList, 1);
|
||||
if (poolList != null && !poolList.isEmpty()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue