Fix infrastructure leak in template from volume creation error message#12650
Fix infrastructure leak in template from volume creation error message#12650erikbocks wants to merge 2 commits intoapache:mainfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #12650 +/- ##
============================================
+ Coverage 16.26% 18.02% +1.76%
- Complexity 13428 16452 +3024
============================================
Files 5660 5968 +308
Lines 499963 537090 +37127
Branches 60708 65961 +5253
============================================
+ Hits 81330 96823 +15493
- Misses 409559 429347 +19788
- Partials 9074 10920 +1846
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR updates error handling around selecting an image (secondary) datastore so that API-facing exceptions no longer expose internal zone IDs, moving the detailed context into server logs instead.
Changes:
- Replace zone-ID-containing exception messages with a sanitized, user-facing
CloudRuntimeExceptionmessage. - Add error logging that retains the detailed context (zone ID) for operators.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
server/src/main/java/com/cloud/template/TemplateManagerImpl.java
Outdated
Show resolved
Hide resolved
server/src/main/java/com/cloud/template/TemplateManagerImpl.java
Outdated
Show resolved
Hide resolved
server/src/main/java/com/cloud/template/TemplateManagerImpl.java
Outdated
Show resolved
Hide resolved
|
@erikbocks could you have a look at Copilot's reviews? |
| @@ -1416,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) { | |||
There was a problem hiding this comment.
| public boolean deleteIso (DeleteIsoCmd cmd) { | |
| public boolean deleteIso(DeleteIsoCmd cmd) { |
Description
Currently, if an error occurs when trying to obtain a secondary storage for the creation of a template from a volume, or when uploading a volume, the message from the thrown exception exposes the zone's internal ID. Thus, the exception message was changed, and the descriptive message was moved to the logs.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Screenshots (if appropriate):
How Has This Been Tested?
In an environment with only one secondary storage, I set it as
read-only. Then, I tried to create a template from a volume. An exception was thrown, informing that an error had occurred, but no infrastructure leak was present. I accessed the logs, and validated that the log with more information was shown, as well as the new exception message.