Mark Wu has posted comments on this change.

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


Patch Set 1: Code-Review-1

(4 comments)

....................................................
File lib/vdsm/netinfo.py
Line 297:                 s = int(speedFile.read())
Line 298:             if s not in (2 ** 16 - 1, 2 ** 32 - 1) or s > 0:
Line 299:                 return s
Line 300: 
Line 301:         # bondings() lists bond devices
I think the name bondings() is self explanatory, so this comment is not 
necessary.
Line 302:         if dev in bondings():
Line 303:             bond_options = bondOpts(dev)
Line 304:             # only bonds with slaved nics will be probed
Line 305:             if bond_options['slaves']:


Line 299:                 return s
Line 300: 
Line 301:         # bondings() lists bond devices
Line 302:         if dev in bondings():
Line 303:             bond_options = bondOpts(dev)
the options you care about should just be 'slaves', 'active_slave', and 'mode', 
 so you could pass the list of keys into bondOpts. Then it can avoid reading 
other options.
Line 304:             # only bonds with slaved nics will be probed
Line 305:             if bond_options['slaves']:
Line 306:                 # failover modes
Line 307:                 if bond_options['mode'][1] in ['1', '3']:


Line 303:             bond_options = bondOpts(dev)
Line 304:             # only bonds with slaved nics will be probed
Line 305:             if bond_options['slaves']:
Line 306:                 # failover modes
Line 307:                 if bond_options['mode'][1] in ['1', '3']:
You could define constants for the failover mode and balance mode. With that, 
you could remove the comments.
Line 308:                     s = speed(bond_options['active_slave'][0])
Line 309:                 # load balance modes
Line 310:                 elif bond_options['mode'][1] in ['0', '2', '4', '5', 
'6']:
Line 311:                     s = 0


Line 309:                 # load balance modes
Line 310:                 elif bond_options['mode'][1] in ['0', '2', '4', '5', 
'6']:
Line 311:                     s = 0
Line 312:                     for slave in bond_options['slaves']:
Line 313:                         s += speed(slave)
s = sum(speed(slave) for slave in bond_options['slaves']:)
Line 314:                 return s
Line 315: 
Line 316:     except Exception:
Line 317:         logging.exception('cannot read %s speed', dev)


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ide077846e49ac5e4d759a85ff9d5c6cec653aa18
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Amador Pahim <apa...@redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegu...@redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com>
Gerrit-Reviewer: Mark Wu <wu...@linux.vnet.ibm.com>
Gerrit-Reviewer: Ryan Harper <ry...@us.ibm.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to