return None
def get_netdev_by_mac(mac):
- maybe = None
for device in os.listdir("/sys/class/net"):
dev_mac = get_netdev_mac(device)
- if dev_mac and mac.lower() == dev_mac.lower():
- if get_netdev_tx_queue_len(device):
+ if (dev_mac and mac.lower() == dev_mac.lower() and
+ get_netdev_tx_queue_len(device)):
return device
- if not maybe:
- # Probably a datapath internal port.
- maybe = device
- return maybe
+ return None
class DatabaseCache(object):
def __init__(self, session_ref=None, cache_file=None):
pifrec = db.get_pif_record(pif)
if pifrec['VLAN'] != '-1':
- return [get_vlan_slave_of_pif(pif)]
+ return get_physdev_pifs(get_vlan_slave_of_pif(pif))
elif len(pifrec['bond_master_of']) != 0:
return get_bond_slaves_of_pif(pif)
else:
argv = ['--del-match=bonding.%s.[!0-9]*' % interface]
argv += ["--add=bonding.%s.slave=%s" % (interface, slave)
for slave in physdev_names]
- argv += ['--add=bonding.%s.fake-iface=true']
+ argv += ['--add=bonding.%s.fake-iface=true' % interface]
if pifrec['MAC'] != "":
argv += ['--add=port.%s.mac=%s' % (interface, pifrec['MAC'])]