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
This commit is contained in:
Aaron Rosen 2013-09-16 16:28:19 -07:00
parent 2a45e5b681
commit 5fca8bac5c

View 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(