From 06986e73597090fb50088aada7978c0c48e82a7d Mon Sep 17 00:00:00 2001 From: Boden R Date: Tue, 10 Apr 2018 15:19:51 -0600 Subject: [PATCH] use rpc Connection rather than create_connection The create_connection function in neutron.common.rpc is just an alias to Connection. This patch switches to the later so we can remove the former in: https://review.openstack.org/#/c/560130 Change-Id: If68f13287b7c2aedb5ef6e4bafcafc929f90789d --- vmware_nsx/dhcp_meta/modes.py | 2 +- vmware_nsx/plugins/nsx_v/plugin.py | 2 +- vmware_nsx/plugins/nsx_v3/plugin.py | 2 +- vmware_nsx/tests/unit/nsx_mh/test_opts.py | 4 ++-- vmware_nsx/tests/unit/nsx_mh/test_sync.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/vmware_nsx/dhcp_meta/modes.py b/vmware_nsx/dhcp_meta/modes.py index 698a7cf05d..a1b7546f37 100644 --- a/vmware_nsx/dhcp_meta/modes.py +++ b/vmware_nsx/dhcp_meta/modes.py @@ -84,7 +84,7 @@ class DhcpMetadataAccess(object): def _setup_rpc_dhcp_metadata(self, notifier=None): self.topic = topics.PLUGIN - self.conn = n_rpc.create_connection() + self.conn = n_rpc.Connection() self.endpoints = [SynchronizedDhcpRpcCallback(), agents_db.AgentExtRpcCallback(), metadata_rpc.MetadataRpcCallback()] diff --git a/vmware_nsx/plugins/nsx_v/plugin.py b/vmware_nsx/plugins/nsx_v/plugin.py index fe29a9ba12..03c841652e 100644 --- a/vmware_nsx/plugins/nsx_v/plugin.py +++ b/vmware_nsx/plugins/nsx_v/plugin.py @@ -423,7 +423,7 @@ class NsxVPluginV2(addr_pair_db.AllowedAddressPairsMixin, self.endpoints = [agents_db.AgentExtRpcCallback()] self.topic = topics.PLUGIN - self.conn = n_rpc.create_connection() + self.conn = n_rpc.Connection() self.conn.create_consumer(self.topic, self.endpoints, fanout=False) self.start_rpc_listeners_called = True diff --git a/vmware_nsx/plugins/nsx_v3/plugin.py b/vmware_nsx/plugins/nsx_v3/plugin.py index 8ca9da4a91..9f5a3223fa 100644 --- a/vmware_nsx/plugins/nsx_v3/plugin.py +++ b/vmware_nsx/plugins/nsx_v3/plugin.py @@ -794,7 +794,7 @@ class NsxV3Plugin(agentschedulers_db.AZDhcpAgentSchedulerDbMixin, self._setup_rpc() self.topic = topics.PLUGIN - self.conn = n_rpc.create_connection() + self.conn = n_rpc.Connection() self.conn.create_consumer(self.topic, self.endpoints, fanout=False) self.conn.create_consumer(topics.REPORTS, [agents_db.AgentExtRpcCallback()], diff --git a/vmware_nsx/tests/unit/nsx_mh/test_opts.py b/vmware_nsx/tests/unit/nsx_mh/test_opts.py index 595be8c6b3..184efa9632 100644 --- a/vmware_nsx/tests/unit/nsx_mh/test_opts.py +++ b/vmware_nsx/tests/unit/nsx_mh/test_opts.py @@ -92,7 +92,7 @@ class ConfigurationTest(base.BaseTestCase): self.assertEqual('whatever', cluster.nsx_default_interface_name) def _get_mh_plugin(self): - with mock.patch("neutron.common.rpc.create_connection"): + with mock.patch("neutron.common.rpc.Connection"): plugin = mh_plugin.NsxPlugin() return plugin @@ -249,7 +249,7 @@ class OldNVPConfigurationTest(base.BaseTestCase): self.config_parse(args=['--config-file', BASE_CONF_PATH, '--config-file', NVP_INI_DEPR_PATH]) cfg.CONF.set_override('core_plugin', vmware.PLUGIN_NAME) - with mock.patch("neutron.common.rpc.create_connection"): + with mock.patch("neutron.common.rpc.Connection"): plugin = mh_plugin.NsxPlugin() cluster = plugin.cluster # Verify old nvp_* params have been fully parsed diff --git a/vmware_nsx/tests/unit/nsx_mh/test_sync.py b/vmware_nsx/tests/unit/nsx_mh/test_sync.py index 8ca33a29c1..c445afeef0 100644 --- a/vmware_nsx/tests/unit/nsx_mh/test_sync.py +++ b/vmware_nsx/tests/unit/nsx_mh/test_sync.py @@ -295,7 +295,7 @@ class SyncTestCase(testlib_api.SqlTestCase): self.config_parse(args=args) cfg.CONF.set_override('allow_overlapping_ips', True) - with mock.patch("neutron.common.rpc.create_connection"): + with mock.patch("neutron.common.rpc.Connection"): self._plugin = plugin.NsxPlugin() mock_nm_get_plugin = mock.patch(