ironic.common.fsm module¶
- class ironic.common.fsm.FSM[source]¶
- Bases: - FiniteMachine- An ironic state-machine class with some ironic specific additions. - add_state(state, on_enter=None, on_exit=None, target=None, terminal=None, stable=False)[source]¶
- Adds a given state to the state machine. - Parameters:
- stable – Use this to specify that this state is a stable/passive state. A state must have been previously defined as ‘stable’ before it can be used as a ‘target’ 
- target – The target state for ‘state’ to go to. Before a state can be used as a target it must have been previously added and specified as ‘stable’ 
 
 - Further arguments are interpreted as for parent method - add_state.
 - add_transition(start, end, event, replace=False)¶
- Adds an allowed transition from start -> end for the given event. - Parameters:
- start – starting state 
- end – ending state 
- event – event that causes start state to transition to end state 
- replace – replace existing event instead of raising a - Duplicateexception when the transition already exists.
 
 
 - initialize(start_state=None, target_state=None)[source]¶
- Initialize the FSM. - Parameters:
- start_state – the FSM is initialized to start from this state 
- target_state – if specified, the FSM is initialized to this target state. Otherwise use the default target state 
 
 
 - is_stable(state)[source]¶
- Is the state stable? - Parameters:
- state – the state of interest 
- Raises:
- InvalidState if the state is invalid 
- Returns:
- True if it is a stable state; False otherwise 
 
 - process_event(event, target_state=None)[source]¶
- process the event. - Parameters:
- event – the event to be processed 
- target_state – if specified, the ‘final’ target state for the event. Otherwise, use the default target state 
 
 
 - property target_state¶
 
