]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Removed release_port_fixed_ip dead code
authorIhar Hrachyshka <ihrachys@redhat.com>
Wed, 7 Oct 2015 13:05:40 +0000 (15:05 +0200)
committerIhar Hrachyshka <ihrachys@redhat.com>
Thu, 8 Oct 2015 12:03:11 +0000 (14:03 +0200)
It's not used since I822cc4a92cb05cdef88679bb628fad4e5063cddd.

Closes-Bug: #1212520
Change-Id: I1bb0755fa1379f3dad4241e7ae8d50c4c842d89e

neutron/agent/dhcp/agent.py
neutron/api/rpc/handlers/dhcp_rpc.py
neutron/tests/unit/agent/dhcp/test_agent.py
neutron/tests/unit/api/rpc/handlers/test_dhcp_rpc.py

index f077d4fe129dc57d25399ed27e192639575c23e8..dead17f489160aaf8b86293e41258546780b21ce 100644 (file)
@@ -452,13 +452,6 @@ class DhcpPluginApi(object):
                           network_id=network_id, device_id=device_id,
                           host=self.host)
 
-    def release_port_fixed_ip(self, network_id, device_id, subnet_id):
-        """Make a remote process call to release a fixed_ip on the port."""
-        cctxt = self.client.prepare()
-        return cctxt.call(self.context, 'release_port_fixed_ip',
-                          network_id=network_id, subnet_id=subnet_id,
-                          device_id=device_id, host=self.host)
-
 
 class NetworkCache(object):
     """Agent cache of the current network state."""
index 9eb23f8eb790f6d05bb11eaa756ec76f026ad91b..d7388e9e0d8b4cd7574bba9a940ab908a564f7ed 100644 (file)
@@ -56,9 +56,12 @@ class DhcpRpcCallback(object):
     #           RPC client for many releases, it should be OK to bump the
     #           minor release instead and claim RPC compatibility with the
     #           last few client versions.
+    #     1.3 - Removed release_port_fixed_ip. It's not used by reference DHCP
+    #           agent since Juno, so similar rationale for not bumping the
+    #           major version as above applies here too.
     target = oslo_messaging.Target(
         namespace=constants.RPC_NAMESPACE_DHCP_PLUGIN,
-        version='1.2')
+        version='1.3')
 
     def _get_active_networks(self, context, **kwargs):
         """Retrieve and return a list of the active networks."""
@@ -173,31 +176,6 @@ class DhcpRpcCallback(object):
         plugin = manager.NeutronManager.get_plugin()
         plugin.delete_ports_by_device_id(context, device_id, network_id)
 
-    @db_api.retry_db_errors
-    def release_port_fixed_ip(self, context, **kwargs):
-        """Release the fixed_ip associated the subnet on a port."""
-        host = kwargs.get('host')
-        network_id = kwargs.get('network_id')
-        device_id = kwargs.get('device_id')
-        subnet_id = kwargs.get('subnet_id')
-
-        LOG.debug('DHCP port remove fixed_ip for %(subnet_id)s request '
-                  'from %(host)s',
-                  {'subnet_id': subnet_id, 'host': host})
-        plugin = manager.NeutronManager.get_plugin()
-        filters = dict(network_id=[network_id], device_id=[device_id])
-        ports = plugin.get_ports(context, filters=filters)
-
-        if ports:
-            port = ports[0]
-
-            fixed_ips = port.get('fixed_ips', [])
-            for i in range(len(fixed_ips)):
-                if fixed_ips[i]['subnet_id'] == subnet_id:
-                    del fixed_ips[i]
-                    break
-            plugin.update_port(context, port['id'], dict(port=port))
-
     def update_lease_expiration(self, context, **kwargs):
         """Release the fixed_ip associated the subnet on a port."""
         # NOTE(arosen): This method is no longer used by the DHCP agent but is
index 89ff045f553fda1e2c3f2c2bbdc637f1a7cb54e4..fb7355f149ed253304811d5b6a13f44fe63468a7 100644 (file)
@@ -1031,10 +1031,6 @@ class TestDhcpPluginApiProxy(base.BaseTestCase):
         self._test_dhcp_api('release_dhcp_port', network_id='fake_id',
                             device_id='fake_id_2')
 
-    def test_release_port_fixed_ip(self):
-        self._test_dhcp_api('release_port_fixed_ip', network_id='fake_id',
-                            device_id='fake_id_2', subnet_id='fake_id_3')
-
 
 class TestNetworkCache(base.BaseTestCase):
     def test_put_network(self):
index d57632139f6ecf253eafbda7ae0849e8d94066e0..0f42bfc7ddd553c307a274254eff3ada62a362db 100644 (file)
@@ -211,17 +211,3 @@ class TestDhcpRpcCallback(base.BaseTestCase):
 
         self.plugin.assert_has_calls([
             mock.call.delete_ports_by_device_id(mock.ANY, 'devid', 'netid')])
-
-    def test_release_port_fixed_ip(self):
-        port_retval = dict(id='port_id', fixed_ips=[dict(subnet_id='a')])
-        port_update = dict(id='port_id', fixed_ips=[])
-        self.plugin.get_ports.return_value = [port_retval]
-
-        self.callbacks.release_port_fixed_ip(mock.ANY, network_id='netid',
-                                             device_id='devid', subnet_id='a')
-
-        self.plugin.assert_has_calls([
-            mock.call.get_ports(mock.ANY, filters=dict(network_id=['netid'],
-                                                       device_id=['devid'])),
-            mock.call.update_port(mock.ANY, 'port_id',
-                                  dict(port=port_update))])