Skip to content
Open
Changes from 2 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
11 changes: 8 additions & 3 deletions server/src/main/java/com/cloud/template/TemplateManagerImpl.java
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 @@ -1396,7 +1396,7 @@ public boolean deleteTemplate(DeleteTemplateCmd cmd) {

@Override
@ActionEvent(eventType = EventTypes.EVENT_ISO_DELETE, eventDescription = "Deleting ISO", async = true)
public boolean deleteIso(DeleteIsoCmd cmd) {
public boolean deleteIso (DeleteIsoCmd cmd) {
Long templateId = cmd.getId();
Account caller = CallContext.current().getCallingAccount();
Long zoneId = cmd.getZoneId();
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