ilo: do not change deploy_boot_mode in instance_info

instance_info is the input from an operator, we should not change that.
Use driver_internal_info instead.

Change-Id: I12b4bc0d4599ccf5ef6fdca91f54f4294b127f9d
This commit is contained in:
Dmitry Tantsur 2021-02-02 11:40:14 +01:00
parent 4a7d50ce56
commit 6c8dad9465
4 changed files with 23 additions and 21 deletions

View File

@ -318,9 +318,9 @@ def prepare_node_for_deploy(task):
# not provided.
# Since secure boot was disabled, we are in 'uefi' boot mode.
if boot_mode_utils.get_boot_mode_for_deploy(task.node) is None:
instance_info = task.node.instance_info
instance_info['deploy_boot_mode'] = 'uefi'
task.node.instance_info = instance_info
driver_internal_info = task.node.driver_internal_info
driver_internal_info['deploy_boot_mode'] = 'uefi'
task.node.driver_internal_info = driver_internal_info
task.node.save()

View File

@ -597,9 +597,9 @@ def update_boot_mode(task):
# No boot mode found. Check if default_boot_mode is defined
if not boot_mode and (CONF.ilo.default_boot_mode in ['bios', 'uefi']):
boot_mode = CONF.ilo.default_boot_mode
instance_info = node.instance_info
instance_info['deploy_boot_mode'] = boot_mode
node.instance_info = instance_info
driver_internal_info = node.driver_internal_info
driver_internal_info['deploy_boot_mode'] = boot_mode
node.driver_internal_info = driver_internal_info
node.save()
# Boot mode is computed, setting it for the deploy
@ -639,9 +639,9 @@ def update_boot_mode(task):
"as pending boot mode is unknown.",
{'uuid': node.uuid, 'boot_mode': boot_mode})
instance_info = node.instance_info
instance_info['deploy_boot_mode'] = boot_mode
node.instance_info = instance_info
driver_internal_info = node.driver_internal_info
driver_internal_info['deploy_boot_mode'] = boot_mode
node.driver_internal_info = driver_internal_info
node.save()

View File

@ -354,7 +354,7 @@ class IloBootPrivateMethodsTestCase(test_common.BaseIloTest):
states.POWER_OFF)
func_disable_secure_boot.assert_called_once_with(task)
self.assertFalse(func_update_boot_mode.called)
ret_boot_mode = task.node.instance_info['deploy_boot_mode']
ret_boot_mode = task.node.driver_internal_info['deploy_boot_mode']
self.assertEqual('uefi', ret_boot_mode)
bootmode = driver_utils.get_node_capability(task.node, "boot_mode")
self.assertIsNone(bootmode)
@ -381,7 +381,8 @@ class IloBootPrivateMethodsTestCase(test_common.BaseIloTest):
func_update_boot_mode.assert_called_once_with(task)
bootmode = driver_utils.get_node_capability(task.node, "boot_mode")
self.assertIsNone(bootmode)
self.assertNotIn('deploy_boot_mode', task.node.instance_info)
self.assertNotIn('deploy_boot_mode',
task.node.driver_internal_info)
@mock.patch.object(ilo_common, 'update_boot_mode', spec_set=True,
autospec=True)
@ -404,7 +405,8 @@ class IloBootPrivateMethodsTestCase(test_common.BaseIloTest):
self.assertFalse(func_update_boot_mode.called)
bootmode = driver_utils.get_node_capability(task.node, "boot_mode")
self.assertIsNone(bootmode)
self.assertNotIn('deploy_boot_mode', task.node.instance_info)
self.assertNotIn('deploy_boot_mode',
task.node.driver_internal_info)
class IloVirtualMediaBootTestCase(test_common.BaseIloTest):

View File

@ -540,7 +540,7 @@ class IloCommonMethodsTestCase(BaseIloTest):
set_boot_mode_mock):
with task_manager.acquire(self.context, self.node.uuid,
shared=False) as task:
task.node.instance_info['deploy_boot_mode'] = 'bios'
task.node.driver_internal_info['deploy_boot_mode'] = 'bios'
ilo_common.update_boot_mode(task)
set_boot_mode_mock.assert_called_once_with(task.node, 'bios')
@ -563,8 +563,8 @@ class IloCommonMethodsTestCase(BaseIloTest):
shared=False) as task:
ilo_common.update_boot_mode(task)
set_boot_mode_mock.assert_called_once_with(task.node, 'bios')
self.assertEqual('bios',
task.node.instance_info['deploy_boot_mode'])
self.assertEqual(
'bios', task.node.driver_internal_info['deploy_boot_mode'])
@mock.patch.object(ilo_common, 'get_ilo_object', spec_set=True,
autospec=True)
@ -578,8 +578,8 @@ class IloCommonMethodsTestCase(BaseIloTest):
ilo_common.update_boot_mode(task)
get_ilo_object_mock.assert_called_once_with(task.node)
ilo_mock_obj.get_pending_boot_mode.assert_called_once_with()
self.assertEqual('bios',
task.node.instance_info['deploy_boot_mode'])
self.assertEqual(
'bios', task.node.driver_internal_info['deploy_boot_mode'])
@mock.patch.object(ilo_common, 'get_ilo_object', spec_set=True,
autospec=True)
@ -595,8 +595,8 @@ class IloCommonMethodsTestCase(BaseIloTest):
get_ilo_object_mock.assert_called_once_with(task.node)
ilo_mock_obj.get_pending_boot_mode.assert_called_once_with()
set_pending_boot_mode_mock.assert_called_once_with('UEFI')
self.assertEqual('uefi',
task.node.instance_info['deploy_boot_mode'])
self.assertEqual(
'uefi', task.node.driver_internal_info['deploy_boot_mode'])
@mock.patch.object(ilo_common, 'get_ilo_object', spec_set=True,
autospec=True)
@ -628,8 +628,8 @@ class IloCommonMethodsTestCase(BaseIloTest):
ilo_common.update_boot_mode(task)
get_ilo_object_mock.assert_called_once_with(task.node)
ilo_mock_obj.get_pending_boot_mode.assert_called_once_with()
self.assertEqual('bios',
task.node.instance_info['deploy_boot_mode'])
self.assertEqual(
'bios', task.node.driver_internal_info['deploy_boot_mode'])
@mock.patch.object(ilo_common, 'set_boot_mode', spec_set=True,
autospec=True)