Amador Pahim has uploaded a new change for review.

Change subject: Report bond speed as function of slaved nics speed and bond mode
......................................................................

Report bond speed as function of slaved nics speed and bond mode

Currently bond interfaces are always assumed to have 1GB of speed,
reflecting in inaccurate network usage calculations.

This patch add bond speed probe to netinfo.speed(), considering bond
mode and slaved nics speed:

 Failover modes: 1 and 3
  Bond speed = active slaved nic speed.

 Load Balance modes: 0, 2, 4, 5 and 6
  Bond speed = all slaved nics speed summed up.

Change-Id: Ide077846e49ac5e4d759a85ff9d5c6cec653aa18
Bug-Url: https://bugzilla.redhat.com/1007860
Signed-off-by: Amador Pahim <apa...@redhat.com>
---
M lib/vdsm/netinfo.py
1 file changed, 16 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/97/19297/1

diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py
index ba78dc9..885740b 100644
--- a/lib/vdsm/netinfo.py
+++ b/lib/vdsm/netinfo.py
@@ -297,6 +297,22 @@
                 s = int(speedFile.read())
             if s not in (2 ** 16 - 1, 2 ** 32 - 1) or s > 0:
                 return s
+
+        # bondings() lists bond devices
+        if dev in bondings():
+            bond_options = bondOpts(dev)
+            # only bonds with slaved nics will be probed
+            if bond_options['slaves']:
+                # failover modes
+                if bond_options['mode'][1] in ['1', '3']:
+                    s = speed(bond_options['active_slave'][0])
+                # load balance modes
+                elif bond_options['mode'][1] in ['0', '2', '4', '5', '6']:
+                    s = 0
+                    for slave in bond_options['slaves']:
+                        s += speed(slave)
+                return s
+
     except Exception:
         logging.exception('cannot read %s speed', dev)
     return 0


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ide077846e49ac5e4d759a85ff9d5c6cec653aa18
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Amador Pahim <apa...@redhat.com>
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to