]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix client side versions in dhcp rpc API
authorRussell Bryant <rbryant@redhat.com>
Fri, 7 Nov 2014 14:31:15 +0000 (15:31 +0100)
committerRussell Bryant <rbryant@redhat.com>
Mon, 17 Nov 2014 15:03:00 +0000 (10:03 -0500)
The dhcp rpc API has two version (1.0 and 1.1).  The proper way to use
versioning for this is to only specify '1.1' from the client side when
you require that the remote side implements at least version '1.1' for
the method to work.  Otherwise, '1.0' should still be specified.  The
previous code specified '1.1' always.

Related to blueprint drop-rpc-compat.

Change-Id: I9468f8f67d80c5d064137f917fc04f9335a3ed55

neutron/agent/dhcp_agent.py
neutron/tests/unit/test_dhcp_agent.py

index 2c24d3db6091964aad1514ec47552b3c489ef034..774e85b6c7109139fce2ade954fb61f148130cf0 100644 (file)
@@ -413,12 +413,12 @@ class DhcpPluginApi(object):
         self.context = context
         self.host = cfg.CONF.host
         self.use_namespaces = use_namespaces
-        target = messaging.Target(topic=topic, version='1.1')
+        target = messaging.Target(topic=topic, version='1.0')
         self.client = n_rpc.get_client(target)
 
     def get_active_networks_info(self):
         """Make a remote process call to retrieve all network info."""
-        cctxt = self.client.prepare()
+        cctxt = self.client.prepare(version='1.1')
         networks = cctxt.call(self.context, 'get_active_networks_info',
                               host=self.host)
         return [dhcp.NetModel(self.use_namespaces, n) for n in networks]
@@ -442,7 +442,7 @@ class DhcpPluginApi(object):
 
     def create_dhcp_port(self, port):
         """Make a remote process call to create the dhcp port."""
-        cctxt = self.client.prepare()
+        cctxt = self.client.prepare(version='1.1')
         port = cctxt.call(self.context, 'create_dhcp_port',
                           port=port, host=self.host)
         if port:
@@ -450,7 +450,7 @@ class DhcpPluginApi(object):
 
     def update_dhcp_port(self, port_id, port):
         """Make a remote process call to update the dhcp port."""
-        cctxt = self.client.prepare()
+        cctxt = self.client.prepare(version='1.1')
         port = cctxt.call(self.context, 'update_dhcp_port',
                           port_id=port_id, port=port, host=self.host)
         if port:
index 4c8394510e39e7e4efea97f8e19f227b11b48cf0..f876bad9f0cee3df2e63a4c4cde080d7ac7070e4 100644 (file)
@@ -957,7 +957,7 @@ class TestDhcpPluginApiProxy(base.BaseTestCase):
             rpc_mock.assert_called_once_with(ctxt, method, **kwargs)
 
     def test_get_active_networks_info(self):
-        self._test_dhcp_api('get_active_networks_info')
+        self._test_dhcp_api('get_active_networks_info', version='1.1')
 
     def test_get_network_info(self):
         self._test_dhcp_api('get_network_info', network_id='fake_id',
@@ -969,11 +969,11 @@ class TestDhcpPluginApiProxy(base.BaseTestCase):
 
     def test_create_dhcp_port(self):
         self._test_dhcp_api('create_dhcp_port', port='fake_port',
-                            return_value=None)
+                            return_value=None, version='1.1')
 
     def test_update_dhcp_port(self):
         self._test_dhcp_api('update_dhcp_port', port_id='fake_id',
-                            port='fake_port', return_value=None)
+                            port='fake_port', return_value=None, version='1.1')
 
     def test_release_dhcp_port(self):
         self._test_dhcp_api('release_dhcp_port', network_id='fake_id',