shwstppr commented on code in PR #7889:
URL: https://github.com/apache/cloudstack/pull/7889#discussion_r1411929441


##########
server/src/main/java/com/cloud/storage/StorageManagerImpl.java:
##########
@@ -1024,36 +1024,56 @@ public PrimaryDataStoreInfo 
updateStoragePool(UpdateStoragePoolCmd cmd) throws I
             _storagePoolTagsDao.persist(pool.getId(), storagePoolTags, 
cmd.isTagARule());
         }
 
+        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) {
             StoragePoolVO storagePool = _storagePoolDao.findById(id);
             DataStoreProvider dataStoreProvider = 
_dataStoreProviderMgr.getDataStoreProvider(storagePool.getStorageProviderName());
             DataStoreLifeCycle dataStoreLifeCycle = 
dataStoreProvider.getDataStoreLifeCycle();
 
             if (dataStoreLifeCycle instanceof PrimaryDataStoreLifeCycle) {
-                Map<String, String> details = new HashMap<String, String>();
-
-                details.put(PrimaryDataStoreLifeCycle.CAPACITY_BYTES, 
updatedCapacityBytes != null ? String.valueOf(updatedCapacityBytes) : null);
-                details.put(PrimaryDataStoreLifeCycle.CAPACITY_IOPS, 
updatedCapacityIops != null ? String.valueOf(updatedCapacityIops) : null);
-
+                if (updatedCapacityBytes != null) {
+                    details.put(PrimaryDataStoreLifeCycle.CAPACITY_BYTES, 
updatedCapacityBytes != null ? String.valueOf(updatedCapacityBytes) : null);
+                    _storagePoolDao.updateCapacityBytes(id, 
updatedCapacityBytes);
+                }
+                if (updatedCapacityIops != null) {
+                    details.put(PrimaryDataStoreLifeCycle.CAPACITY_IOPS, 
updatedCapacityIops != null ? String.valueOf(updatedCapacityIops) : null);
+                    _storagePoolDao.updateCapacityIops(id, 
updatedCapacityIops);
+                }
+                if (cmd.getUrl() != null) {
+                    details.put("url", cmd.getUrl());
+                }
                 
((PrimaryDataStoreLifeCycle)dataStoreLifeCycle).updateStoragePool(storagePool, 
details);
+                _storagePoolDao.persist(storagePool, details, null);

Review Comment:
   @rg9975 should these be update calls?
   
   ```suggestion
                   _storagePoolDao.update(id, storagePool);
                   _storagePoolDao.updateDetails(id, details);
   ```
   
   Build failing here currently,
   
   ```
    Error:  Failed to execute goal 
org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) 
on project cloud-server: Compilation failure
   Error:  
/home/runner/work/cloudstack/cloudstack/server/src/main/java/com/cloud/storage/StorageManagerImpl.java:[1076,31]
 error: no suitable method found for 
persist(StoragePoolVO,Map<String,String>,<null>)
   Error:      method GenericDao.persist(StoragePoolVO) is not applicable
   Error:        (actual and formal argument lists differ in length)
   Error:      method 
PrimaryDataStoreDao.persist(StoragePoolVO,Map<String,String>,List<String>,Boolean)
 is not applicable
   Error:        (actual and formal argument lists differ in length)
   Error:  -> [Help 1]
   ```



-- 
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]

Reply via email to