Merge "[iRMC] Avoid repeatedly resuming clean after creating raid configuration"
This commit is contained in:
commit
29313ae4d7
@ -483,6 +483,7 @@ class IRMCRAID(base.RAIDInterface):
|
||||
if all(fgi_status == 'Idle' for fgi_status in
|
||||
fgi_status_dict.values()):
|
||||
raid_config.update({'fgi_status': RAID_COMPLETED})
|
||||
raid_common.update_raid_info(node, raid_config)
|
||||
LOG.info('RAID configuration has completed on '
|
||||
'node %(node)s with fgi_status is %(fgi)s',
|
||||
{'node': node_uuid, 'fgi': RAID_COMPLETED})
|
||||
@ -506,5 +507,4 @@ class IRMCRAID(base.RAIDInterface):
|
||||
task.process_event('fail')
|
||||
|
||||
def _resume_cleaning(self, task):
|
||||
raid_common.update_raid_info(task.node, task.node.raid_config)
|
||||
manager_utils.notify_conductor_resume_clean(task)
|
||||
|
@ -308,3 +308,41 @@ class iRMCPeriodicTaskTestCase(test_common.BaseIRMCTest):
|
||||
clean_fail_mock.assert_called_once_with(mock.ANY,
|
||||
task, fgi_status_dict)
|
||||
clean_mock.assert_called_once_with(mock.ANY, task)
|
||||
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid.IRMCRAID._resume_cleaning',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid.IRMCRAID._set_clean_failed',
|
||||
autospec=True)
|
||||
@mock.patch('ironic.drivers.modules.irmc.raid._get_fgi_status',
|
||||
autospec=True)
|
||||
@mock.patch.object(irmc_common, 'get_irmc_report', autospec=True)
|
||||
@mock.patch.object(task_manager, 'acquire', autospec=True)
|
||||
def test__query_raid_config_fgi_status_avoid_repeatedly_resume_cleaning(
|
||||
self, mock_acquire, report_mock, fgi_mock, clean_fail_mock,
|
||||
clean_mock):
|
||||
mock_manager = mock.Mock()
|
||||
raid_config = self.raid_config
|
||||
fgi_mock.return_value = {'0': 'Idle', '1': 'Idle'}
|
||||
task = mock.Mock(node=self.node, driver=self.driver)
|
||||
mock_acquire.return_value = mock.MagicMock(
|
||||
__enter__=mock.MagicMock(return_value=task))
|
||||
task.node.raid_config = raid_config
|
||||
node_list = [(self.node.uuid, 'irmc', '', raid_config)]
|
||||
mock_manager.iter_nodes.return_value = node_list
|
||||
# Set provision state value
|
||||
task.node.provision_state = 'clean wait'
|
||||
task.node.save()
|
||||
task.driver.raid._query_raid_config_fgi_status(mock_manager,
|
||||
self.context)
|
||||
raid_config = task.node.raid_config
|
||||
node_list = [(self.node.uuid, 'irmc', '', raid_config)]
|
||||
mock_manager.iter_nodes.return_value = node_list
|
||||
task.node.provision_state = 'clean wait'
|
||||
task.node.save()
|
||||
task.driver.raid._query_raid_config_fgi_status(mock_manager,
|
||||
self.context)
|
||||
self.assertEqual(0, clean_fail_mock.call_count)
|
||||
report_mock.assert_called_once_with(task.node)
|
||||
fgi_mock.assert_called_once_with(report_mock.return_value,
|
||||
self.node.uuid)
|
||||
clean_mock.assert_called_once_with(mock.ANY, task)
|
||||
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fixed the bug of repeated resume cleaning due to the value of
|
||||
`fgi_status` not being updated correctly when obtaining the
|
||||
RAID configuration status of the node managed by the `irmc`
|
||||
hardware type.
|
Loading…
x
Reference in New Issue
Block a user