Merge "Fix fast track when exiting cleaning"

This commit is contained in:
Zuul 2020-06-04 16:24:06 +00:00 committed by Gerrit Code Review
commit 364312c8ec
3 changed files with 17 additions and 4 deletions

View File

@ -218,12 +218,13 @@ def do_next_clean_step(task, step_index):
driver_internal_info.pop('clean_step_index', None)
driver_internal_info.pop('cleaning_reboot', None)
driver_internal_info.pop('cleaning_polling', None)
driver_internal_info.pop('agent_secret_token', None)
driver_internal_info.pop('agent_secret_token_pregenerated', None)
# Remove agent_url
if not utils.fast_track_able(task):
driver_internal_info.pop('agent_url', None)
driver_internal_info.pop('agent_secret_token', None)
driver_internal_info.pop('agent_secret_token_pregenerated', None)
node.driver_internal_info = driver_internal_info
node.save()
try:

View File

@ -889,8 +889,9 @@ class DoNodeCleanTestCase(db_base.DbTestCase):
self.config(fast_track=True, group='deploy')
for info in ({'clean_steps': None, 'clean_step_index': None,
'agent_url': 'test-url'},
{'clean_steps': None, 'agent_url': 'test-url'}):
'agent_url': 'test-url', 'agent_secret_token': 'magic'},
{'clean_steps': None, 'agent_url': 'test-url',
'agent_secret_token': 'it_is_a_kind_of_magic'}):
# Resume where there are no steps, should be a noop
tgt_prov_state = states.MANAGEABLE if manual else states.AVAILABLE
@ -918,8 +919,12 @@ class DoNodeCleanTestCase(db_base.DbTestCase):
if fast_track:
self.assertEqual('test-url',
node.driver_internal_info.get('agent_url'))
self.assertIsNotNone(
node.driver_internal_info.get('agent_secret_token'))
else:
self.assertNotIn('agent_url', node.driver_internal_info)
self.assertNotIn('agent_secret_token',
node.driver_internal_info)
mock_execute.reset_mock()
def test__do_next_clean_step_automated_no_steps(self):

View File

@ -0,0 +1,7 @@
---
fixes:
- |
Fixes a bug in "fast track" where Ironic would delete the ``agent token``
upon exiting cleaning steps. However, if we are in fast track mode, we can
preserve the token and continue operations with the agent as it is not
powered off during fast track operations.