Change in vdsm[master]: net: Mapping bonding option value names to numerics

ibarkan at redhat.com ibarkan at redhat.com
Thu Dec 17 09:08:29 UTC 2015


Ido Barkan has posted comments on this change.

Change subject: net: Mapping bonding option value names to numerics
......................................................................


Patch Set 25: Code-Review-1

(3 comments)

https://gerrit.ovirt.org/#/c/49390/25/lib/vdsm/netinfo/bonding.py
File lib/vdsm/netinfo/bonding.py:

Line 209: try:
        :         opt_num_val = bond_opts_map[mode_num][option_name][val_name]
        :     except KeyError:
        :         opt_num_val = None
this can be also written as:
  return bond_opts_map[mode_num][option_name].get(val_name, None)

shorter, ans still emphasizes the fact that None can be returned)

-- this is unless you expect a key error in any of the dictionaries.

your call.


https://gerrit.ovirt.org/#/c/49390/25/lib/vdsm/tool/dump_bonding_opts.py
File lib/vdsm/tool/dump_bonding_opts.py:

Line 82: with _bond_device(bond_name):
you could just move the context manager to wrap only the statement that is inside the for loop.


Line 119: with open(BONDING_MASTERS, 'w') as bonds:
        :         bonds.write('-' + bond_name)
        :         bonds.flush()
        :         bonds.write('+' + bond_name)
but this can be replaced with:
  with _bond_device(...):

see up.


-- 
To view, visit https://gerrit.ovirt.org/49390
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I1f4c16b1523822a2d53d4525841ff8741af6296c
Gerrit-PatchSet: 25
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Edward Haas <edwardh at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Edward Haas <edwardh at redhat.com>
Gerrit-Reviewer: Ido Barkan <ibarkan at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Ondřej Svoboda <osvoboda at redhat.com>
Gerrit-Reviewer: Petr Horáček <phoracek at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list