mirror of
https://github.com/virt-manager/virt-manager.git
synced 2026-07-29 15:55:32 -05:00
Handle mac address resolution failures when populating networks.
This commit is contained in:
@@ -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 = []
|
||||||
|
|||||||
Reference in New Issue
Block a user