Copilot commented on code in PR #13897:
URL: https://github.com/apache/cloudstack/pull/13897#discussion_r3835661266
##########
server/src/main/java/com/cloud/storage/StorageManagerImpl.java:
##########
@@ -1265,10 +1265,18 @@ public PrimaryDataStoreInfo
updateStoragePool(UpdateStoragePoolCmd cmd) throws I
boolean changes = false;
Long updatedCapacityBytes = null;
Long capacityBytes = cmd.getCapacityBytes();
+ // retrieve current details and merge/overlay input to capture changes
+ Map<String, String> details = null;
+ details = _storagePoolDetailsDao.listDetailsKeyPairs(id);
+ if (inputDetails != null) {
+ details.putAll(inputDetails);
+ changes = true;
+ }
Review Comment:
`_storagePoolDetailsDao.listDetailsKeyPairs(id)` can return null; the
subsequent `details.putAll(...)` / `details.put(...)` calls will then throw a
NullPointerException. Initialize `details` to an empty map when the DAO returns
null so updating capacity/IOPS/URL and input details is safe.
##########
plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/lifecycle/OntapPrimaryDatastoreLifecycle.java:
##########
@@ -118,7 +125,7 @@ public DataStore initialize(Map<String, Object> dsInfos) {
parameters.setHypervisorType(clusterVO.getHypervisorType());
}
- capacityBytes = validateInitializeInputs(capacityBytes, podId,
clusterId, zoneId, storagePoolName, providerName, managed, details);
+ validateInitializeInputs(capacityBytes, podId, clusterId, zoneId,
storagePoolName, providerName, managed, details);
Review Comment:
`validateInitializeInputs(...)` is invoked twice with the same arguments,
which is redundant and makes it harder to reason about initialization flow (and
can duplicate expensive validation work over the details map).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]