diff --git a/ironic/drivers/modules/ilo/raid.py b/ironic/drivers/modules/ilo/raid.py index 07d6951331..697b4a3736 100644 --- a/ironic/drivers/modules/ilo/raid.py +++ b/ironic/drivers/modules/ilo/raid.py @@ -127,6 +127,8 @@ class Ilo5RAID(base.RAIDInterface): create_nonroot_volumes=create_nonroot_volumes) driver_internal_info = node.driver_internal_info driver_internal_info['target_raid_config'] = target_raid_config + node.driver_internal_info = driver_internal_info + node.save() LOG.debug("Calling OOB RAID create_configuration for node %(node)s " "with the following target RAID configuration: %(target)s", {'node': node.uuid, 'target': target_raid_config}) @@ -149,17 +151,13 @@ class Ilo5RAID(base.RAIDInterface): {'uuid': node.uuid}) self._pop_driver_internal_values( task, 'ilo_raid_create_in_progress', - 'cleaning_reboot', 'skip_current_clean_step') - node.driver_internal_info = driver_internal_info - node.save() + 'skip_current_clean_step') else: # Raid configuration failed msg = "Unable to create raid" self._pop_driver_internal_values( task, 'ilo_raid_create_in_progress', - 'cleaning_reboot', 'skip_current_clean_step') - node.driver_internal_info = driver_internal_info - node.save() + 'skip_current_clean_step') raise exception.NodeCleaningFailure( "Clean step create_configuration failed " "on node %(node)s with error: %(err)s" % @@ -169,10 +167,7 @@ class Ilo5RAID(base.RAIDInterface): % node.uuid) self._pop_driver_internal_values(task, 'ilo_raid_create_in_progress', - 'cleaning_reboot', 'skip_current_clean_step') - node.driver_internal_info = driver_internal_info - node.save() self._set_clean_failed(task, operation, ilo_exception) @METRICS.timer('Ilo5RAID.delete_configuration') @@ -204,18 +199,14 @@ class Ilo5RAID(base.RAIDInterface): {'uuid': node.uuid}) self._pop_driver_internal_values( task, 'ilo_raid_delete_in_progress', - 'cleaning_reboot', 'skip_current_clean_step') - node.driver_internal_info = driver_internal_info - node.save() + 'skip_current_clean_step') else: # Raid configuration failed msg = ("Unable to delete this logical disks: %s" % raid_conf['logical_disks']) self._pop_driver_internal_values( task, 'ilo_raid_delete_in_progress', - 'cleaning_reboot', 'skip_current_clean_step') - node.driver_internal_info = driver_internal_info - node.save() + 'skip_current_clean_step') raise exception.NodeCleaningFailure( "Clean step delete_configuration failed " "on node %(node)s with error: %(err)s" % @@ -228,8 +219,5 @@ class Ilo5RAID(base.RAIDInterface): % node.uuid) self._pop_driver_internal_values(task, 'ilo_raid_delete_in_progress', - 'cleaning_reboot', 'skip_current_clean_step') - node.driver_internal_info = driver_internal_info - node.save() self._set_clean_failed(task, operation, ilo_exception) diff --git a/ironic/tests/unit/drivers/modules/ilo/test_raid.py b/ironic/tests/unit/drivers/modules/ilo/test_raid.py index 34b859023d..05aebcc705 100644 --- a/ironic/tests/unit/drivers/modules/ilo/test_raid.py +++ b/ironic/tests/unit/drivers/modules/ilo/test_raid.py @@ -127,7 +127,10 @@ class Ilo5RAIDTestCase(db_base.DbTestCase): u'volume_name': u'0006EB7BPDVTF0BRH5L0EAEDDA'}] } ilo_mock_object = ilo_mock.return_value - self.node.driver_internal_info = {'ilo_raid_create_in_progress': True} + driver_internal_info = self.node.driver_internal_info + driver_internal_info['ilo_raid_create_in_progress'] = True + driver_internal_info['skip_current_clean_step'] = False + self.node.driver_internal_info = driver_internal_info self.node.save() with task_manager.acquire(self.context, self.node.uuid) as task: filter_target_raid_config_mock.return_value = ( @@ -137,8 +140,6 @@ class Ilo5RAIDTestCase(db_base.DbTestCase): update_raid_mock.assert_called_once_with(task.node, raid_conf) self.assertNotIn('ilo_raid_create_in_progress', task.node.driver_internal_info) - self.assertNotIn('cleaning_reboot', - task.node.driver_internal_info) self.assertNotIn('skip_current_clean_step', task.node.driver_internal_info) @@ -147,7 +148,10 @@ class Ilo5RAIDTestCase(db_base.DbTestCase): def test_create_configuration_with_read_raid_failed( self, ilo_mock, filter_target_raid_config_mock): raid_conf = {u'logical_disks': []} - self.node.driver_internal_info = {'ilo_raid_create_in_progress': True} + driver_internal_info = self.node.driver_internal_info + driver_internal_info['ilo_raid_create_in_progress'] = True + driver_internal_info['skip_current_clean_step'] = False + self.node.driver_internal_info = driver_internal_info self.node.save() ilo_mock_object = ilo_mock.return_value with task_manager.acquire(self.context, self.node.uuid) as task: @@ -158,8 +162,6 @@ class Ilo5RAIDTestCase(db_base.DbTestCase): task.driver.raid.create_configuration, task) self.assertNotIn('ilo_raid_create_in_progress', task.node.driver_internal_info) - self.assertNotIn('cleaning_reboot', - task.node.driver_internal_info) self.assertNotIn('skip_current_clean_step', task.node.driver_internal_info) @@ -287,7 +289,10 @@ class Ilo5RAIDTestCase(db_base.DbTestCase): @mock.patch.object(ilo_common, 'get_ilo_object', autospec=True) def test_delete_configuration_with_read_raid(self, ilo_mock): raid_conf = {u'logical_disks': []} - self.node.driver_internal_info = {'ilo_raid_delete_in_progress': True} + driver_internal_info = self.node.driver_internal_info + driver_internal_info['ilo_raid_delete_in_progress'] = True + driver_internal_info['skip_current_clean_step'] = False + self.node.driver_internal_info = driver_internal_info self.node.save() ilo_mock_object = ilo_mock.return_value with task_manager.acquire(self.context, self.node.uuid) as task: @@ -296,8 +301,6 @@ class Ilo5RAIDTestCase(db_base.DbTestCase): self.assertEqual(self.node.raid_config, {}) self.assertNotIn('ilo_raid_delete_in_progress', task.node.driver_internal_info) - self.assertNotIn('cleaning_reboot', - task.node.driver_internal_info) self.assertNotIn('skip_current_clean_step', task.node.driver_internal_info) @@ -306,7 +309,10 @@ class Ilo5RAIDTestCase(db_base.DbTestCase): raid_conf = {u'logical_disks': [{'size_gb': 200, 'raid_level': 0, 'is_root_volume': True}]} - self.node.driver_internal_info = {'ilo_raid_delete_in_progress': True} + driver_internal_info = self.node.driver_internal_info + driver_internal_info['ilo_raid_delete_in_progress'] = True + driver_internal_info['skip_current_clean_step'] = False + self.node.driver_internal_info = driver_internal_info self.node.save() ilo_mock_object = ilo_mock.return_value with task_manager.acquire(self.context, self.node.uuid) as task: @@ -315,8 +321,6 @@ class Ilo5RAIDTestCase(db_base.DbTestCase): task.driver.raid.delete_configuration, task) self.assertNotIn('ilo_raid_delete_in_progress', task.node.driver_internal_info) - self.assertNotIn('cleaning_reboot', - task.node.driver_internal_info) self.assertNotIn('skip_current_clean_step', task.node.driver_internal_info) diff --git a/releasenotes/notes/story-2006321-ilo5-raid-create-fails-1bb1e648da0db0f1.yaml b/releasenotes/notes/story-2006321-ilo5-raid-create-fails-1bb1e648da0db0f1.yaml new file mode 100644 index 0000000000..b2ff80e7f9 --- /dev/null +++ b/releasenotes/notes/story-2006321-ilo5-raid-create-fails-1bb1e648da0db0f1.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixes an issue in creation of RAID for ``ilo5`` RAID interface + wherein second time RAID creation fails. See `story 2006321 + `__ for details.