vishesh92 commented on code in PR #14405:
URL: https://github.com/apache/cloudstack/pull/14405#discussion_r4281531126


##########
server/src/main/java/com/cloud/storage/StorageManagerImpl.java:
##########
@@ -2606,6 +2608,19 @@ public void 
doInTransactionWithoutResult(TransactionStatus status) {
         }
     }
 
+    /**
+     * Remembers a Disabled pool's status so that cancelling maintenance puts 
it back to Disabled instead of Up
+     * (restored in PrimaryDataStoreHelper#cancelMaintain). A retry from 
ErrorInMaintenance keeps what the
+     * first attempt recorded.
+     */
+    protected void recordStatusBeforeMaintenance(StoragePoolVO pool) {
+        if (pool.getStatus() == StoragePoolStatus.Disabled) {
+            _storagePoolDetailsDao.addDetail(pool.getId(), 
PrimaryDataStoreLifeCycle.STATUS_BEFORE_MAINTENANCE, 
StoragePoolStatus.Disabled.name(), false);
+        } else if (pool.getStatus() == StoragePoolStatus.Up) {
+            _storagePoolDetailsDao.removeDetail(pool.getId(), 
PrimaryDataStoreLifeCycle.STATUS_BEFORE_MAINTENANCE);
+        }
+    }

Review Comment:
   invalid. addDetail removes the existing detail before adding the new one.



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