diff options
author | Aija Jauntēva <aija.jaunteva@dell.com> | 2022-12-09 08:47:20 -0500 |
---|---|---|
committer | kamlesh chauvhan <kamlesh.chauvhan@gmail.com> | 2023-01-12 13:02:26 +0000 |
commit | 959fc9163c503f98f3574db19ca2b4d632bf09f0 (patch) | |
tree | 572ddc53c4b0532428e91e498312d4d3f4499237 | |
parent | 26573bed3aa64f8fdb81cada528d30373060c766 (diff) | |
download | ironic-959fc9163c503f98f3574db19ca2b4d632bf09f0.tar.gz |
Fix "'NoneType' object is not iterable" in RAID
Do not update `raid_configs` if operation is synchronous.
First, it is not needed, second, it will not be cleaned
up by async periodics. As the result the data remains
on the node and causes errors the next time node is in
cleaning state.
Story: 2010476
Task: 47037
Change-Id: Ib1850c58d1670c3555ac9b02eb7958a1b440a339
(cherry picked from commit 17c9e58c9ecaca6c058597d906c94a6d032b7efe)
3 files changed, 17 insertions, 2 deletions
diff --git a/ironic/drivers/modules/redfish/raid.py b/ironic/drivers/modules/redfish/raid.py index 809ec59c6..154cd53d3 100644 --- a/ironic/drivers/modules/redfish/raid.py +++ b/ironic/drivers/modules/redfish/raid.py @@ -1120,7 +1120,9 @@ class RedfishRAID(base.RAIDInterface): raid_configs['pending'].setdefault(controller, []).append( logical_disk) - node.set_driver_internal_info('raid_configs', raid_configs) + # Store only when async operation + if reboot_required: + node.set_driver_internal_info('raid_configs', raid_configs) return raid_configs, reboot_required @@ -1182,7 +1184,9 @@ class RedfishRAID(base.RAIDInterface): response.task_monitor_uri) reboot_required = True - node.set_driver_internal_info('raid_configs', raid_configs) + # Store only when async operation + if reboot_required: + node.set_driver_internal_info('raid_configs', raid_configs) return raid_configs, reboot_required diff --git a/ironic/tests/unit/drivers/modules/redfish/test_raid.py b/ironic/tests/unit/drivers/modules/redfish/test_raid.py index dfb3c1473..843be735c 100644 --- a/ironic/tests/unit/drivers/modules/redfish/test_raid.py +++ b/ironic/tests/unit/drivers/modules/redfish/test_raid.py @@ -336,6 +336,8 @@ class RedfishRAIDTestCase(db_base.DbTestCase): self.assertEqual(mock_node_power_action.call_count, 0) self.assertEqual(mock_build_agent_options.call_count, 0) self.assertEqual(mock_prepare_ramdisk.call_count, 0) + self.assertIsNone( + task.node.driver_internal_info.get('raid_configs')) self.assertEqual( [{'controller': 'RAID controller 1', 'id': '1', @@ -1066,6 +1068,8 @@ class RedfishRAIDTestCase(db_base.DbTestCase): self.assertEqual(mock_node_power_action.call_count, 0) self.assertEqual(mock_build_agent_options.call_count, 0) self.assertEqual(mock_prepare_ramdisk.call_count, 0) + self.assertIsNone( + task.node.driver_internal_info.get('raid_configs')) self.assertEqual([], task.node.raid_config['logical_disks']) self.assertNotEqual( last_updated, task.node.raid_config['last_updated']) diff --git a/releasenotes/notes/fix-nonetype-object-is-not-iterable-0592926d890d6c11.yaml b/releasenotes/notes/fix-nonetype-object-is-not-iterable-0592926d890d6c11.yaml new file mode 100644 index 000000000..ec9043adb --- /dev/null +++ b/releasenotes/notes/fix-nonetype-object-is-not-iterable-0592926d890d6c11.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Fixes ``'NoneType' object is not iterable`` in conductor logs for + ``redfish`` and ``idrac-redfish`` RAID clean and deploy steps. The message + should no longer appear. For affected nodes re-create the node or delete + ``raid_configs`` entry from ``driver_internal_info`` field. |