ravening commented on a change in pull request #4363:
URL: https://github.com/apache/cloudstack/pull/4363#discussion_r503712301



##########
File path: server/src/main/java/com/cloud/resource/ResourceManagerImpl.java
##########
@@ -1302,6 +1305,17 @@ public Host maintain(final PrepareForMaintenanceCmd cmd) 
{
             throw new CloudRuntimeException("Host is already in state " + 
host.getResourceState() + ". Cannot recall for maintenance until resolved.");
         }
 
+        if (SET_HOST_DOWN_TO_MAINTENANCE.value() && (host.getStatus() == 
Status.Down)) {
+            if (host.getResourceState() == ResourceState.Enabled) {
+                _hostDao.updateResourceState(ResourceState.Enabled, 
ResourceState.Event.AdminAskMaintenance, ResourceState.PrepareForMaintenance, 
host);
+                
_hostDao.updateResourceState(ResourceState.PrepareForMaintenance, 
ResourceState.Event.InternalEnterMaintenance, ResourceState.Maintenance, host);
+                return _hostDao.findById(hostId);
+            } else if (host.getResourceState() == 
ResourceState.ErrorInMaintenance) {
+                _hostDao.updateResourceState(ResourceState.ErrorInMaintenance, 
ResourceState.Event.InternalEnterMaintenance, ResourceState.Maintenance, host);
+                return _hostDao.findById(hostId);
+            }

Review comment:
       > @ravening any specific reason to skip 
"_ResourceState.ErrorInPrepareForMaintenance_", and consider 
"_ResourceState.ErrorInMaintenance_", to put the host in maintenance? What if 
the host is back Up when the resource state is "ErrorInPrepareForMaintenance" ?
   
   @sureshanaparti  this code doesn't take care of that... This is only for 
hosts already in maintenance mode




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to