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