From 9377d00ccf7a73071b4fb75d66ce5ad7bd321174 Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Tue, 22 Oct 2019 17:10:19 -0400 Subject: [PATCH] Revert "Log CellTimeout traceback in scatter_gather_cells" This reverts commit 0436a95f37df086ddc99017376cb9a312e40517a. This was meant to get us more debug details when hitting the failure but the results are not helpful [1] so revert this and the fix for the resulting regression [2]. [1] http://paste.openstack.org/show/782116/ [2] I7f9edc9a4b4930f4dce98df271888fa8082a1701 Change-Id: Iab8029f081a654278ea7dbbec79a766aea6764ae Related-Bug: #1844929 --- nova/context.py | 5 +++-- nova/tests/unit/test_context.py | 34 +-------------------------------- 2 files changed, 4 insertions(+), 35 deletions(-) diff --git a/nova/context.py b/nova/context.py index a3b9dc8b79e5..76c0086f6344 100644 --- a/nova/context.py +++ b/nova/context.py @@ -445,14 +445,15 @@ def scatter_gather_cells(context, cell_mappings, timeout, fn, *args, **kwargs): except exception.CellTimeout: # NOTE(melwitt): We'll fill in did_not_respond_sentinels at the # same time we kill/wait for the green threads. - LOG.warning('Timed out waiting for response from cell', - exc_info=True) + pass # Kill the green threads still pending and wait on those we know are done. for cell_uuid, greenthread in greenthreads: if cell_uuid not in results: greenthread.kill() results[cell_uuid] = did_not_respond_sentinel + LOG.warning('Timed out waiting for response from cell %s', + cell_uuid) else: greenthread.wait() diff --git a/nova/tests/unit/test_context.py b/nova/tests/unit/test_context.py index 2bc8d1aee172..1481714695c0 100644 --- a/nova/tests/unit/test_context.py +++ b/nova/tests/unit/test_context.py @@ -385,45 +385,13 @@ class ContextTestCase(test.NoDBTestCase): exception.CellTimeout()] results = context.scatter_gather_cells( - ctxt, mappings, 30, objects.InstanceList.get_by_filters, {}) + ctxt, mappings, 30, objects.InstanceList.get_by_filters) self.assertEqual(2, len(results)) self.assertIn(mock.sentinel.instances, results.values()) self.assertIn(context.did_not_respond_sentinel, results.values()) mock_timeout.assert_called_once_with(30, exception.CellTimeout) self.assertTrue(mock_log_warning.called) - @mock.patch('nova.context.LOG.warning') - @mock.patch('eventlet.timeout.Timeout') - @mock.patch('eventlet.queue.LightQueue.get') - @mock.patch('nova.objects.InstanceList.get_by_filters') - def test_scatter_gather_cells_all_timeout(self, mock_get_inst, - mock_get_result, mock_timeout, - mock_log_warning): - """This is a regression test for bug 1847131. - test_scatter_gather_cells_timeout did not catch the issue because it - yields a result which sets the cell_uuid variable in scope before the - CellTimeout is processed and logged. In this test we only raise the - CellTimeout so cell_uuid will not be in scope for the log message. - """ - # This is needed because we're mocking get_by_filters. - self.useFixture(nova_fixtures.SpawnIsSynchronousFixture()) - ctxt = context.get_context() - mapping0 = objects.CellMapping(database_connection='fake://db0', - transport_url='none:///', - uuid=objects.CellMapping.CELL0_UUID) - mappings = objects.CellMappingList(objects=[mapping0]) - - # Simulate cell0 not responding. - mock_get_result.side_effect = exception.CellTimeout() - - results = context.scatter_gather_cells( - ctxt, mappings, 30, objects.InstanceList.get_by_filters, {}) - self.assertEqual(1, len(results)) - self.assertIn(context.did_not_respond_sentinel, results.values()) - mock_timeout.assert_called_once_with(30, exception.CellTimeout) - mock_log_warning.assert_called_once_with( - 'Timed out waiting for response from cell', exc_info=True) - @mock.patch('nova.context.LOG.exception') @mock.patch('nova.objects.InstanceList.get_by_filters') def test_scatter_gather_cells_exception(self, mock_get_inst,