Change in vdsm[master]: net: OVS netinfo
danken at redhat.com
danken at redhat.com
Thu May 5 15:35:34 UTC 2016
Dan Kenigsberg has posted comments on this change.
Change subject: net: OVS netinfo
......................................................................
Patch Set 24:
(2 comments)
https://gerrit.ovirt.org/#/c/56972/24/lib/vdsm/network/ovs/info.py
File lib/vdsm/network/ovs/info.py:
Line 161: custom_opts.append('ovs_lacp:%s' % lacp)
Line 162: opts['custom'] = ','.join(custom_opts)
Line 163: return opts
Line 164:
Line 165: def _get_fake_ports(bridge, northbound, southbound, ports):
get info is expected to be called quite often. can we define these functions once, on module import?
Line 166: fake_ports = []
Line 167: for port, port_attrs in six.iteritems(ports):
Line 168: tag = port_attrs['tag']
Line 169: if tag == ports[northbound]['tag'] and port != bridge:
PS24, Line 186: ip_attrs = port_attrs['ip']
: if ip_attrs:
: port_info = {
: 'mtu': port_attrs['mtu'],
: 'addr': ip_attrs['ipv4addr'],
: 'ipv4addrs': ip_attrs['ipv4addrs'],
: 'gateway': ip_attrs['ipv4gateway'],
: 'netmask': ip_attrs['ipv4netmask'],
: 'dhcpv4': ip_attrs['dhcpv4'],
: 'ipv6addrs': ip_attrs['ipv6addrs'],
: 'ipv6autoconf': ip_attrs['ipv6autoconf'],
: 'ipv6gateway': ip_attrs['ipv6gateway'],
: 'dhcpv6': ip_attrs['dhcpv6'],
: 'cfg': {'BOOTPROTO': ('dhcp' if ip_attrs['dhcpv4']
: else 'none')}
: }
: else:
: port_info = EMPTY_PORT_INFO
can you factor this (and other similar stanzas) out to a little helper function? I believe it would make this long function more readable.
--
To view, visit https://gerrit.ovirt.org/56972
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Ia5dd351faf108fd04afa78208d9c34451a856d4a
Gerrit-PatchSet: 24
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Edward Haas <edwardh at redhat.com>
Gerrit-Reviewer: Jenkins CI
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