From f0d0d354a7d8faa5f8a5946b49aefbe56e4d8a1a Mon Sep 17 00:00:00 2001 From: Eugene Nikanorov Date: Wed, 16 Dec 2015 16:58:47 +0400 Subject: [PATCH] Remove unused parameter from _update_router_db method While gw_info is being passed to _update_router_db method of various classes it is never actually used, so this is just a cleanup. Change-Id: I311f6976c21fa07a7532c3d0bbe56b5e35a18f6e Closes-Bug: #1526785 --- neutron/db/l3_db.py | 4 ++-- neutron/db/l3_dvr_db.py | 8 ++++---- neutron/db/l3_hamode_db.py | 4 ++-- neutron/tests/unit/db/test_l3_dvr_db.py | 2 +- neutron/tests/unit/db/test_l3_hamode_db.py | 3 +-- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/neutron/db/l3_db.py b/neutron/db/l3_db.py index d27a62dc543..00758cd2b77 100644 --- a/neutron/db/l3_db.py +++ b/neutron/db/l3_db.py @@ -188,7 +188,7 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase): return self._make_router_dict(router_db) - def _update_router_db(self, context, router_id, data, gw_info): + def _update_router_db(self, context, router_id, data): """Update the DB object.""" with context.session.begin(subtransactions=True): router_db = self._get_router(context, router_id) @@ -212,7 +212,7 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase): self._update_router_gw_info(context, id, gw_info) else: candidates = None - router_db = self._update_router_db(context, id, r, gw_info) + router_db = self._update_router_db(context, id, r) if candidates: l3_plugin = manager.NeutronManager.get_service_plugins().get( constants.L3_ROUTER_NAT) diff --git a/neutron/db/l3_dvr_db.py b/neutron/db/l3_dvr_db.py index 5470bb9d3c7..a97b07ef0fb 100644 --- a/neutron/db/l3_dvr_db.py +++ b/neutron/db/l3_dvr_db.py @@ -107,7 +107,7 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin, reason=e) def _update_distributed_attr( - self, context, router_id, router_db, data, gw_info): + self, context, router_id, router_db, data): """Update the model to support the dvr case of a router.""" if data.get('distributed'): old_owner = l3_const.DEVICE_OWNER_ROUTER_INTF @@ -116,18 +116,18 @@ class L3_NAT_with_dvr_db_mixin(l3_db.L3_NAT_db_mixin, rp.port_type = new_owner rp.port.device_owner = new_owner - def _update_router_db(self, context, router_id, data, gw_info): + def _update_router_db(self, context, router_id, data): with context.session.begin(subtransactions=True): router_db = super( L3_NAT_with_dvr_db_mixin, self)._update_router_db( - context, router_id, data, gw_info) + context, router_id, data) migrating_to_distributed = ( not router_db.extra_attributes.distributed and data.get('distributed') is True) self._validate_router_migration(context, router_db, data) router_db.extra_attributes.update(data) self._update_distributed_attr( - context, router_id, router_db, data, gw_info) + context, router_id, router_db, data) if migrating_to_distributed: if router_db['gw_port_id']: # If the Legacy router is getting migrated to a DVR diff --git a/neutron/db/l3_hamode_db.py b/neutron/db/l3_hamode_db.py index 5a795dc2fb1..43a0be74ec1 100644 --- a/neutron/db/l3_hamode_db.py +++ b/neutron/db/l3_hamode_db.py @@ -411,7 +411,7 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin, router_dict['ha_vr_id'] = router_db.extra_attributes.ha_vr_id return router_dict - def _update_router_db(self, context, router_id, data, gw_info): + def _update_router_db(self, context, router_id, data): router_db = self._get_router(context, router_id) original_distributed_state = router_db.extra_attributes.distributed @@ -427,7 +427,7 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin, with context.session.begin(subtransactions=True): router_db = super(L3_HA_NAT_db_mixin, self)._update_router_db( - context, router_id, data, gw_info) + context, router_id, data) ha_not_changed = (requested_ha_state is None or requested_ha_state == original_ha_state) diff --git a/neutron/tests/unit/db/test_l3_dvr_db.py b/neutron/tests/unit/db/test_l3_dvr_db.py index df603f48169..a0dd2c4c98b 100644 --- a/neutron/tests/unit/db/test_l3_dvr_db.py +++ b/neutron/tests/unit/db/test_l3_dvr_db.py @@ -122,7 +122,7 @@ class L3DvrTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase): return_value={'agents': [agent]}) self.mixin._unbind_router = mock.Mock() router_db = self.mixin._update_router_db( - self.ctx, router_id, distributed, mock.ANY) + self.ctx, router_id, distributed) # Assert that the DB value has changed self.assertTrue(router_db.extra_attributes.distributed) self.assertEqual(1, diff --git a/neutron/tests/unit/db/test_l3_hamode_db.py b/neutron/tests/unit/db/test_l3_hamode_db.py index e1f3d359aa4..9a1133651e4 100644 --- a/neutron/tests/unit/db/test_l3_hamode_db.py +++ b/neutron/tests/unit/db/test_l3_hamode_db.py @@ -88,8 +88,7 @@ class L3HATestFramework(testlib_api.SqlTestCase): data['distributed'] = distributed if admin_state is not None: data['admin_state_up'] = admin_state - return self.plugin._update_router_db(ctx, router_id, - data, None) + return self.plugin._update_router_db(ctx, router_id, data) def _bind_router(self, router_id): with self.admin_ctx.session.begin(subtransactions=True):