Repository navigation
Fix two lines changed by mistake in the 4.22 merge - #14767
bhouse-nexthop wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #14767 +/- ##
============================================
+ Coverage 20.80% 20.92% +0.12%
- Complexity 20919 21150 +231
============================================
Files 6053 6057 +4
Lines 548451 549556 +1105
Branches 78719 73477 -5242
============================================
+ Hits 114128 115018 +890
- Misses 420958 421086 +128
- Partials 13365 13452 +87
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:
|
| @@ -840,7 +840,7 @@ public static DataStoreRole getDataStoreRole(Snapshot snapshot, SnapshotDataStor | |||
|
|
|||
| if (mapCapabilities != null) { | |||
There was a problem hiding this comment.
mapCapabilities can be empty, in this case get() and parseBoolean() calls do not add much value. While the performance impact is negligible, using a utility method such as isNotEmpty() would avoid executing the block when the map is either null or empty.
There was a problem hiding this comment.
I'd rather leave this line as it is. The if (mapCapabilities != null) block is unchanged from before the merge; this PR only restores parseBoolean. The result is already the same either way: with an empty map, get() returns null and parseBoolean(null) is false, so it falls through to Image. I added a test for the null and empty map cases (see the test thread).
|
|
||
| String ssvmUrlDomain = _configDao.getValue(Config.SecStorageSecureCopyCert.key()); | ||
| String protocol = UseHttpsToUpload.value() ? "https" : "http"; | ||
| String protocol = UseHttpsToUpload.valueIn(zoneId) ? "https" : "http"; |
There was a problem hiding this comment.
Please consider using the constants for "https" and "http" instead of hardcoded string literals.
There was a problem hiding this comment.
I kept the literals on purpose. This PR only puts back valueIn(zoneId) on a line that already had them, and the same line in TemplateManagerImpl.registerPostUploadInternal uses the same literals (UseHttpsToUpload.valueIn(...) ? "https" : "http"). HttpConstants in utils has HTTPS but no HTTP, so using constants here means adding one and changing both upload paths. I'd keep that out of this fix.
|
Tested on a KVM lab running a main build that includes this change. One zone with a secondary storage VM. Steps: I called Result: all checks passed.
The scheme follows the zone value both times. Before this change it followed the global value, so the two calls would have given Not tested: the |
The merge 82bfa9f left these on main; neither parent had them. - ApiResponseHelper.getDataStoreRole: Boolean.getBoolean(value) reads a JVM system property, so it was always false and snapshots on storage with storage-system snapshot support got the Image role. Use Boolean.parseBoolean(value), same as main had (new Boolean). - VolumeApiServiceImpl.uploadVolume: restore UseHttpsToUpload.valueIn(zoneId) from apache#11539; the zone value was ignored for volume uploads. - VolumeApiServiceImpl: fix {code}...{code} Javadoc to {@code ...}. - Add getDataStoreRole tests in ApiResponseHelperTest. Signed-off-by: Brad House <bhouse@nexthop.ai>
2d9e488 to
888bd33
Compare
Description
Fixes two lines on
mainthat the 4.22 merge 82bfa9f changed by mistake.ApiResponseHelperBoolean.getBoolean(value)->Boolean.parseBoolean(value)getBooleanreads a system property, so snapshots on storage with storage-system snapshot support were reported with theImageroleVolumeApiServiceImplUseHttpsToUpload.value()->UseHttpsToUpload.valueIn(zoneId)VolumeApiServiceImpl{code}...{code}->{@code ...}in a JavadocRelated: #14760 (duplicated block from the same merge).
Fixes: #14766
Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
How Has This Been Tested?
ApiResponseHelperTestcases forgetDataStoreRole: capabilitytrue,TRUE,True->Primary;false,yes, empty, and a null or empty capabilities map ->Image. Thetruecases fail before the fix.ApiResponseHelperTestandVolumeApiServiceImplTestpass.uploadVolumeline: the method needs the DB transaction, call context and a private validation step. It is the same callTemplateManagerImplalready makes.