]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Revert "fix check_ports_exist_on_l3agent in no subnet case"
authorSwaminathan Vasudevan <swaminathan.vasudevan@hp.com>
Mon, 16 Mar 2015 20:20:36 +0000 (20:20 +0000)
committerSwaminathan Vasudevan <swaminathan.vasudevan@hp.com>
Mon, 16 Mar 2015 20:20:36 +0000 (20:20 +0000)
This reverts commit e99f6e00cfd397bb74d44c9462dfcfa545dbed8c.

This patch introduces an issue with the Tempest test. Already there was a similar patch that broke the tempest test for DVR.
This patch consistently failed to pass  test_add_list_remove_router_on_l3_agent.
I would recommend to revert this patch until the tempest test is fixed.

Change-Id: Ibd1fcb7f5f3196ebc1ffa01b8d5d7c6e8f1aaaac

neutron/db/l3_agentschedulers_db.py
neutron/tests/unit/test_l3_schedulers.py

index 2d5d9b4da91898bce5b1bcee5f6bc7855e00ae98..c0142b22b98965d3948996806f2d342fcd666025 100644 (file)
@@ -384,8 +384,6 @@ class L3AgentSchedulerDbMixin(l3agentscheduler.L3AgentSchedulerPluginBase,
         ports on the host, running the input l3agent.
         """
         subnet_ids = self.get_subnet_ids_on_router(context, router_id)
-        if not subnet_ids:
-            return False
 
         core_plugin = manager.NeutronManager.get_plugin()
         filter = {'fixed_ips': {'subnet_id': subnet_ids}}
index ef548a167e145b8264b49f86661341524dc74c51..f3ba89e80b08bdd291fcefd57e93b3bd21b0ff7e 100644 (file)
@@ -667,45 +667,33 @@ class L3SchedulerTestBaseMixin(object):
 
     def test_check_ports_exist_on_l3agent_no_subnets(self):
         l3_agent, router = self._prepare_check_ports_exist_tests()
-        with mock.patch.object(manager.NeutronManager,
-                               'get_plugin') as getp:
-            getp.return_value = self.plugin
-            # no subnets
-            self.get_subnet_ids_on_router.return_value = set()
-            val = self.check_ports_exist_on_l3agent(self.adminContext,
-                                                    l3_agent, router['id'])
-            self.assertFalse(self.plugin.get_ports.called)
-            self.assertFalse(val)
+        # no subnets
+        val = self.check_ports_exist_on_l3agent(self.adminContext,
+                                                l3_agent, router['id'])
+        self.assertFalse(val)
 
     def test_check_ports_exist_on_l3agent_no_subnet_match(self):
         l3_agent, router = self._prepare_check_ports_exist_tests()
-        with mock.patch.object(manager.NeutronManager,
-                               'get_plugin') as getp:
-            getp.return_value = self.plugin
-            # no matching subnet
-            self.get_subnet_ids_on_router.return_value = [str(uuid.uuid4())]
-            val = self.check_ports_exist_on_l3agent(self.adminContext,
-                                                    l3_agent, router['id'])
-            self.assertTrue(self.plugin.get_ports.called)
-            self.assertFalse(val)
+        # no matching subnet
+        self.plugin.get_subnet_ids_on_router = mock.Mock(
+            return_value=[str(uuid.uuid4())])
+        val = self.check_ports_exist_on_l3agent(self.adminContext,
+                                                l3_agent, router['id'])
+        self.assertFalse(val)
 
     def test_check_ports_exist_on_l3agent_subnet_match(self):
         l3_agent, router = self._prepare_check_ports_exist_tests()
-        with mock.patch.object(manager.NeutronManager,
-                               'get_plugin') as getp:
-            getp.return_value = self.plugin
-            # matching subnet
-            port = {'subnet_id': str(uuid.uuid4()),
-                    'binding:host_id': 'host_1',
-                    'device_owner': 'compute:',
-                    'id': 1234}
-            self.plugin.get_ports.return_value = [port]
-            self.get_subnet_ids_on_router = mock.Mock(
-                return_value=[port['subnet_id']])
-            val = self.check_ports_exist_on_l3agent(self.adminContext,
-                                                    l3_agent, router['id'])
-            self.assertTrue(self.plugin.get_ports.called)
-            self.assertTrue(val)
+        # matching subnet
+        port = {'subnet_id': str(uuid.uuid4()),
+                'binding:host_id': 'host_1',
+                'device_owner': 'compute:',
+                'id': 1234}
+        self.plugin.get_ports.return_value = [port]
+        self.plugin.get_subnet_ids_on_router = mock.Mock(
+            return_value=[port['subnet_id']])
+        val = self.check_ports_exist_on_l3agent(self.adminContext,
+                                                l3_agent, router['id'])
+        self.assertTrue(val)
 
 
 class L3SchedulerTestCase(l3_agentschedulers_db.L3AgentSchedulerDbMixin,