vswitch: Correctly identify slave status in /proc compatibility layer
[openvswitch] / xenserver / opt_xensource_libexec_interface-reconfigure
index 0ae8e70a8328e6a7a7ac1cb5bcf4358d05bc26cf..301251f7623a640d5a9d0e3cbfc2a8c5c6341d1e 100755 (executable)
@@ -265,16 +265,12 @@ def get_netdev_tx_queue_len(device):
         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):
@@ -471,7 +467,7 @@ For a non-VLAN, non-bond master PIF, the PIF is its own physical device PIF.
     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: