summaryrefslogtreecommitdiff
path: root/ironic/common/fsm.py
Commit message (Collapse)AuthorAgeFilesLines
* Stop using six libraryRiccardo Pittau2019-12-231-4/+5
| | | | | | | | | | Since we've dropped support for Python 2.7, it's time to look at the bright future that Python 3.x will bring and stop forcing compatibility with older versions. This patch removes the six library from requirements, not looking back. Change-Id: Ib546f16965475c32b2f8caabd560e2c7d382ac5a
* Fix W504 errorsJulia Kreger2018-05-091-4/+4
| | | | | | | | Also a few related errors based on some earlier investigation may have been pulled in along the lines of E305. Story: #2001985 Change-Id: Ifb2d3b481202fbd8cbb472e02de0f14f4d0809fd
* Removes unnecessary utf-8 encodingM V P Nitesh2017-01-111-2/+0
| | | | Change-Id: I90cc37e5e3fdc8e7451ad5be455d78a70ade9d5d
* Fix docstring warningsRamamani Yeleswarapu2016-07-121-1/+1
| | | | | | | | | | Fix existing docstring warnings in Ironic doc builds. This is to make sure upcoming pbr release to fix the 'warnerrors' issue[0] doesn't break our doc builds. [0] http://lists.openstack.org/pipermail/openstack-dev/2016-June/097849.html Change-Id: Idd8db05bacb26833ff3ec3a2d8bf48d1fccee788
* Add FSM.is_stable() methodRuby Loo2015-12-101-1/+13
| | | | | | | | This adds an FSM.is_stable(state) method which returns True if the state is stable and False otherwise. Invalid states will cause an exception to be raised. Change-Id: Ic6a3c937be9370477fdb1fe2c462f6672497f838
* Specifying target provision states in fsmRuby Loo2015-11-181-11/+47
| | | | | | | | | | | | | | | | In ironic, a state can be associated with a target state, and these associations are defined when the fsm is created. This patch adds the ability to override these default target states when initializing the fsm as well as when processing an event that transitions the fsm to a new state (and target state). This is useful, for example, when adding the manual clean feature, which causes a node to go from manageable -> clean* -> manageble instead of the default behaviour (for automated cleaning) of -> clean* -> available. Change-Id: I0a7c9be0e44b75f8bd2ebfefd3fb710109612578 Implements: blueprint manual-cleaning
* Remove 'is_valid_event' methodJoshua Harlow2015-09-021-13/+0
| | | | | | | | This method is no longer needed as ironic now has access to the automaton provided 'is_actionable_event' method that provides an equivalent api. Change-Id: Ib0edd2da7e36b91c3fba306133f011db5a87019f
* Transition state machine to use automaton oslo lib.Joshua Harlow2015-06-191-176/+61
| | | | | | Partial-Bug: #1465248 Depends-On: Iced7fb706e5919c30fab6ae939a7302a7724fbeb Change-Id: I1eb5a176fa5c58628ea0bd07bbc208cccaabf2cc
* Enforce flake8 E123/6/7/8 in ironicSam Betts2015-06-041-2/+2
| | | | | | | | | | | | | | | | | This patch enforces the rules E123, E126, E127, and E128 in the ironic code base: E123 - closing bracket does not match indentation of opening bracket’s line E126 - continuation line over-indented for hanging indent E127 - continuation line over-indented for visual indent E128 - continuation line under-indented for visual indent This fixes any parts of the current code which fails these rules and removes these rules from the tox.ini flake8 ignore list. Change-Id: Ia96582b5e9abc088d6c1694afc93c59be4a4065c Closes-Bug: 1421522
* Add concept of stable states to the state machineJohn L. Villalovos2015-02-171-1/+15
| | | | | | | Adding the concept of a 'stable' state. When using add_state() only a 'stable' state can be used as a target. Change-Id: I22ec4f4cbb855849e9a80b6a32ed01d1616958da
* Rename NOSTATE to AVAILABLEDevananda van der Veen2015-01-301-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds the new provisioning state AVAILABLE, and bumps the API microversion to 1.1. This version exposes the renaming of the previous provision_state="None" to provision_state="available" for nodes which are available for use. A database migration is added which updates all DB records' provision_state from NOSTATE to AVAILABLE. Since database migrations and code changes may be rolled out at different times, the conductor can deploy to a node in either NOSTATE or AVAILABLE states. OperatorImpact: This change should be rolled out to production services, and the conductor service should be restarted, *before* the database migration is applied. Ironic will then begin "translating" existing node states to the new AVAILABLE state automatically when it touches them. If the DB migration is run much later, it may not actually update any records (and that is OK). DocImpact: This change updates the Node provision_state value which represents a node that is available for provisioning. It is changed from "None" to "available", but this change is only realized when the X-OpenStack-Ironic-API-Version header is >= 1.1 *** NOTE *** Nova interprets the provision_state of Nodes to determine which should be exposed to the scheduler and counted as available resources. Up to the Juno release, Nova looked for the "NOSTATE" state to indicate this, represented as provision_state=None. After commit Idbd36b230cf997bed7a86c3f56cf9c70995028b2 landed in Nova, both the old "None" and new "available" states are interpreted in this way. As such, Nova may continue to use Juno Ironic, which did not support microversions, or may begin using the 1.1 version. Implements: blueprint new-ironic-state-machine Change-Id: I5e6f6ee5877d475136ce2ebad4a9333b424dc96b
* Merge "Minor changes to state model"Jenkins2015-01-091-0/+1
|\
| * Minor changes to state modelDevananda van der Veen2015-01-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch contains a few changes to the state model. The first is a fix for an issue caught by Ruby in post-merge review: - fsm.py initialize() did not set _target_state, which led to some incorrect calculations during subsequent state transitions. Additionally, in the Juno release, the DEPLOYDONE state was exposed only on the target_provision_state field, and never set as the current provision state. - Commit b49470e1 incorrectly expressed DEPLOYDONE as a current provision state. With this patch, current provision state transitions from DEPLOYING directly to ACTIVE, as it did in Juno. A subsequent patch should introduce the DEPLOYED state. - In accordance with bp/new-ironic-state-machine, target_provision_state is changed from DEPLOYDONE to ACTIVE during the deploy phase. Similarly, in the Juno release, the DELETED state was exposed only on the target_provision_state field. - In accordance with bp/new-ironic-state-machine, target_provision_state is changed from DELETED to NOSTATE (which will become AVAILABLE) during the deletion phase. Change-Id: I21d7d29f72c9228a03b2b941c61ed36af056de3e Related-to: blueprint new-ironic-state-machine
* | Add a fsm state -> dot diagram generatorJoshua Harlow2014-12-181-0/+6
|/ | | | | | | | | | | | | | | | | | Add a tool (derived from taskflow's similar tool) that can turn the state machine defined in ironic into a dot diagram. This diagram is much easier to look at then trying to mentally create a similar diagram; this makes it easier to see issues and to visualize the state machines valid states and transitions. For this change we need to add back in the state machine __iter__ method so that we can correctly iterate over the states and transitions (and events that will cause those transitions). Change-Id: I9da09f65a46617aa1c837ae0fc71350276df8bea
* Add base state machineDevananda van der Veen2014-12-151-0/+219
This creates the ironic.common.fsm module, which was imported from TaskFlow and modified to fit the use-case of Ironic, and adds a model of our current states to the ironic.common.states module. Notable changes from the fsm.py module in TaskFlow are: - removing the table printing dependency - basing exceptions on Ironic's exception class names (which, it turns out, are almost identical) - add is_valid_event() method - allowing the state to be passed when initializing a FSM - allowing shallow copies of state machines - adding target-state-tracking to fsm.py Related-To: blueprint new-ironic-state-machine Co-Authored-By: David Shrewsbury <shrewsbury.dave@gmail.com> Co-Authored-By: Chris Krelle <nobodycam@gmail.com> Change-Id: I813e60563c3e5124e31183b9322152df830b2f8e