[LLDP] Skip NICs that say they are ready but are unreadable.
While listening for LLDP packets, if one of the sockets marks itself as ready to read then our code will try to read data from that socket, but if something goes wrong while reading that data then it causes IPA to raise out of the loop skipping any other of the other NICs which might have worked. This patch adds code to catch and LOG any exception that is raised while we are trying to read data from one of the sockets so that we can proceed to process all the NICs. Change-Id: I8546097f5ae23755a5fdb448902007a2d823b7bf Closes-Bug: #1665025
This commit is contained in:
ironic_python_agent
releasenotes/notes
@ -182,10 +182,17 @@ def _get_lldp_info(interfaces):
|
||||
# Create a copy of interfaces to avoid deleting while iterating.
|
||||
for index, interface in enumerate(list(interfaces)):
|
||||
if s == interface[1]:
|
||||
LOG.info('Found LLDP info for interface: %s',
|
||||
interface[0])
|
||||
lldp_info[interface[0]] = (
|
||||
_receive_lldp_packets(s))
|
||||
try:
|
||||
lldp_info[interface[0]] = _receive_lldp_packets(s)
|
||||
except socket.error:
|
||||
LOG.exception('Socket for network interface %s said '
|
||||
'that it was ready to read we were '
|
||||
'unable to read from the socket while '
|
||||
'trying to get LLDP packet. Skipping '
|
||||
'this network interface.', interface[0])
|
||||
else:
|
||||
LOG.info('Found LLDP info for interface: %s',
|
||||
interface[0])
|
||||
# Remove interface from the list, only need one packet
|
||||
del interfaces[index]
|
||||
|
||||
|
Reference in New Issue
Block a user