Skip to content

Commit 637077e

Browse files
Fix NPE on list hosts, when any stale entries exists on storage_pool_host_ref for the removed pools
1 parent 175eed2 commit 637077e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/src/main/java/com/cloud/storage/StorageManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ public boolean isLocalStorageActiveOnHost(Long hostId) {
504504
List<StoragePoolHostVO> storagePoolHostRefs = _storagePoolHostDao.listByHostId(hostId);
505505
for (StoragePoolHostVO storagePoolHostRef : storagePoolHostRefs) {
506506
StoragePoolVO PrimaryDataStoreVO = _storagePoolDao.findById(storagePoolHostRef.getPoolId());
507-
if (PrimaryDataStoreVO.getPoolType() == StoragePoolType.LVM || PrimaryDataStoreVO.getPoolType() == StoragePoolType.EXT) {
507+
if (PrimaryDataStoreVO != null && (PrimaryDataStoreVO.getPoolType() == StoragePoolType.LVM || PrimaryDataStoreVO.getPoolType() == StoragePoolType.EXT)) {
508508
SearchBuilder<VolumeVO> volumeSB = volumeDao.createSearchBuilder();
509509
volumeSB.and("poolId", volumeSB.entity().getPoolId(), SearchCriteria.Op.EQ);
510510
volumeSB.and("removed", volumeSB.entity().getRemoved(), SearchCriteria.Op.NULL);

0 commit comments

Comments
 (0)