]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Remove unused L3 HA RPC method
authorAssaf Muller <amuller@redhat.com>
Thu, 12 Feb 2015 15:59:36 +0000 (10:59 -0500)
committerAssaf Muller <amuller@redhat.com>
Wed, 18 Mar 2015 23:00:12 +0000 (19:00 -0400)
The following patch will re-add it with its intended parameters
and use it in the agent.

Change-Id: Idffe963fffe5fdde6f474046a50208a2974edfa0
Partially-Implements: blueprint report-ha-router-master

neutron/api/rpc/handlers/l3_rpc.py
neutron/db/l3_hamode_db.py
neutron/tests/unit/db/test_l3_ha_db.py

index 0c979d377c61f2df18a1f4f953e353e032fab5bd..5865eb7cf4c9f04edaf7ea64c0914542d00218ec 100644 (file)
@@ -39,7 +39,8 @@ class L3RpcCallback(object):
     # 1.1  Support update_floatingip_statuses
     # 1.2 Added methods for DVR support
     # 1.3 Added a method that returns the list of activated services
-    # 1.4 Added L3 HA update_router_state
+    # 1.4 Added L3 HA update_router_state. This method was later removed,
+    #     since it was unused. The RPC version was not changed.
     target = oslo_messaging.Target(version='1.4')
 
     @property
@@ -208,11 +209,3 @@ class L3RpcCallback(object):
                   'host %(host)s', {'agent_port': agent_port,
                   'host': host})
         return agent_port
-
-    def update_router_state(self, context, **kwargs):
-        router_id = kwargs.get('router_id')
-        state = kwargs.get('state')
-        host = kwargs.get('host')
-
-        return self.l3plugin.update_router_state(context, router_id, state,
-                                                 host=host)
index 6b978cedb168d92d8c3feab3027761bfa2798de7..1c0a6e59576675f162a8a975bbd61e91db0d5d15 100644 (file)
@@ -28,7 +28,7 @@ from neutron.db import l3_dvr_db
 from neutron.db import model_base
 from neutron.db import models_v2
 from neutron.extensions import l3_ext_ha_mode as l3_ha
-from neutron.i18n import _LI, _LW
+from neutron.i18n import _LI
 
 VR_ID_RANGE = set(range(1, 255))
 MAX_ALLOCATION_TRIES = 10
@@ -410,18 +410,6 @@ class L3_HA_NAT_db_mixin(l3_dvr_db.L3_NAT_with_dvr_db_mixin):
 
         return router_db
 
-    def update_router_state(self, context, router_id, state, host):
-        with context.session.begin(subtransactions=True):
-            bindings = self.get_ha_router_port_bindings(context, [router_id],
-                                                        host)
-            if bindings:
-                if len(bindings) > 1:
-                    LOG.warn(_LW("The router %(router_id)s is bound multiple "
-                                 "times on the agent %(host)s"),
-                             {'router_id': router_id, 'host': host})
-
-                bindings[0].update({'state': state})
-
     def delete_router(self, context, id):
         router_db = self._get_router(context, id)
         super(L3_HA_NAT_db_mixin, self).delete_router(context, id)
index 23c26739415bfd629f4318c859af3fe921670fd1..b35135169790a4d90525ff0d9a50713678051319 100644 (file)
@@ -197,23 +197,6 @@ class L3HATestCase(L3HATestFramework):
                          interface['device_owner'])
         self.assertEqual(cfg.CONF.l3_ha_net_cidr, interface['subnet']['cidr'])
 
-    def test_update_state(self):
-        router = self._create_router()
-        self._bind_router(router['id'])
-        routers = self.plugin.get_ha_sync_data_for_host(self.admin_ctx,
-                                                        self.agent1['host'])
-        state = routers[0].get(constants.HA_ROUTER_STATE_KEY)
-        self.assertEqual('standby', state)
-
-        self.plugin.update_router_state(self.admin_ctx, router['id'], 'active',
-                                        self.agent1['host'])
-
-        routers = self.plugin.get_ha_sync_data_for_host(self.admin_ctx,
-                                                        self.agent1['host'])
-
-        state = routers[0].get(constants.HA_ROUTER_STATE_KEY)
-        self.assertEqual('active', state)
-
     def test_unique_ha_network_per_tenant(self):
         tenant1 = _uuid()
         tenant2 = _uuid()