Prevents power sync with ADOPTFAIL nodes

We shouldn't attempt to sync the power state on nodes in the adopt
failed state as they may be in some sort of intermediate state
indicitive of their adoption failure.

Change-Id: I779155ba2dc3f256273a7f45c5354ee8e6a6fabf
Story: 2007901
Task: 40296
This commit is contained in:
Julia Kreger 2020-07-27 12:25:22 -07:00
parent 44d66d351f
commit 0134508266
3 changed files with 29 additions and 1 deletions

View File

@ -81,7 +81,8 @@ LOG = log.getLogger(__name__)
METRICS = metrics_utils.get_metrics_logger(__name__)
SYNC_EXCLUDED_STATES = (states.DEPLOYWAIT, states.CLEANWAIT, states.ENROLL)
SYNC_EXCLUDED_STATES = (states.DEPLOYWAIT, states.CLEANWAIT, states.ENROLL,
states.ADOPTFAIL)
class ConductorManager(base_manager.BaseConductorManager):

View File

@ -5227,6 +5227,28 @@ class ManagerSyncPowerStatesTestCase(mgr_utils.CommonMixIn,
shared=True)
sync_mock.assert_called_once_with(task, mock.ANY)
def test_single_node_adopt_failed(self, get_nodeinfo_mock,
mapped_mock, acquire_mock, sync_mock):
get_nodeinfo_mock.return_value = self._get_nodeinfo_list_response()
mapped_mock.return_value = True
task = self._create_task(
node_attrs=dict(uuid=self.node.uuid,
provision_state=states.ADOPTFAIL))
acquire_mock.side_effect = self._get_acquire_side_effect(task)
self.service._sync_power_states(self.context)
get_nodeinfo_mock.assert_called_once_with(
columns=self.columns, filters=self.filters)
mapped_mock.assert_called_once_with(self.service,
self.node.uuid,
self.node.driver,
self.node.conductor_group)
acquire_mock.assert_called_once_with(self.context, self.node.uuid,
purpose=mock.ANY,
shared=True)
sync_mock.assert_not_called()
def test__sync_power_state_multiple_nodes(self, get_nodeinfo_mock,
mapped_mock, acquire_mock,
sync_mock):

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fixes the conductor so the power sync operations are not asserted for
nodes in the ``adopt failed`` state.