To disable service even when it is in unknown state

A service in unknown state is currently not reacting to disable event.
It prevents the service group from being disabled->go-standby. When a
service is in unknown state, the swact is blocked on the active
controller.

This fix allows the attempt to disable a service in unknown state.
The swact will be determined by the result of the disable action, i.e,
failing to disable a critical service will fail the swact. The swact
will continue if disabling a major or minor service fails, with alarm
or warning.

Closes-bug: 1831273

Change-Id: I30010c66c60fcf0eec8399a35e159755a1d3d318
Signed-off-by: Bin Qian <bin.qian@windriver.com>
This commit is contained in:
Bin Qian 2019-06-12 11:08:48 -04:00
parent 0d7a269bc7
commit ca7f275238
1 changed files with 19 additions and 0 deletions

View File

@ -176,6 +176,25 @@ SmErrorT sm_service_unknown_state_event_handler( SmServiceT* service,
++(service->transition_fail_count);
break;
case SM_SERVICE_EVENT_DISABLE:
if( service->disable_action_exists ) {
state = SM_SERVICE_STATE_DISABLING;
error = sm_service_fsm_set_state( service, state );
if( SM_OKAY != error )
{
DPRINTFE( "Failed to set service (%s) state (%s), "
"error=%s.", service->name,
sm_service_state_str( state ),
sm_error_str( error ) );
return( error );
}
} else
{
DPRINTFE( "Service (%s) received disable event without "
"disable action, event is ignored.", service->name );
}
break;
case SM_SERVICE_EVENT_SHUTDOWN:
error = sm_service_fsm_set_state( service,
SM_SERVICE_STATE_SHUTDOWN );