anuragaw commented on a change in pull request #3425: [WIP DO NOT MERGE] Better
tracking host maintanence success and failure
URL: https://github.com/apache/cloudstack/pull/3425#discussion_r349740002
##########
File path: api/src/main/java/com/cloud/resource/ResourceState.java
##########
@@ -92,18 +101,25 @@ public ResourceState getNextState(Event a) {
s_fsm.addTransition(ResourceState.Enabled, Event.Enable,
ResourceState.Enabled);
s_fsm.addTransition(ResourceState.Enabled, Event.InternalCreated,
ResourceState.Enabled);
s_fsm.addTransition(ResourceState.Enabled, Event.Disable,
ResourceState.Disabled);
- s_fsm.addTransition(ResourceState.Enabled, Event.AdminAskMaintenace,
ResourceState.PrepareForMaintenance);
+ s_fsm.addTransition(ResourceState.Enabled, Event.AdminAskMaintenance,
ResourceState.PrepareForMaintenance);
s_fsm.addTransition(ResourceState.Enabled,
Event.InternalEnterMaintenance, ResourceState.Maintenance);
s_fsm.addTransition(ResourceState.Disabled, Event.Enable,
ResourceState.Enabled);
s_fsm.addTransition(ResourceState.Disabled, Event.Disable,
ResourceState.Disabled);
s_fsm.addTransition(ResourceState.Disabled, Event.InternalCreated,
ResourceState.Disabled);
s_fsm.addTransition(ResourceState.PrepareForMaintenance,
Event.InternalEnterMaintenance, ResourceState.Maintenance);
s_fsm.addTransition(ResourceState.PrepareForMaintenance,
Event.AdminCancelMaintenance, ResourceState.Enabled);
- s_fsm.addTransition(ResourceState.PrepareForMaintenance,
Event.UnableToMigrate, ResourceState.ErrorInMaintenance);
+ s_fsm.addTransition(ResourceState.PrepareForMaintenance,
Event.UnableToMigrate, ResourceState.ErrorInPrepareForMaintenance);
+ s_fsm.addTransition(ResourceState.PrepareForMaintenance,
Event.UnableToMaintain, ResourceState.ErrorInMaintenance);
s_fsm.addTransition(ResourceState.PrepareForMaintenance,
Event.InternalCreated, ResourceState.PrepareForMaintenance);
s_fsm.addTransition(ResourceState.Maintenance,
Event.AdminCancelMaintenance, ResourceState.Enabled);
s_fsm.addTransition(ResourceState.Maintenance, Event.InternalCreated,
ResourceState.Maintenance);
s_fsm.addTransition(ResourceState.Maintenance, Event.DeleteHost,
ResourceState.Disabled);
+ s_fsm.addTransition(ResourceState.ErrorInPrepareForMaintenance,
Event.InternalEnterMaintenance, ResourceState.Maintenance);
+ s_fsm.addTransition(ResourceState.ErrorInPrepareForMaintenance,
Event.AdminCancelMaintenance, ResourceState.Enabled);
+ s_fsm.addTransition(ResourceState.ErrorInPrepareForMaintenance,
Event.UnableToMigrate, ResourceState.ErrorInPrepareForMaintenance);
+ s_fsm.addTransition(ResourceState.ErrorInPrepareForMaintenance,
Event.UnableToMaintain, ResourceState.ErrorInMaintenance);
+ s_fsm.addTransition(ResourceState.ErrorInPrepareForMaintenance,
Event.ErrorsCorrected, ResourceState.PrepareForMaintenance);
+ s_fsm.addTransition(ResourceState.ErrorInPrepareForMaintenance,
Event.InternalCreated, ResourceState.ErrorInPrepareForMaintenance);
Review comment:
While in ErrorInPrepareForMaintenance state, the admins can first cancel
maintenance - which cancels all pending migrations and their retries. After
that a host can be put to Disabled state.
I think that is the current behaviour as well except the host is shown in
ErrorInMaintenance on first failure and any pending migrations are cancelled
right away. The patch adds a transiton state to allow identify any ongoing
migrations/retries.
Do you think we need to allow hosts to be moved to disabled state while
migrations are ongoing? Could mean a lot of possible edge cases to be
considered. Thoughts?
----------------------------------------------------------------
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]
With regards,
Apache Git Services