From: Aaron Rosen Date: Mon, 16 Sep 2013 23:28:19 +0000 (-0700) Subject: Fix error raised when router-interface-delete on no-snat routers X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=f01aed9a1e2b2c686f91787c6382a466a9211d95;p=openstack-build%2Fneutron-build.git Fix error raised when router-interface-delete on no-snat routers 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 --- diff --git a/neutron/plugins/nicira/NeutronPlugin.py b/neutron/plugins/nicira/NeutronPlugin.py index b5f6f0fbc..5178b9d9f 100644 --- a/neutron/plugins/nicira/NeutronPlugin.py +++ b/neutron/plugins/nicira/NeutronPlugin.py @@ -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(