Martin Polednik has uploaded a new change for review.
Change subject: osinfo: un-nest kernel version gathering function ......................................................................
osinfo: un-nest kernel version gathering function
Previous function, kernelDict, had unclear naming and was needlessly nested within package_versions function. This patch un-nests the function and renames it to _runtime_kernel_version. The new name hints why we don't look up the version via rpmdb.
Change-Id: I77f78882973855cc971bbdae66cc96c8068e8230 Signed-off-by: Martin Polednik mpolednik@redhat.com --- M lib/vdsm/osinfo.py 1 file changed, 12 insertions(+), 11 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/79/65379/1
diff --git a/lib/vdsm/osinfo.py b/lib/vdsm/osinfo.py index d443028..23bb2c2 100644 --- a/lib/vdsm/osinfo.py +++ b/lib/vdsm/osinfo.py @@ -178,17 +178,7 @@
def package_versions(): - def kernelDict(): - ret = os.uname() - try: - ver, rel = ret[2].split('-', 1) - except ValueError: - logging.error('kernel release not found', exc_info=True) - ver, rel = '0', '0' - - return dict(version=ver, release=rel) - - pkgs = {'kernel': kernelDict()} + pkgs = {'kernel': _runtime_kernel_version()}
if _release_name() in (OSName.RHEVH, OSName.OVIRT, OSName.FEDORA, OSName.RHEL, OSName.POWERKVM): @@ -251,3 +241,14 @@ logging.error('', exc_info=True)
return pkgs + + +def _runtime_kernel_version(): + ret = os.uname() + try: + ver, rel = ret[2].split('-', 1) + except ValueError: + logging.error('kernel release not found', exc_info=True) + ver, rel = '0', '0' + + return dict(version=ver, release=rel)
gerrit-hooks has posted comments on this change.
Change subject: osinfo: un-nest kernel version gathering function ......................................................................
Patch Set 1:
* Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-4.0'])
Martin Polednik has posted comments on this change.
Change subject: osinfo: un-nest kernel version gathering function ......................................................................
Patch Set 1: Verified+1
network test failures...
Francesco Romani has posted comments on this change.
Change subject: osinfo: un-nest kernel version gathering function ......................................................................
Patch Set 1: Code-Review+2
(2 comments)
worth switching now to logging.exception()? no big deal, your call.
https://gerrit.ovirt.org/#/c/65379/1/lib/vdsm/osinfo.py File lib/vdsm/osinfo.py:
Line 245: Line 246: def _runtime_kernel_version(): Line 247: ret = os.uname() Line 248: try: Line 249: ver, rel = ret[2].split('-', 1) I wonder if we can get this for free from the platform module Line 250: except ValueError: Line 251: logging.error('kernel release not found', exc_info=True) Line 252: ver, rel = '0', '0' Line 253:
PS1, Line 251: logging in another ([far] future) patch -> logging.exception
gerrit-hooks has posted comments on this change.
Change subject: osinfo: un-nest kernel version gathering function ......................................................................
Patch Set 2:
* Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-4.0'])
Martin Polednik has posted comments on this change.
Change subject: osinfo: un-nest kernel version gathering function ......................................................................
Patch Set 1:
(1 comment)
https://gerrit.ovirt.org/#/c/65379/1/lib/vdsm/osinfo.py File lib/vdsm/osinfo.py:
Line 245: Line 246: def _runtime_kernel_version(): Line 247: ret = os.uname() Line 248: try: Line 249: ver, rel = ret[2].split('-', 1)
I wonder if we can get this for free from the platform module
Define free. We can get the exact same information with
platform.uname()[2].split('-', 1)
Unfortunately, as uname's implementation does roughly
... if release == 'unknown': release = '' ...
if it cannot find the kernel release, it wouldn't really help us much. Line 250: except ValueError: Line 251: logging.error('kernel release not found', exc_info=True) Line 252: ver, rel = '0', '0' Line 253:
Dan Kenigsberg has submitted this change and it was merged.
Change subject: osinfo: un-nest kernel version gathering function ......................................................................
osinfo: un-nest kernel version gathering function
Previous function, kernelDict, had unclear naming and was needlessly nested within package_versions function. This patch un-nests the function and renames it to _runtime_kernel_version. The new name hints why we don't look up the version via rpmdb.
Change-Id: I77f78882973855cc971bbdae66cc96c8068e8230 Signed-off-by: Martin Polednik mpolednik@redhat.com Reviewed-on: https://gerrit.ovirt.org/65379 Reviewed-by: Francesco Romani fromani@redhat.com Continuous-Integration: Jenkins CI --- M lib/vdsm/osinfo.py 1 file changed, 12 insertions(+), 11 deletions(-)
Approvals: Jenkins CI: Passed CI tests Francesco Romani: Looks good to me, approved Martin Polednik: Verified
gerrit-hooks has posted comments on this change.
Change subject: osinfo: un-nest kernel version gathering function ......................................................................
Patch Set 3:
* Update Tracker::IGNORE, no bug url/s found * Set MODIFIED::IGNORE, no Bug-Url found.
vdsm-patches@lists.fedorahosted.org