Dan Kenigsberg has posted comments on this change.
Change subject: trivial: Use os.uname to get kernel version insteaf of reading
proc files
......................................................................
Patch Set 1: (2 inline comments)
thanks! but few comments.
....................................................
File vdsm/caps.py
Line 311:
Line 312: def _getKeyPackages():
Line 313: def kernelDict():
Line 314: try:
Line 315: ret = os.uname()
calling os.uname() is obviously cleaner, but could you maintain the same level
of robustness of the original code?
I mean that formerly, a kernel without a date, would still report its version.
so please keep the separation of the try-except blocks.
Line 316: ver, rel = ret[2].split('-', 1)
Line 317: t = time.mktime(time.strptime('
'.join(ret[3].split()[2:]),
Line 318: "%a %b %d %H:%M:%S %Z %Y"))
Line 319: except:
Line 314: try:
Line 315: ret = os.uname()
Line 316: ver, rel = ret[2].split('-', 1)
Line 317: t = time.mktime(time.strptime('
'.join(ret[3].split()[2:]),
Line 318: "%a %b %d %H:%M:%S %Z %Y"))
I do not recall the details, but there has been a libc issue that forced us to
drop the timezone (in case the kernel was built in a timezone that strptime()
does not recognize, or something like that).
Line 319: except:
Line 320: ver, rel, t = '0', '0', '0'
Line 321: logging.error('kernel version not found', exc_info=True)
Line 322: return dict(version=ver, release=rel, buildtime=t)
--
To view, visit http://gerrit.ovirt.org/12874
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I0bcb4326d6ce4a41486352e11683c83879b61887
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Mark Wu <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches