133
138
provision_state via the REST API.
141
INSPECTING = 'inspecting'
142
""" Node is under inspection.
144
This is the provision state used when inspection is started. A successfully
145
inspected node shall transition to MANAGEABLE status.
149
INSPECTFAIL = 'inspect failed'
150
""" Node inspection failed. """
153
UPDATE_ALLOWED_STATES = (DEPLOYFAIL, INSPECTING, INSPECTFAIL)
154
"""Transitional states in which we allow updating a node."""
169
189
machine = fsm.FSM()
171
191
# Add stable states
172
machine.add_state(MANAGEABLE, **watchers)
173
machine.add_state(AVAILABLE, **watchers)
174
machine.add_state(ACTIVE, **watchers)
175
machine.add_state(ERROR, **watchers)
177
# From MANAGEABLE, a node may be made available
178
# TODO(deva): add CLEAN* states to this path
179
machine.add_transition(MANAGEABLE, AVAILABLE, 'provide')
181
# From AVAILABLE, a node may be made unavailable by managing it
182
machine.add_transition(AVAILABLE, MANAGEABLE, 'manage')
192
machine.add_state(MANAGEABLE, stable=True, **watchers)
193
machine.add_state(AVAILABLE, stable=True, **watchers)
194
machine.add_state(ACTIVE, stable=True, **watchers)
195
machine.add_state(ERROR, stable=True, **watchers)
184
197
# Add deploy* states
185
198
# NOTE(deva): Juno shows a target_provision_state of DEPLOYDONE
188
201
machine.add_state(DEPLOYWAIT, target=ACTIVE, **watchers)
189
202
machine.add_state(DEPLOYFAIL, target=ACTIVE, **watchers)
205
machine.add_state(CLEANING, target=AVAILABLE, **watchers)
206
machine.add_state(CLEANFAIL, target=AVAILABLE, **watchers)
191
208
# Add delete* states
192
# NOTE(deva): Juno shows a target_provision_state of DELETED
193
# this is changed in Kilo to AVAILABLE
194
209
machine.add_state(DELETING, target=AVAILABLE, **watchers)
196
211
# From AVAILABLE, a deployment may be started
197
212
machine.add_transition(AVAILABLE, DEPLOYING, 'deploy')
214
# Add inspect* states.
215
machine.add_state(INSPECTING, target=MANAGEABLE, **watchers)
216
machine.add_state(INSPECTFAIL, target=MANAGEABLE, **watchers)
199
218
# A deployment may fail
200
219
machine.add_transition(DEPLOYING, DEPLOYFAIL, 'fail')
231
250
# ironic/conductor/manager.py:do_node_tear_down()
232
251
machine.add_transition(DEPLOYFAIL, DELETING, 'delete')
234
# A delete may complete
235
machine.add_transition(DELETING, AVAILABLE, 'done')
237
253
# This state can also transition to error
238
254
machine.add_transition(DELETING, ERROR, 'error')
256
# When finished deleting, a node will begin cleaning
257
machine.add_transition(DELETING, CLEANING, 'clean')
259
# If cleaning succeeds, it becomes available for scheduling
260
machine.add_transition(CLEANING, AVAILABLE, 'done')
262
# If cleaning fails, wait for operator intervention
263
machine.add_transition(CLEANING, CLEANFAIL, 'fail')
265
# A node that fails cleaning may be put back through cleaning
266
machine.add_transition(CLEANFAIL, CLEANING, 'clean')
268
# An operator may want to hold a CLEANFAIL node in operator for zapping or
269
# outside-of-Ironic operations (like replacing hardware)
270
machine.add_transition(CLEANFAIL, MANAGEABLE, 'manage')
272
# From MANAGEABLE, a node may move to available after going through cleaning
273
machine.add_transition(MANAGEABLE, CLEANING, 'provide')
275
# From AVAILABLE, a node may be made unavailable by managing it
276
machine.add_transition(AVAILABLE, MANAGEABLE, 'manage')
240
278
# An errored instance can be rebuilt
241
279
# ironic/conductor/manager.py:do_node_deploy()
242
280
machine.add_transition(ERROR, DEPLOYING, 'rebuild')
244
282
# ironic/conductor/manager.py:do_node_tear_down()
245
283
machine.add_transition(ERROR, DELETING, 'delete')
285
# Added transitions for inspection.
286
# Initiate inspection.
287
machine.add_transition(MANAGEABLE, INSPECTING, 'inspect')
289
# ironic/conductor/manager.py:inspect_hardware().
290
machine.add_transition(INSPECTING, MANAGEABLE, 'done')
292
# Inspection may fail.
293
machine.add_transition(INSPECTING, INSPECTFAIL, 'fail')
295
# Move the node to manageable state for any other
297
machine.add_transition(INSPECTFAIL, MANAGEABLE, 'manage')
299
# Reinitiate the inspect after inspectfail.
300
machine.add_transition(INSPECTFAIL, INSPECTING, 'inspect')