mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fix NPE when Volume exists on secondary store but doesn't have a download URL (#4530)
Co-authored-by: Pearl Dsilva <pearl.dsilva@shapeblue.com>
This commit is contained in:
parent
e5b7733498
commit
edd5f23e8b
@ -2881,8 +2881,12 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
|
||||
} 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());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user