From dcd7a30c9548512eaee91b96d0ed0f4b18bcdbff Mon Sep 17 00:00:00 2001 From: ZhangShuaiyi Date: Sat, 22 Dec 2018 16:33:26 +0800 Subject: [PATCH] Send context.global_id on neutron calls In I866b8c6593c76c089da6bed55cf863ac556c9a8e nova sends global_id on neutron calls, but in I41724a612a5f3eabd504f3eaa9d2f9d141ca3f69 it changed to global_request_id which may be None. A simple unit test wrinkle is added to avoid future regressions. Closes-Bug:#1809943 Change-Id: Iaa47304755db66a834dde38dcd55cc259c1008a3 (cherry picked from commit a31157c527ae88af2e8c283e8b5156e9ace55dfa) (cherry picked from commit 6e1120ae3025a532ff8957a6952f445152a69967) --- nova/network/neutronv2/api.py | 2 +- nova/tests/unit/network/test_neutronv2.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/nova/network/neutronv2/api.py b/nova/network/neutronv2/api.py index 4692293cae40..85ee0f8b8a88 100644 --- a/nova/network/neutronv2/api.py +++ b/nova/network/neutronv2/api.py @@ -163,7 +163,7 @@ def get_client(context, admin=False): client_args = dict(session=_SESSION, auth=auth_plugin, - global_request_id=context.global_request_id) + global_request_id=context.global_id) if CONF.neutron.url: # TODO(efried): Remove in Rocky diff --git a/nova/tests/unit/network/test_neutronv2.py b/nova/tests/unit/network/test_neutronv2.py index 30bc659749d9..526f5c445f5a 100644 --- a/nova/tests/unit/network/test_neutronv2.py +++ b/nova/tests/unit/network/test_neutronv2.py @@ -135,6 +135,9 @@ class TestNeutronClient(test.NoDBTestCase): self.assertEqual(['internal', 'public'], cl.httpclient.interface) self.assertIsNone(cl.httpclient.region_name) self.assertIsNone(cl.httpclient.endpoint_override) + self.assertIsNotNone(cl.httpclient.global_request_id) + self.assertEqual(my_context.global_id, + cl.httpclient.global_request_id) def test_ksa_adapter_loading(self): """Test ksa loading path with specified values."""