Skip to content

Commit

Permalink
Fix "'NoneType' object is not iterable" in RAID
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Aija Jauntēva committed Dec 16, 2022
1 parent 4d66609 commit 17c9e58
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
8 changes: 6 additions & 2 deletions ironic/drivers/modules/redfish/raid.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,9 @@ def _submit_create_configuration(self, task, ld_grouped):
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

Expand Down Expand Up @@ -1182,7 +1184,9 @@ def _submit_delete_configuration(self, task):
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

Expand Down
4 changes: 4 additions & 0 deletions ironic/tests/unit/drivers/modules/redfish/test_raid.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ def test_create_config_case_1b_apply_time_immediate(
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',
Expand Down Expand Up @@ -1066,6 +1068,8 @@ def test_delete_config_immediate(
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'])
Expand Down
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 17c9e58

Please sign in to comment.