Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix NPE when Volume exists on secondary store but doesn't have a down…
…load URL
  • Loading branch information
Pearl Dsilva committed Dec 10, 2020
commit eec438dc9247a66edcbd97f12eaf364e1262f0ea
Original file line number Diff line number Diff line change
Expand Up @@ -2881,8 +2881,12 @@ private Optional<String> setExtractVolumeSearchCriteria(SearchCriteria<VolumeDat
} else if (volumeStoreRef != null) {
s_logger.debug("volume " + volumeId + " is already installed on secondary storage, install path is " +
volumeStoreRef.getInstallPath());
VolumeInfo destVol = volFactory.getVolume(volumeId, DataStoreRole.Image);
if (destVol == null) {
throw new CloudRuntimeException("Failed to find the volume on a secondary store");
}
ImageStoreEntity secStore = (ImageStoreEntity) dataStoreMgr.getDataStore(volumeStoreRef.getDataStoreId(), DataStoreRole.Image);
String extractUrl = secStore.createEntityExtractUrl(volumeStoreRef.getInstallPath(), volume.getFormat(), null);
String extractUrl = secStore.createEntityExtractUrl(volumeStoreRef.getInstallPath(), volume.getFormat(), destVol);
volumeStoreRef = _volumeStoreDao.findByVolume(volumeId);
volumeStoreRef.setExtractUrl(extractUrl);
volumeStoreRef.setExtractUrlCreated(DateUtil.now());
Expand Down