mirror of https://github.com/apache/cloudstack.git
server: fix NPE for the case where volume is not attached to a VM (#3566)
Fixes NPE when trying to find suitable storage pools for a volume when the volume is not attached to a VM. Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
77f9ab2727
commit
b7470bc51c
|
|
@ -37,8 +37,6 @@ import javax.crypto.spec.SecretKeySpec;
|
|||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.storage.ScopeType;
|
||||
import com.cloud.hypervisor.kvm.dpdk.DpdkHelper;
|
||||
import org.apache.cloudstack.acl.ControlledEntity;
|
||||
import org.apache.cloudstack.affinity.AffinityGroupProcessor;
|
||||
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
|
||||
|
|
@ -613,6 +611,7 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
|||
import com.cloud.hypervisor.HypervisorCapabilities;
|
||||
import com.cloud.hypervisor.HypervisorCapabilitiesVO;
|
||||
import com.cloud.hypervisor.dao.HypervisorCapabilitiesDao;
|
||||
import com.cloud.hypervisor.kvm.dpdk.DpdkHelper;
|
||||
import com.cloud.info.ConsoleProxyInfo;
|
||||
import com.cloud.network.IpAddress;
|
||||
import com.cloud.network.dao.IPAddressDao;
|
||||
|
|
@ -639,6 +638,7 @@ import com.cloud.storage.GuestOSHypervisor;
|
|||
import com.cloud.storage.GuestOSHypervisorVO;
|
||||
import com.cloud.storage.GuestOSVO;
|
||||
import com.cloud.storage.GuestOsCategory;
|
||||
import com.cloud.storage.ScopeType;
|
||||
import com.cloud.storage.StorageManager;
|
||||
import com.cloud.storage.StoragePool;
|
||||
import com.cloud.storage.Volume;
|
||||
|
|
@ -1442,7 +1442,11 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||
StoragePool srcVolumePool = _poolDao.findById(volume.getPoolId());
|
||||
allPools = getAllStoragePoolCompatileWithVolumeSourceStoragePool(srcVolumePool);
|
||||
allPools.remove(srcVolumePool);
|
||||
suitablePools = findAllSuitableStoragePoolsForVm(volume, vm, srcVolumePool);
|
||||
if (vm != null) {
|
||||
suitablePools = findAllSuitableStoragePoolsForVm(volume, vm, srcVolumePool);
|
||||
} else {
|
||||
suitablePools = allPools;
|
||||
}
|
||||
|
||||
return new Pair<List<? extends StoragePool>, List<? extends StoragePool>>(allPools, suitablePools);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue