diff options
author | Zuul <zuul@review.opendev.org> | 2020-08-08 12:02:54 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2020-08-08 12:02:54 +0000 |
commit | b6e74c61652f4369f8e67d716402d5e5e3d464c4 (patch) | |
tree | 7b8e886251e85baea3d8b1c87e7f11e14541b087 | |
parent | 80ee3e7e339da82102b4cf9e4005d32779944029 (diff) | |
parent | 549af3cec21cdf1c8b9103755ca836ce245a2f2b (diff) | |
download | ironic-b6e74c61652f4369f8e67d716402d5e5e3d464c4.tar.gz |
Merge "Clean up nodes in DELETING on conductor restart" into stable/stein
-rw-r--r-- | ironic/common/states.py | 4 | ||||
-rw-r--r-- | ironic/conductor/manager.py | 2 | ||||
-rw-r--r-- | ironic/tests/unit/conductor/test_base_manager.py | 1 | ||||
-rw-r--r-- | ironic/tests/unit/conductor/test_manager.py | 2 | ||||
-rw-r--r-- | releasenotes/notes/deleting-dcdb9cf0d2a6a1a6.yaml | 4 |
5 files changed, 9 insertions, 4 deletions
diff --git a/ironic/common/states.py b/ironic/common/states.py index 9f5e7ca6a..841558ca2 100644 --- a/ironic/common/states.py +++ b/ironic/common/states.py @@ -235,7 +235,7 @@ UNSTABLE_STATES = (DEPLOYING, DEPLOYWAIT, CLEANING, CLEANWAIT, VERIFYING, """States that can be changed without external request.""" STUCK_STATES_TREATED_AS_FAIL = (DEPLOYING, CLEANING, VERIFYING, INSPECTING, - ADOPTING, RESCUING, UNRESCUING) + ADOPTING, RESCUING, UNRESCUING, DELETING) """States that cannot be resumed once a conductor dies. If a node gets stuck with one of these states for some reason @@ -383,7 +383,7 @@ machine.add_transition(DEPLOYWAIT, DELETING, 'delete') machine.add_transition(DEPLOYFAIL, DELETING, 'delete') # This state can also transition to error -machine.add_transition(DELETING, ERROR, 'error') +machine.add_transition(DELETING, ERROR, 'fail') # When finished deleting, a node will begin cleaning machine.add_transition(DELETING, CLEANING, 'clean') diff --git a/ironic/conductor/manager.py b/ironic/conductor/manager.py index 677d2d0c2..cda2a18f2 100644 --- a/ironic/conductor/manager.py +++ b/ironic/conductor/manager.py @@ -1033,7 +1033,7 @@ class ConductorManager(base_manager.BaseConductorManager): LOG.exception('Error in tear_down of node %(node)s: %(err)s', {'node': node.uuid, 'err': e}) node.last_error = _("Failed to tear down. Error: %s") % e - task.process_event('error') + task.process_event('fail') else: # NOTE(deva): When tear_down finishes, the deletion is done, # cleaning will start next diff --git a/ironic/tests/unit/conductor/test_base_manager.py b/ironic/tests/unit/conductor/test_base_manager.py index 0c619d912..424dbb231 100644 --- a/ironic/tests/unit/conductor/test_base_manager.py +++ b/ironic/tests/unit/conductor/test_base_manager.py @@ -217,6 +217,7 @@ class StartStopTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase): (states.ADOPTING, states.ADOPTFAIL), (states.RESCUING, states.RESCUEFAIL), (states.UNRESCUING, states.UNRESCUEFAIL), + (states.DELETING, states.ERROR), ] nodes = [obj_utils.create_test_node(self.context, uuid=uuid.uuid4(), driver='fake-hardware', diff --git a/ironic/tests/unit/conductor/test_manager.py b/ironic/tests/unit/conductor/test_manager.py index 5d6b059ac..496d12119 100644 --- a/ironic/tests/unit/conductor/test_manager.py +++ b/ironic/tests/unit/conductor/test_manager.py @@ -3434,7 +3434,7 @@ class DoNodeCleanTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase): def test_continue_node_clean_wrong_state(self, mock_spawn): # Test the appropriate exception is raised if node isn't already # in CLEANWAIT state - prv_state = states.DELETING + prv_state = states.ACTIVE tgt_prv_state = states.AVAILABLE node = obj_utils.create_test_node(self.context, driver='fake-hardware', provision_state=prv_state, diff --git a/releasenotes/notes/deleting-dcdb9cf0d2a6a1a6.yaml b/releasenotes/notes/deleting-dcdb9cf0d2a6a1a6.yaml new file mode 100644 index 000000000..3b53b2e9a --- /dev/null +++ b/releasenotes/notes/deleting-dcdb9cf0d2a6a1a6.yaml @@ -0,0 +1,4 @@ +--- +fixes: + - | + Cleans up nodes stuck in the ``deleting`` state on conductor restart. |