Petr Horáček has posted comments on this change. Change subject: net: lookup dhclient file ......................................................................
Patch Set 3: (4 comments) https://gerrit.ovirt.org/#/c/61918/3/lib/vdsm/network/ip/dhclient.py File lib/vdsm/network/ip/dhclient.py: PS3, Line 113: extend > Can we use += ? Done PS3, Line 115: lease > Is this the dhclient lease? If so, please name it so. Done PS3, Line 121: elif len(leases) == 1: : return leases[0] > Why is this needed? The one below will handle this case as well. Optimalization. In most cases there should be only one lease file. In [2]: leases = ['/etc/sysconfig/network-scripts/ifcfg-enp0s25'] In [3]: def a(): ...: if len(leases) == 1: ...: return leases[0] ...: In [4]: import os In [5]: def b(): ...: return sorted(leases, key=os.path.getmtime, reverse=True)[0] ...: In [6]: timeit(a) Out[6]: 0.2383490680003888 In [7]: timeit(b) Out[7]: 3.6430967259998397 PS3, Line 128: _network_manager > _nm_lease_dir_exists Done -- To view, visit https://gerrit.ovirt.org/61918 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I94d2c35bfa8acfc808d3852d41b45b7df38c2c41 Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Petr Horáček <[email protected]> Gerrit-Reviewer: Dan Kenigsberg <[email protected]> Gerrit-Reviewer: Edward Haas <[email protected]> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Ondřej Svoboda <[email protected]> Gerrit-Reviewer: Petr Horáček <[email protected]> Gerrit-Reviewer: gerrit-hooks <[email protected]> Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/admin/lists/[email protected]
