summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Alvares Gomes <lucasagomes@gmail.com>2018-10-31 14:14:22 +0000
committerLucas Alvares Gomes <lucasagomes@gmail.com>2018-10-31 14:14:22 +0000
commit18e566c9c96b3f815df4f2867cc2d459f527c5b5 (patch)
tree86e0fd670dcbadd19c1998b3ba2b7765e2a52b98
parented53ee13c7ce4a3efef1dfefebb4242a0c955b60 (diff)
Fix update_port() SubnetNotFound race conditional
While in collecting port information in the update_port() method the code will loop thru the fixed_ips associated with the port and fetch the subnet the IP belongs to from the Neutron database but, in some cases, that subnet would have been deleted mid-operation. That would cause the whole update_port() to error out with a SubnetNotFound exception. This patch fixes the problem by handling such exception and not appending that IP to the list of addresses (in OVN DB terms) in case the subnet has already been deleted. Change-Id: Ia19324722425184da13a7a0383185486eed62e38 Closes-Bug: #1800846 Signed-off-by: Lucas Alvares Gomes <lucasagomes@gmail.com>
Notes
Notes (review): Code-Review+2: Daniel Alvarez <dalvarez@redhat.com> Code-Review+2: Miguel Angel Ajo <mangelajo@redhat.com> Workflow+1: Miguel Angel Ajo <mangelajo@redhat.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Wed, 14 Nov 2018 13:35:41 +0000 Reviewed-on: https://review.openstack.org/614520 Project: openstack/networking-ovn Branch: refs/heads/master
-rw-r--r--networking_ovn/common/ovn_client.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/networking_ovn/common/ovn_client.py b/networking_ovn/common/ovn_client.py
index c56fb2e..241c59d 100644
--- a/networking_ovn/common/ovn_client.py
+++ b/networking_ovn/common/ovn_client.py
@@ -212,9 +212,12 @@ class OVNClient(object):
212 tag = binding_prof.get('tag', []) 212 tag = binding_prof.get('tag', [])
213 address = port['mac_address'] 213 address = port['mac_address']
214 for ip in port.get('fixed_ips', []): 214 for ip in port.get('fixed_ips', []):
215 try:
216 subnet = self._plugin.get_subnet(
217 n_context.get_admin_context(), ip['subnet_id'])
218 except n_exc.SubnetNotFound:
219 continue
215 address += ' ' + ip['ip_address'] 220 address += ' ' + ip['ip_address']
216 subnet = self._plugin.get_subnet(n_context.get_admin_context(),
217 ip['subnet_id'])
218 cidrs += ' {}/{}'.format(ip['ip_address'], 221 cidrs += ' {}/{}'.format(ip['ip_address'],
219 subnet['cidr'].split('/')[1]) 222 subnet['cidr'].split('/')[1])
220 port_security, new_macs = \ 223 port_security, new_macs = \