Skip to content

Commit f5815bc

Browse files
mtomaskaslawqo
authored andcommitted
Make retrieval of port mac column safe
This should not happen in the real world but its safer to check if a port MAC column is not empty before trying to access it. Trivial-Fix Change-Id: Ie3c5151a8f7c6a240a5f3240d4e7fb58ea43e9c1 (cherry picked from commit 5100538)
1 parent 6b7446a commit f5815bc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

neutron/agent/ovn/metadata/agent.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,10 @@ def _ensure_datapath_checksum(self, namespace):
421421
def _get_port_ips(self, port):
422422
# Retrieve IPs from the port mac column which is in form
423423
# ["<port_mac> <ip1> <ip2> ... <ipN>"]
424+
if not port.mac:
425+
LOG.warning("Port %s MAC column is empty, cannot retrieve IP "
426+
"addresses", port.uuid)
427+
return []
424428
mac_field_attrs = port.mac[0].split()
425429
ips = mac_field_attrs[1:]
426430
if not ips:

0 commit comments

Comments
 (0)