]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix error raised when router-interface-delete on no-snat routers
authorAaron Rosen <arosen@nicira.com>
Mon, 16 Sep 2013 23:28:19 +0000 (16:28 -0700)
committerAaron Rosen <arosen@nicira.com>
Mon, 16 Sep 2013 23:30:01 +0000 (16:30 -0700)
Previously, a 500 error would be raised trying to remove a subnet
from a no-snat router because we were trying to remove the snat
rules that didn't exist in the router.

Fixes bug: 1226323

Change-Id: Ieff0ed4bdbac39ac07e597753272a4f5d40cb346

neutron/plugins/nicira/NeutronPlugin.py

index b5f6f0fbc588ce3c0163552a1e429455d0e1e76f..5178b9d9f1bab36b8aaac8105a4e9fefffd33ebc 100644 (file)
@@ -1675,7 +1675,10 @@ class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin,
             if not subnet:
                 subnet = self._get_subnet(context, subnet_id)
             router = self._get_router(context, router_id)
-            self._delete_subnet_snat_rule(router, subnet)
+            # If router is enabled_snat = False there are no snat rules to
+            # delete.
+            if router.enable_snat:
+                self._delete_subnet_snat_rule(router, subnet)
             # Relax the minimum expected number as the nosnat rules
             # do not exist in 2.x deployments
             nvplib.delete_nat_rules_by_match(