CLOUDSTACK-3716:NPE triggered in DownloadListener

This commit is contained in:
Min Chen 2013-07-22 17:12:02 -07:00
parent 7974dfe8db
commit 181fb03e7e

View File

@ -1045,6 +1045,11 @@ public class VolumeServiceImpl implements VolumeService {
List<VolumeDataStoreVO> toBeDownloaded = new ArrayList<VolumeDataStoreVO>(dbVolumes);
for (VolumeDataStoreVO volumeStore : dbVolumes) {
VolumeVO volume = _volumeDao.findById(volumeStore.getVolumeId());
if (volume == null ){
s_logger.warn("Volume_store_ref shows that volume " + volumeStore.getVolumeId() + " is on image store " + storeId
+ ", but the volume is not found in volumes table, potentially some bugs in deleteVolume, so we just treat this volume to be deleted");
continue;
}
// Exists then don't download
if (volumeInfos.containsKey(volume.getId())) {
TemplateProp volInfo = volumeInfos.remove(volume.getId());