]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
NSX: do not raise on missing router during migration step
authorarmando-migliaccio <armamig@gmail.com>
Mon, 28 Apr 2014 21:18:06 +0000 (14:18 -0700)
committerArmando Migliaccio <armamig@gmail.com>
Mon, 19 May 2014 14:50:56 +0000 (14:50 +0000)
Return None for missing router rather raising NotFound exception;
this is what the client code was expected to handle in the first
place.

Closes-bug: 1313918

Change-Id: I573770a69d0170b027fc990c29aaa87b1fc8eccc

neutron/plugins/vmware/dhcp_meta/migration.py
neutron/tests/unit/vmware/test_dhcpmeta.py

index 992a88346b771255a05dd817c6d4a3fc5a6e8589..0f1b32b771c7268bed20db3e40667fe07c5da7ee 100644 (file)
@@ -58,8 +58,6 @@ class DhcpMetadataBuilder(object):
         for port in ports:
             if port['fixed_ips'][0]['subnet_id'] == subnet['id']:
                 return port['device_id']
-        else:
-            raise n_exc.NotFound()
 
     def metadata_deallocate(self, context, router_id, subnet_id):
         """Deallocate metadata services for the subnet."""
index ee9d9e477f6208e4964d5717b79e4fe2702b5940..e862abd64ed419614f55c5e6604677d9d26aba80 100644 (file)
@@ -71,6 +71,11 @@ class DhcpMetadataBuilderTestCase(base.BaseTestCase):
     def test_router_id_get_none_subnet(self):
         self.assertIsNone(self.builder.router_id_get(mock.ANY, None))
 
+    def test_router_id_get_none_no_router(self):
+        self.builder.plugin.get_ports.return_value = []
+        subnet = {'network_id': self.network_id}
+        self.assertIsNone(self.builder.router_id_get(mock.ANY, subnet))
+
     def test_metadata_deallocate(self):
         self.builder.metadata_deallocate(
             mock.ANY, self.router_id, self.subnet_id)