ironic-inspector/releasenotes/notes/db-status-consistency-enhancements-f97fbaccfc81a60b.yaml
dparalen 7e72ceffd1 Terminal state transitions in transactions
Multiple spots were not using DB transactions when processing the terminal
state transitions (error, abort, finish, timeout). The pattern looked like
this:

    node_info.fsm_event(istate.Events.error)
    # more code
    node_info.finished(error='Oops!')

which led to brief periodes of state inconsistency of NodeInfo records in
the DB.

This patch refactors the NodeInfo.finished() method to require a terminal state
transition to perform as part of the NodeInfo state update:

   NodeInfo().finished(istate.Events.finish)
   NodeInfo().finished(istate.Events.abort, 'Canceled by operator')

This patch also introduces a new state: aborting to allow the inspector to
try call power-off the node before marking the introspection aborted.

There's a new DB migration since the new state implies a schema change too
(Enum).

Closes-Bug: #1721233
Closes-Bug: #1721230
Closes-Bug: #1723384

Change-Id: I0bb051d1956a996ed006d55a5ca2d670d9455047
2017-12-19 18:15:31 +01:00

13 lines
492 B
YAML

---
upgrade:
- |
A new state ``aborting`` was introduced to distinguish between the node
introspection abort precondition (being able to perform the state
transition from the ``waiting`` state) from the activities necessary to
abort an ongoing node introspection (power-off, set finished timestamp
etc.)
fixes:
- |
The ``node_info.finished(<transition>, error=<error>)`` now updates node
state together with other status attributes in a single DB transaction.