diff --git a/server/src/main/java/com/cloud/template/TemplateManagerImpl.java b/server/src/main/java/com/cloud/template/TemplateManagerImpl.java index 194d97349f01..438f6784abd6 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; @@ -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)); + } }