From 907bd92595e6593f35c65b5faa2311300ace0c95 Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Thu, 20 Aug 2020 22:39:04 +0200 Subject: [PATCH] Fix deletion of subnet_id from pd_subnets In the RouterInfo._process_internal_ports() method when it process old ports and port belongs to the subnet with CIDR assigned by Prefix Delegation it will try to remove subnet_id key from the pd_subnets dict. However it seems that in some case it may happen that such subnet_id key is not added to the pd_subnets dict and processing of ports fails. We shouldn't fail in such case, if there is no subnet_id key in this dict we should be good as we want to delete it simply. So this patch changes that to not raise KeyError in such case. Change-Id: I6e6d890c196716c0ef4bcc2922f1ec4c142a6e79 Closes-Bug: #1892364 (cherry picked from commit 13b894288e9354b9eb0833a635fe4a624bb068a9) --- neutron/agent/l3/router_info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neutron/agent/l3/router_info.py b/neutron/agent/l3/router_info.py index 54125c366c4..e714daeef90 100644 --- a/neutron/agent/l3/router_info.py +++ b/neutron/agent/l3/router_info.py @@ -588,7 +588,7 @@ class RouterInfo(object): for subnet in p['subnets']: if ipv6_utils.is_ipv6_pd_enabled(subnet): self.agent.pd.disable_subnet(self.router_id, subnet['id']) - del self.pd_subnets[subnet['id']] + self.pd_subnets.pop(subnet['id'], None) for p in new_ports: self.internal_network_added(p)