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 [{}] while trying to {}.", zoneId, operation);
throw new CloudRuntimeException(String.format("Failed to %s. Please contact the cloud administrator.", operation));
Comment on lines +2483 to +2485

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erikbocks I think we can throw a more informative CloudRuntimeException here instead, stating which zone it is (either the name or the UUID). These are automatically converted to a more generic message for non-root admin accounts.

}
}
Loading