Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ public DataStore getImageStore(String storeUuid, Long zoneId, VolumeVO volume) {
}

if (imageStore == null) {
throw new CloudRuntimeException(String.format("Cannot find an image store for zone [%s].", zoneId));
throwExceptionForImageStoreObtentionFailure(zoneId, "upload volume");
}

return imageStore;
Expand Down Expand Up @@ -1702,7 +1702,7 @@ public VirtualMachineTemplate createPrivateTemplate(CreateTemplateCmd command) t
}
DataStore store = _dataStoreMgr.getImageStoreWithFreeCapacity(zoneId);
if (store == null) {
throw new CloudRuntimeException("cannot find an image store for zone " + zoneId);
throwExceptionForImageStoreObtentionFailure(zoneId, "create template");
}
AsyncCallFuture<TemplateApiResult> future = null;

Expand Down Expand Up @@ -2479,4 +2479,9 @@ public VirtualMachineTemplate linkUserDataToTemplate(LinkUserDataToTemplateCmd c

return _tmpltDao.findById(template.getId());
}

private void throwExceptionForImageStoreObtentionFailure(Long zoneId, String operation) {
logger.error("Cannot find an image store for zone [{}].", zoneId);
throw new CloudRuntimeException(String.format("Failed to %s. Please contact the cloud administrator.", operation));
}
}
Loading