mirror of
https://github.com/virt-manager/virt-manager.git
synced 2026-07-29 23:58:20 -05:00
Skip bonding if /sys/class/net/bonding_masters doesn't exist (Shigeki Sakamoto)
This commit is contained in:
@@ -151,6 +151,7 @@ class vmmConnection(gobject.GObject):
|
||||
# find all bonding master devices and register them
|
||||
# XXX bonding stuff is linux specific
|
||||
bondMasters = self._net_get_bonding_masters()
|
||||
if bondMasters is not None:
|
||||
for bond in bondMasters:
|
||||
sysfspath = "/sys/class/net/" + bond
|
||||
mac = self._net_get_mac_address(bond, sysfspath)
|
||||
@@ -896,6 +897,7 @@ class vmmConnection(gobject.GObject):
|
||||
|
||||
def _net_get_bonding_masters(self):
|
||||
masters = []
|
||||
if os.path.exists("/sys/class/net/bonding_masters"):
|
||||
f = open("/sys/class/net/bonding_masters")
|
||||
while True:
|
||||
rline = f.readline()
|
||||
@@ -904,6 +906,8 @@ class vmmConnection(gobject.GObject):
|
||||
rline = rline.strip("\n\t")
|
||||
masters = rline[:-1].split(' ')
|
||||
return masters
|
||||
else:
|
||||
return None
|
||||
|
||||
def _net_is_bonding_slave(self, name, sysfspath):
|
||||
masterpath = sysfspath + "/master"
|
||||
|
||||
Reference in New Issue
Block a user