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 3 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #12650 +/- ##
=============================================
+ Coverage 16.26% 21.24% +4.97%
- Complexity 13428 21848 +8420
=============================================
Files 5660 6390 +730
Lines 499963 637214 +137251
Branches 60708 93358 +32650
=============================================
+ Hits 81330 135388 +54058
- Misses 409559 487649 +78090
- Partials 9074 14177 +5103
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 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.
|
@erikbocks could you have a look at Copilot's reviews? |
Co-authored-by: Suresh Kumar Anaparti <sureshkumar.anaparti@gmail.com>
DaanHoogland
left a comment
There was a problem hiding this comment.
clgtm, trivial change, smoke tests should do
@winterhazel , can you concur? |
|
@blueorangutan package |
|
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
| 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)); | ||
| } |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 19118 |
|
@blueorangutan test |
|
@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
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.