Handle mac address resolution failures when populating networks.

This commit is contained in:
Cole Robinson
2008-06-25 11:56:36 -04:00
parent 6d8b7d0353
commit 06b48e7dc3
+5 -2
View File
@@ -162,9 +162,11 @@ class vmmConnection(gobject.GObject):
# find all bonding master devices and register them # find all bonding master devices and register them
# XXX bonding stuff is linux specific # XXX bonding stuff is linux specific
bondMasters = self._net_get_bonding_masters() bondMasters = self._net_get_bonding_masters()
logging.debug("Bonding masters are: %s" % bondMasters)
for bond in bondMasters: for bond in bondMasters:
sysfspath = "/sys/class/net/" + bond sysfspath = "/sys/class/net/" + bond
mac = self._net_get_mac_address(bond, sysfspath) mac = self._net_get_mac_address(bond, sysfspath)
if mac:
self._net_device_added(bond, mac, sysfspath) self._net_device_added(bond, mac, sysfspath)
# Add any associated VLANs # Add any associated VLANs
self._net_tag_device_added(bond, sysfspath) self._net_tag_device_added(bond, sysfspath)
@@ -221,6 +223,7 @@ class vmmConnection(gobject.GObject):
if os.path.exists(vlanpath): if os.path.exists(vlanpath):
logging.debug("Process VLAN %s" % vlanpath) logging.debug("Process VLAN %s" % vlanpath)
vlanmac = self._net_get_mac_address(name, vlanpath) vlanmac = self._net_get_mac_address(name, vlanpath)
if vlanmac:
(ignore,vlanname) = os.path.split(vlanpath) (ignore,vlanname) = os.path.split(vlanpath)
self._net_device_added(vlanname, vlanmac, vlanpath) self._net_device_added(vlanname, vlanmac, vlanpath)
@@ -946,9 +949,9 @@ class vmmConnection(gobject.GObject):
addrpath = sysfspath + "/address" addrpath = sysfspath + "/address"
if os.path.exists(addrpath): if os.path.exists(addrpath):
df = open(addrpath, 'r') df = open(addrpath, 'r')
mac = df.readline() mac = df.readline().strip(" \n\t")
df.close() df.close()
return mac.strip(" \n\t") return mac
def _net_get_bonding_masters(self): def _net_get_bonding_masters(self):
masters = [] masters = []