Do not send sensors data for nodes in maintenance mode
If maintenance mode for a node set due to BMC failures or for firmware upgrading IPMI command for getting sensor data can causes unpredictable result. Co-Authored-By: Dmitry Tantsur <dtantsur@redhat.com> Change-Id: I15b1aee130a2d56c315a6d97e72a60d38279e4fe Closes-Bug: 1652741
This commit is contained in:
parent
76945299a8
commit
21ef50e898
@ -2188,6 +2188,13 @@ class ConductorManager(base_manager.BaseConductorManager):
|
||||
purpose=lock_purpose) as task:
|
||||
if not getattr(task.driver, 'management', None):
|
||||
continue
|
||||
|
||||
if task.node.maintenance:
|
||||
LOG.debug('Skipping sending sensors data for node '
|
||||
'%s as it is in maintenance mode',
|
||||
task.node.uuid)
|
||||
continue
|
||||
|
||||
task.driver.management.validate(task)
|
||||
sensors_data = task.driver.management.get_sensors_data(
|
||||
task)
|
||||
|
@ -3601,7 +3601,9 @@ class UpdatePortTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
self._start_service()
|
||||
CONF.set_override('send_sensor_data', True, group='conductor')
|
||||
|
||||
acquire_mock.return_value.__enter__.return_value.driver = self.driver
|
||||
task = acquire_mock.return_value.__enter__.return_value
|
||||
task.driver = self.driver
|
||||
task.node.maintenance = False
|
||||
with mock.patch.object(self.driver.management,
|
||||
'get_sensors_data') as get_sensors_data_mock:
|
||||
with mock.patch.object(self.driver.management,
|
||||
@ -3632,7 +3634,9 @@ class UpdatePortTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
self._start_service()
|
||||
|
||||
self.driver.management = None
|
||||
acquire_mock.return_value.__enter__.return_value.driver = self.driver
|
||||
task = acquire_mock.return_value.__enter__.return_value
|
||||
task.driver = self.driver
|
||||
task.node.maintenance = False
|
||||
|
||||
with mock.patch.object(fake.FakeManagement, 'get_sensors_data',
|
||||
autospec=True) as get_sensors_data_mock:
|
||||
@ -3644,6 +3648,27 @@ class UpdatePortTestCase(mgr_utils.ServiceSetUpMixin, db_base.DbTestCase):
|
||||
self.assertFalse(get_sensors_data_mock.called)
|
||||
self.assertFalse(validate_mock.called)
|
||||
|
||||
@mock.patch.object(manager.LOG, 'debug', autospec=True)
|
||||
@mock.patch.object(task_manager, 'acquire', autospec=True)
|
||||
def test_send_sensor_task_maintenance(self, acquire_mock, debug_log):
|
||||
nodes = queue.Queue()
|
||||
nodes.put_nowait(('fake_uuid', 'fake', None))
|
||||
self._start_service()
|
||||
CONF.set_override('send_sensor_data', True, group='conductor')
|
||||
|
||||
task = acquire_mock.return_value.__enter__.return_value
|
||||
task.driver = self.driver
|
||||
task.node.maintenance = True
|
||||
with mock.patch.object(self.driver.management,
|
||||
'get_sensors_data') as get_sensors_data_mock:
|
||||
with mock.patch.object(self.driver.management,
|
||||
'validate') as validate_mock:
|
||||
self.service._sensors_nodes_task(self.context, nodes)
|
||||
self.assertTrue(acquire_mock.called)
|
||||
self.assertFalse(validate_mock.called)
|
||||
self.assertFalse(get_sensors_data_mock.called)
|
||||
self.assertTrue(debug_log.called)
|
||||
|
||||
@mock.patch.object(manager.ConductorManager, '_spawn_worker')
|
||||
@mock.patch.object(manager.ConductorManager, '_mapped_to_this_conductor')
|
||||
@mock.patch.object(dbapi.IMPL, 'get_nodeinfo_list')
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
fixes:
|
||||
- No longer tries to collect or report sensors data for nodes in maintenance
|
||||
mode. See `bug 1652741 <https://bugs.launchpad.net/bugs/1652741>`_.
|
Loading…
Reference in New Issue
Block a user