]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Remove useless parameter from l3_dvr_db.py
authoryangxurong <yangxurong@huawei.com>
Fri, 19 Dec 2014 08:33:42 +0000 (16:33 +0800)
committeryangxurong <yangxurong@huawei.com>
Wed, 24 Dec 2014 02:25:54 +0000 (10:25 +0800)
clear_unused_fip_agent_gw_port and check_fips_availability_on_host
functions in l3_dvr_db.py contain a useless parameter fip_id which
can be removed.

Change-Id: Ibc14f9d9cd4b35a5f3b8d1a733d2ef40743e8077

neutron/db/l3_dvr_db.py
neutron/tests/unit/db/test_l3_dvr_db.py

index 5866fd90c87bdc919a99a29588e9b6c9e2f9bfa4..6ff1e8d33d38388e8304630de12209c6c98925d6 100644 (file)
@@ -168,11 +168,11 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
                             res_fip.get('fixed_port_id'))
         if unused_agent_port:
             self.clear_unused_fip_agent_gw_port(
-                admin_ctx, floatingip, fip['id'])
+                admin_ctx, floatingip)
         return res_fip
 
     def clear_unused_fip_agent_gw_port(
-            self, context, floatingip_db, fip_id):
+            self, context, floatingip_db):
         """Helper function to check for fip agent gw port and delete.
 
         This function checks on compute nodes to make sure if there
@@ -184,7 +184,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
         fip_hostid = self.get_vm_port_hostid(
             context, floatingip_db['fixed_port_id'])
         if fip_hostid and self.check_fips_availability_on_host(
-            context, fip_id, fip_hostid):
+            context, fip_hostid):
             LOG.debug('Deleting the Agent GW Port on host: %s', fip_hostid)
             self.delete_floatingip_agent_gateway_port(context, fip_hostid)
 
@@ -193,7 +193,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
         if floatingip['fixed_port_id']:
             admin_ctx = context.elevated()
             self.clear_unused_fip_agent_gw_port(
-                admin_ctx, floatingip, id)
+                admin_ctx, floatingip)
         super(L3_NAT_with_dvr_db_mixin,
               self).delete_floatingip(context, id)
 
@@ -211,7 +211,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
             if fip:
                 admin_ctx = context.elevated()
                 self.clear_unused_fip_agent_gw_port(
-                    admin_ctx, fip, id)
+                    admin_ctx, fip)
         return super(L3_NAT_with_dvr_db_mixin,
                      self).disassociate_floatingips(context,
                                                     port_id,
@@ -409,7 +409,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin,
         if ports:
             return ports[0]
 
-    def check_fips_availability_on_host(self, context, fip_id, host_id):
+    def check_fips_availability_on_host(self, context, host_id):
         """Query all floating_ips and filter by particular host."""
         fip_count_on_host = 0
         with context.session.begin(subtransactions=True):
index 2fd04ac28d2ef71f650a4bc1c0fabac91c49cca8..e6a2d8fc37438e88cb70047d07f56215fb99fe3a 100644 (file)
@@ -185,7 +185,6 @@ class L3DvrTestCase(testlib_api.SqlTestCase):
             'fixed_port_id': _uuid(),
             'floating_network_id': _uuid()
         }
-        fip_id = floatingip['id']
         with contextlib.nested(
             mock.patch.object(l3_dvr_db.l3_db.L3_NAT_db_mixin,
                               '_get_floatingip'),
@@ -200,7 +199,7 @@ class L3DvrTestCase(testlib_api.SqlTestCase):
             gvm.return_value = 'my-host'
             cfips.return_value = True
             self.mixin.clear_unused_fip_agent_gw_port(
-                self.ctx, floatingip, fip_id)
+                self.ctx, floatingip)
             self.assertTrue(dfips.called)
             self.assertTrue(cfips.called)
             self.assertTrue(gvm.called)