Skip to content

Commit 473790c

Browse files
CSTACKEX-306: setting the exception msg more align to the situation
1 parent 901fc43 commit 473790c

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

‎engine/storage/volume/src/main/java/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,16 +1007,19 @@ private TemplateInfo createManagedTemplateVolume(TemplateInfo srcTemplateInfo, P
10071007
} else {
10081008
errMesg = callback.result.getResult();
10091009
}
1010-
templateOnPrimary.processEvent(Event.OperationFailed);
10111010
throw new CloudRuntimeException(String.format("Unable to create template %s on primary storage %s: %s", templateOnPrimary.getImage(), destPrimaryDataStore, errMesg));
10121011
}
10131012

10141013
templateOnPrimary.processEvent(Event.OperationSucceeded);
10151014

10161015
} catch (Throwable e) {
10171016
logger.debug("Failed to create template volume on storage", e);
1018-
templateOnPrimary.processEvent(Event.OperationFailed);
1019-
throw new CloudRuntimeException(e.getMessage());
1017+
try {
1018+
templateOnPrimary.processEvent(Event.OperationFailed);
1019+
} catch (Exception stateEx) {
1020+
logger.warn("Unable to mark template {} as failed on primary storage {}: {}", templateOnPrimary.getImage(), destPrimaryDataStore, stateEx.getMessage());
1021+
}
1022+
throw new CloudRuntimeException(e.getMessage(), e);
10201023
} finally {
10211024
_tmpltPoolDao.releaseFromLockTable(templatePoolRefId);
10221025
}

‎plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/UnifiedSANStrategy.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ public CloudStackVolume createTemplateCache(StoragePoolVO storagePool, TemplateI
111111
Map<String, String> details, long sizeInBytes) {
112112
if (sizeInBytes <= 0) {
113113
throw new CloudRuntimeException("Unknown virtual size for template [" + templateInfo.getId()
114-
+ "]; cannot size the template LUN on pool [" + storagePool.getId() + "]");
114+
+ "]; cannot size the template LUN on pool [" + storagePool.getId() + "]. The template size in vm_template"
115+
+ " is unset; verify the template was registered/seeded with its virtual size (virtualsize in"
116+
+ " template.properties on secondary storage).");
115117
}
116118

117119
CloudStackVolume request = buildTemplateLunRequest(storagePool, details, templateInfo.getId(), sizeInBytes);

0 commit comments

Comments
 (0)