-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Fix infrastructure leak in template from volume creation error message #12650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -476,7 +476,8 @@ 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)); | ||
| logger.error("Cannot find an image store for zone [{}].", zoneId); | ||
| throw new CloudRuntimeException("Failed to create template. Please contact the cloud administrator."); | ||
|
Comment on lines
+479
to
+480
|
||
| } | ||
|
|
||
| return imageStore; | ||
|
|
@@ -1702,7 +1703,8 @@ 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); | ||
| logger.error("Cannot find an image store for zone [{}].", zoneId); | ||
| throw new CloudRuntimeException("Failed to create template. Please contact the cloud administrator."); | ||
|
Comment on lines
1705
to
+1707
|
||
| } | ||
| AsyncCallFuture<TemplateApiResult> future = null; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getImageStoreis used for both template creation and volume upload (e.g.,VolumeApiServiceImpl.uploadVolumecalls_tmpltMgr.getImageStore(...)). Throwing "Failed to create template..." here will surface an incorrect error message to volume-upload callers. Consider using an operation-neutral message (e.g., "Failed to find an image store. Please contact the cloud administrator."), or passing a caller-specific context string intogetImageStoreso each API reports the right high-level failure without exposing the zone ID.