Change in vdsm[master]: netinfo: Determine bootproto from dhclient's lease files
danken at redhat.com
danken at redhat.com
Sat Feb 1 08:23:27 UTC 2014
Dan Kenigsberg has posted comments on this change.
Change subject: netinfo: Determine bootproto from dhclient's lease files
......................................................................
Patch Set 16:
(2 comments)
http://gerrit.ovirt.org/#/c/23098/16/lib/vdsm/netinfo.py
File lib/vdsm/netinfo.py:
Line 558: return datetime.strptime(expiryTime, '%w %Y/%m/%d %H:%M:%S')
Line 559:
Line 560:
Line 561: def _parseLeaseFile(leaseFile, ipv6):
Line 562: LEASE = 'lease{0} {{\n'.format(ipv6 and '6' or '')
I prefer the new syntax
'6' if ipv6 else ''
Line 563: IFACE = ' interface "'
Line 564: IFACE_END = '";\n'
Line 565: EXPIRE = ' expire '
Line 566:
Line 566:
Line 567: interfaces = set()
Line 568: insideLease = False
Line 569:
Line 570: for line in leaseFile.readlines():
The parsing of this function is a bit fragile: if a single human-edited space is added, it goes busted.
Could you split the file by "}" and use a regexp to extract the interface and its expiry?
Line 571: if insideLease:
Line 572: if line.startswith(IFACE) and line.endswith(IFACE_END):
Line 573: name = line[len(IFACE):-len(IFACE_END)]
Line 574:
--
To view, visit http://gerrit.ovirt.org/23098
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I5fbc48a0adf5f40120a72ec2c4cc2fc80b7226b8
Gerrit-PatchSet: 16
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <osvoboda at redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: Assaf Muller <amuller at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Ondřej Svoboda <osvoboda at redhat.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list