Do not abort wait_for_provision_state of last_errors becomes non-empty

It can happen if one of heartbeats encounteres "node locked" error, which
is normal, because the next heartbeat will succeed.

Change-Id: Iaed9b83e199761eac4e0e2157c16ea1efa564c24
Story: #2002094
Task: #19772
(cherry picked from commit 8940d72521)
This commit is contained in:
Dmitry Tantsur 2018-05-24 13:55:24 +02:00
parent e944146e86
commit de77496644
3 changed files with 12 additions and 2 deletions

View File

@ -1567,7 +1567,9 @@ class NodeManagerTest(testtools.TestCase):
def test_wait_for_provision_state(self, mock_get, mock_sleep):
mock_get.side_effect = [
self._fake_node_for_wait('deploying', target='active'),
self._fake_node_for_wait('deploying', target='active'),
# Sometimes non-fatal errors can be recorded in last_error
self._fake_node_for_wait('deploying', target='active',
error='Node locked'),
self._fake_node_for_wait('active')
]

View File

@ -647,7 +647,7 @@ class NodeManager(base.CreateManager):
return
# Note that if expected_state == 'error' we still succeed
if (node.last_error or node.provision_state == 'error' or
if (node.provision_state == 'error' or
node.provision_state.endswith(' failed')):
raise exc.StateTransitionFailed(
_('Node %(node)s failed to reach state %(state)s. '

View File

@ -0,0 +1,8 @@
---
fixes:
- |
Waiting for a provision state to be reached (via CLI ``--wait`` argument or
the ``wait_for_provision_state`` function) no longer aborts when the node's
``last_error`` field gets populated. It can cause a normal deployment to
abort if a heartbeat from the ramdisk fails because of locking - see
`story 2002094 <https://storyboard.openstack.org/#!/story/2002094>`_.