Browse Source

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>
Lucas Alvares Gomes 5 months ago
parent
commit
18e566c9c9
1 changed files with 5 additions and 2 deletions
  1. 5
    2
      networking_ovn/common/ovn_client.py

+ 5
- 2
networking_ovn/common/ovn_client.py View File

@@ -212,9 +212,12 @@ class OVNClient(object):
212 212
             tag = binding_prof.get('tag', [])
213 213
             address = port['mac_address']
214 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 220
                 address += ' ' + ip['ip_address']
216
-                subnet = self._plugin.get_subnet(n_context.get_admin_context(),
217
-                                                 ip['subnet_id'])
218 221
                 cidrs += ' {}/{}'.format(ip['ip_address'],
219 222
                                          subnet['cidr'].split('/')[1])
220 223
             port_security, new_macs = \

Loading…
Cancel
Save