sureshanaparti commented on code in PR #10417:
URL: https://github.com/apache/cloudstack/pull/10417#discussion_r1987126522


##########
plugins/maintenance/src/main/java/org/apache/cloudstack/maintenance/ManagementServerMaintenanceManagerImpl.java:
##########
@@ -257,8 +300,13 @@ public void cancelMaintenance() {
         jobManager.enableAsyncJobs();
         cancelWaitForPendingJobs();
         ManagementServerHostVO msHost = 
msHostDao.findByMsid(ManagementServerNode.getManagementServerId());
-        if (msHost != null && State.Maintenance.equals(msHost.getState())) {
-            onCancelMaintenance();
+        if (msHost != null) {
+            if (State.PreparingForMaintenance.equals(msHost.getState())) {
+                onCancelPreparingForMaintenance();
+            }
+            if (State.Maintenance.equals(msHost.getState())) {
+                onCancelMaintenance();
+            }
         }

Review Comment:
   no changes, this should be ok in the method



##########
plugins/maintenance/src/main/java/org/apache/cloudstack/maintenance/ManagementServerMaintenanceManagerImpl.java:
##########
@@ -319,22 +370,23 @@ public ManagementServerMaintenanceResponse 
triggerShutdown(TriggerShutdownCmd cm
         }
 
         if (State.Up.equals(msHost.getState())) {
+            final List<ManagementServerHostVO> 
preparingForMaintenanceOrShutDownMsList = 
msHostDao.listBy(State.PreparingForMaintenance, State.PreparingForShutDown);
+            if 
(CollectionUtils.isNotEmpty(preparingForMaintenanceOrShutDownMsList)) {
+                throw new CloudRuntimeException("Cannot trigger shutdown now, 
there are other management servers preparing for maintenance/shutdown");
+            }
             msHostDao.updateState(msHost.getId(), State.PreparingForShutDown);
         }

Review Comment:
   no changes, validation should be ok in the 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: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to