From a95afe5552bda4bbc7a626d280f31f2d7b982012 Mon Sep 17 00:00:00 2001 From: Vibe Nuage Agent Date: Tue, 1 Dec 2026 20:56:47 +0000 Subject: [PATCH] Fix 4.22->main merge artifacts in getDataStoreRole and volume upload protocol (#14766) ### Description The 4.22 -> main merge left two broken lines: 1. `ApiResponseHelper.getDataStoreRole` used `Boolean.getBoolean(value)`, which reads a JVM system property named by `value` and is therefore always false; snapshots on primary storage with `STORAGE_SYSTEM_SNAPSHOT` support were misreported with the `Image` role. Now uses `Boolean.parseBoolean(value)`. 2. `VolumeApiServiceImpl.uploadVolume` used `UseHttpsToUpload.value()` (global) instead of `UseHttpsToUpload.valueIn(zoneId)`, ignoring the zone-level `use.https.to.upload` for volume upload URLs. Restored to `valueIn(zoneId)`, matching the template path. ### Types of changes - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] New feature (non-breaking change which adds functionality) - [x] Bug fix (non-breaking change which fixes an issue) - [ ] Enhancement (improves an existing feature and functionality) - [ ] Cleanup (Code refactoring and cleanup, that may add test cases) - [ ] Build/CI - [ ] Test (unit or integration test code) ### Bug Severity - [ ] BLOCKER - [ ] Critical - [x] Major - [ ] Minor - [ ] Trivial ### How Has This Been Tested? Two-line fix verified by inspection; `UseHttpsToUpload` is Zone-scoped and `valueIn(Long)` is the same call the template upload path uses. Compilation/tests run in PR CI (no JDK in the working environment). Closes #14766 Co-authored-by: ravening --- server/src/main/java/com/cloud/api/ApiResponseHelper.java | 2 +- .../src/main/java/com/cloud/storage/VolumeApiServiceImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/main/java/com/cloud/api/ApiResponseHelper.java b/server/src/main/java/com/cloud/api/ApiResponseHelper.java index cd983db1ff27..1119ad3791ec 100644 --- a/server/src/main/java/com/cloud/api/ApiResponseHelper.java +++ b/server/src/main/java/com/cloud/api/ApiResponseHelper.java @@ -844,7 +844,7 @@ public static DataStoreRole getDataStoreRole(Snapshot snapshot, SnapshotDataStor if (mapCapabilities != null) { String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString()); - boolean supportsStorageSystemSnapshots = Boolean.getBoolean(value); + boolean supportsStorageSystemSnapshots = Boolean.parseBoolean(value); if (supportsStorageSystemSnapshots) { return DataStoreRole.Primary; diff --git a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java index 11b24a9beef6..16f666699e66 100644 --- a/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java +++ b/server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java @@ -531,7 +531,7 @@ public GetUploadParamsResponse doInTransaction(TransactionStatus status) throws GetUploadParamsResponse response = new GetUploadParamsResponse(); String ssvmUrlDomain = _configDao.getValue(Config.SecStorageSecureCopyCert.key()); - String protocol = UseHttpsToUpload.value() ? "https" : "http"; + String protocol = UseHttpsToUpload.valueIn(zoneId) ? "https" : "http"; String url = ImageStoreUtil.generatePostUploadUrl(ssvmUrlDomain, ep.getPublicAddr(), vol.getUuid(), protocol); response.setPostURL(new URL(url));