diff --git a/server/src/main/java/com/cloud/template/TemplateManagerImpl.java b/server/src/main/java/com/cloud/template/TemplateManagerImpl.java index 194d97349f01..b9f12f2d1318 100755 --- a/server/src/main/java/com/cloud/template/TemplateManagerImpl.java +++ b/server/src/main/java/com/cloud/template/TemplateManagerImpl.java @@ -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; @@ -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(); @@ -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 future = null; @@ -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)); + } }