Merge "Silence modprobe loading errors for IPMI drivers"
This commit is contained in:
@@ -129,9 +129,14 @@ def _load_ipmi_modules():
|
|||||||
This is required to be called at least once before attempting to use
|
This is required to be called at least once before attempting to use
|
||||||
ipmitool or related tools.
|
ipmitool or related tools.
|
||||||
"""
|
"""
|
||||||
utils.try_execute('modprobe', 'ipmi_msghandler')
|
|
||||||
utils.try_execute('modprobe', 'ipmi_devintf')
|
ipmi_drivers = ['ipmi_msghandler', 'ipmi_devintf', 'ipmi_si']
|
||||||
utils.try_execute('modprobe', 'ipmi_si')
|
for ipmi_driver in ipmi_drivers:
|
||||||
|
try:
|
||||||
|
processutils.execute('modprobe', ipmi_driver)
|
||||||
|
except (processutils.ProcessExecutionError, OSError):
|
||||||
|
LOG.debug("IPMI driver %s not supported or not present",
|
||||||
|
ipmi_driver)
|
||||||
|
|
||||||
|
|
||||||
def _load_multipath_modules():
|
def _load_multipath_modules():
|
||||||
|
@@ -5928,14 +5928,30 @@ class TestModuleFunctions(base.IronicAgentTest):
|
|||||||
mocked_execute.assert_has_calls([
|
mocked_execute.assert_has_calls([
|
||||||
mock.call('iscsistart', '-f')])
|
mock.call('iscsistart', '-f')])
|
||||||
|
|
||||||
@mock.patch.object(utils, 'try_execute', autospec=True)
|
@mock.patch.object(processutils, 'execute', autospec=True)
|
||||||
def test__load_ipmi_modules(self, mocked_try_execute, me):
|
def test__load_ipmi_modules(self, mocked_proc_execute, mocked_execute):
|
||||||
hardware._load_ipmi_modules()
|
hardware._load_ipmi_modules()
|
||||||
mocked_try_execute.assert_has_calls([
|
mocked_proc_execute.assert_has_calls([
|
||||||
mock.call('modprobe', 'ipmi_msghandler'),
|
mock.call('modprobe', 'ipmi_msghandler'),
|
||||||
mock.call('modprobe', 'ipmi_devintf'),
|
mock.call('modprobe', 'ipmi_devintf'),
|
||||||
mock.call('modprobe', 'ipmi_si')])
|
mock.call('modprobe', 'ipmi_si')])
|
||||||
|
|
||||||
|
@mock.patch.object(hardware, 'LOG', autospec=True)
|
||||||
|
@mock.patch.object(processutils, 'execute', autospec=True)
|
||||||
|
def test__load_ipmi_modules_fail(self, mocked_proc_execute, mocked_log,
|
||||||
|
mocked_execute):
|
||||||
|
mocked_proc_execute.side_effect = [
|
||||||
|
processutils.ProcessExecutionError,
|
||||||
|
('', ''),
|
||||||
|
('', ''),
|
||||||
|
]
|
||||||
|
hardware._load_ipmi_modules()
|
||||||
|
mocked_proc_execute.assert_has_calls([
|
||||||
|
mock.call('modprobe', 'ipmi_msghandler'),
|
||||||
|
mock.call('modprobe', 'ipmi_devintf'),
|
||||||
|
mock.call('modprobe', 'ipmi_si')])
|
||||||
|
mocked_log.debug.assert_called_once()
|
||||||
|
|
||||||
|
|
||||||
@mock.patch.object(utils, 'execute', autospec=True)
|
@mock.patch.object(utils, 'execute', autospec=True)
|
||||||
class TestMultipathEnabled(base.IronicAgentTest):
|
class TestMultipathEnabled(base.IronicAgentTest):
|
||||||
|
Reference in New Issue
Block a user