rg9975 commented on code in PR #7889:
URL: https://github.com/apache/cloudstack/pull/7889#discussion_r1352886319
##########
server/src/main/java/com/cloud/storage/StorageManagerImpl.java:
##########
@@ -916,36 +916,56 @@ public PrimaryDataStoreInfo
updateStoragePool(UpdateStoragePoolCmd cmd) throws I
_storagePoolTagsDao.persist(pool.getId(), storagePoolTags);
}
+ boolean changes = false;
Long updatedCapacityBytes = null;
Long capacityBytes = cmd.getCapacityBytes();
if (capacityBytes != null) {
if (capacityBytes != pool.getCapacityBytes()) {
updatedCapacityBytes = capacityBytes;
+ changes = true;
}
}
Long updatedCapacityIops = null;
Long capacityIops = cmd.getCapacityIops();
-
if (capacityIops != null) {
if (!capacityIops.equals(pool.getCapacityIops())) {
updatedCapacityIops = capacityIops;
+ changes = true;
}
}
- if (updatedCapacityBytes != null || updatedCapacityIops != null) {
+ // retrieve current details and merge/overlay input to capture changes
+ Map<String, String> inputDetails =
extractApiParamAsMap(cmd.getDetails());
+ Map<String, String> details = null;
+ if (inputDetails == null) {
+ details = _storagePoolDetailsDao.listDetailsKeyPairs(id);
+ } else {
+ details = _storagePoolDetailsDao.listDetailsKeyPairs(id);
+ details.putAll(inputDetails);
+ changes = true;
+ }
+
+ if (changes) {
Review Comment:
There are other possible changes that can be detected above this. breaking
this out would lead to more, not less complexity. I'm inclined to leave it as
is unless there is a great desire to completely refactor this entire method.
--
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]