Change in vdsm[master]: netinfo: Displays active slave for the bond in getVdsCaps

gcheresh at redhat.com gcheresh at redhat.com
Mon Sep 15 06:28:48 UTC 2014


Genadi Chereshnya has uploaded a new change for review.

Change subject: netinfo: Displays active slave for the bond in getVdsCaps
......................................................................

netinfo: Displays active slave for the bond in getVdsCaps

Adding active slave field for the bond in the getVdsCaps
Displays an active slave if exists or displays '' when there is no active slave

Change-Id: Ib6c40755c361523a28cbd68af110e3b20cb9ae25
Signed-off-by: Genadi Chereshnya <gcheresh at redhat.com>
---
M lib/vdsm/netinfo.py
1 file changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/15/32915/1

diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py
index 6864871..58f6b74 100644
--- a/lib/vdsm/netinfo.py
+++ b/lib/vdsm/netinfo.py
@@ -66,6 +66,7 @@
 NET_PATH = '/sys/class/net'
 BONDING_MASTERS = '/sys/class/net/bonding_masters'
 BONDING_SLAVES = '/sys/class/net/%s/bonding/slaves'
+BONDING_ACTIVE_SLAVE = '/sys/class/net/%s/bonding/active_slave'
 BONDING_OPT = '/sys/class/net/%s/bonding/%s'
 BRIDGING_OPT = '/sys/class/net/%s/bridge/%s'
 _BONDING_FAILOVER_MODES = frozenset(('1', '3'))
@@ -167,6 +168,14 @@
 
 def slaves(bonding):
     return open(BONDING_SLAVES % bonding).readline().split()
+
+
+def active_slave(bonding):
+    """
+    :param bonding:
+    :return: active slave when one exists or '' otherwise
+    """
+    return open(BONDING_ACTIVE_SLAVE % bonding).readline().rstrip()
 
 
 def bondOpts(bond, keys=None):
@@ -575,6 +584,7 @@
 
 def _bondinfo(link):
     return {'hwaddr': link.address, 'slaves': slaves(link.name),
+            'active_slave': active_slave(link.name),
             'opts': _getBondingOptions(link.name)}
 
 


-- 
To view, visit http://gerrit.ovirt.org/32915
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib6c40755c361523a28cbd68af110e3b20cb9ae25
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Genadi Chereshnya <gcheresh at redhat.com>


More information about the vdsm-patches mailing list