]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix error while connecting to busy NSX L2 Gateway
authorarmando-migliaccio <armamig@gmail.com>
Mon, 27 Jan 2014 22:05:12 +0000 (14:05 -0800)
committerThomas Goirand <thomas@goirand.fr>
Thu, 13 Mar 2014 07:20:12 +0000 (15:20 +0800)
Ensure that a Conflict error is properly handled.

Change-Id: Ib468ee953aef0fc54ea88064f88637ed46bc6352
Closes-bug: 1270724

neutron/plugins/nicira/NeutronPlugin.py

index 26edc9b8c2aea533997bb26dded50539d73831ab..32ee011eb66b23dbf939b96e79914d109e18996d 100644 (file)
@@ -2009,8 +2009,11 @@ class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin,
                         network_mapping_info):
         # Ensure the default gateway in the config file is in sync with the db
         self._ensure_default_network_gateway()
-        return super(NvpPluginV2, self).connect_network(
-            context, network_gateway_id, network_mapping_info)
+        try:
+            return super(NvpPluginV2, self).connect_network(
+                context, network_gateway_id, network_mapping_info)
+        except NvpApiClient.Conflict:
+            raise nvp_exc.NvpL2GatewayAlreadyInUse(gateway=network_gateway_id)
 
     def disconnect_network(self, context, network_gateway_id,
                            network_mapping_info):