Change in vdsm[master]: netinfo: simplify getNetworksAndVlansForIface

osvoboda at redhat.com osvoboda at redhat.com
Wed Oct 7 07:01:26 UTC 2015


Ondřej Svoboda has posted comments on this change.

Change subject: netinfo: simplify getNetworksAndVlansForIface
......................................................................


Patch Set 2:

(1 comment)

Yeah, I guess I'll write a unit test.

https://gerrit.ovirt.org/#/c/46765/2/lib/vdsm/netinfo.py
File lib/vdsm/netinfo.py:

Line 875:     def getNetworksAndVlansForIface(self, iface):
Line 876:         """Return tuples of (network, VLAN ID) connected to a NIC/bond."""
Line 877:         for network, netdict in self.networks.iteritems():
Line 878:             for net_device in netdict['ports'] if netdict['bridged'] else (
Line 879:                     netdict['iface'],):
> - needless comma?
netdict['ports'] is an iterable (a list); and (netdict['iface'],) is as well (a 1-tuple).

Even if I pulled this expression outside I would still use the same construction. Do you have a better alternative? :-)
Line 880:                 vlan_info = self.vlans.get(iface)
Line 881:                 if vlan_info:
Line 882:                     yield (network, vlan_info['vlanid'])
Line 883:                 elif iface == net_device:  # NIC/bond


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib2718e1a1d2799edbd9ad91d42f90c2c9c3d9397
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <osvoboda 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: automation at ovirt.org
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list