Change in vdsm[ovirt-3.6]: netinfo: report DHCP on devices only when configured (like f...

osvoboda at redhat.com osvoboda at redhat.com
Thu Sep 17 15:03:35 UTC 2015


Ondřej Svoboda has posted comments on this change.

Change subject: netinfo: report DHCP on devices only when configured (like for networks)
......................................................................


Patch Set 1:

(3 comments)

https://gerrit.ovirt.org/#/c/46247/1/lib/vdsm/netinfo.py
File lib/vdsm/netinfo.py:

Line 543:             'ipv4addrs': ipv4addrs,
Line 544:             'ipv6addrs': ipv6addrs,
Line 545:             'gateway': _get_gateway(routes, link.name),
Line 546:             'ipv6gateway': _get_gateway(routes, link.name, family=6),
Line 547:             'dhcpv4': _dhcp_used(link.name, dhcpv4_ifaces, net_attrs),
> this is now a big clutter.
You may recall that the original problem is the inconsistence between dhcpv4 reported on networks -- and on their associated bridges/underlying devices (if the network is not bridged). dhcpv4 must be False if bootproto=none was requested (even though there are still active leases).

So far, it has been fixed only for networks, because their configuration is accessible more easily (RunningConfig) than for the underlying devices.

This patch exploits the already known information obtained for networks by libvirtNets2vdsm. dhcpv4 for a top net device is now fetched from a dhcpv4 reported for a network, not "bootproto" which has been used to determine dhcpv4 on the basis of the network's configuration.

The flow is a bit simpler than what you describe:

_get_dhclient_ifaces is only called once and the resulting information is then shared with libvirtNets2vdsm (_getNetInfo) and _devinfo.

netinfo_by_device translates it in a quick lookup of information reported in getVdsCaps -- for a given NIC/virtual netdev that the network is built upon.

And as for _dhcp_used, its only purpose is to extract information, albeit from sources of totally different nature (network configuration/reported information).

I believe my approach is optimal computing time-wise (it fetches all information only once, doesn't loop excessively), given the restriction I chose: to change the least number of lines.

If you can propose a more readable solution, please do not hesitate :-)
Line 548:             'dhcpv6': _dhcp_used(link.name, dhcpv6_ifaces, net_attrs,
Line 549:                                  family=6),
Line 550:             'mtu': str(link.mtu),
Line 551:             'netmask': ipv4netmask}


Line 740: dhcpv4_ifaces, dhcpv6_ifaces)
In this function, libvirtNets2vdsm always gets information from _get_dhclient_ifaces(), it doesn't have to call it again.


Line 757: dhcpv4_ifaces,
        :                                 dhcpv6_ifaces
As well as _devinfo does.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I2b17b0c66e3a0fc8c5ada62d166d9a2b92513033
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Ondřej Svoboda <osvoboda at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Eliraz Levi <elevi 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