Mark Wu 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)
....................................................
File vdsm/caps.py
Line 311:
Line 312: def _getKeyPackages():
Line 313: def kernelDict():
Line 314: try:
Line 315: ret = os.uname()
The build date is auto generated by kernel build script. So i think it's safe
to use on try-except block. Is this reason acceptable?
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"))
Done
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