Martin Polednik has uploaded a new change for review.

Change subject: caps: report realtime kernel status
......................................................................

caps: report realtime kernel status

Determining whether system is suitable for RT operation is complex
task consisting of multiple variables. One of the necessary but
insufficient indications is RT_PREEMPT patch within running kernel,
as shown by "RT" string within kernel's release string.

We now report realtimeKernel in caps, using os.uname() to gather
information about runtime kernel; allowing engine to act based on
this information.

Change-Id: I016ae8a66963a973a1a2f78a9c2706af84f804d1
Signed-off-by: Martin Polednik <mpoled...@redhat.com>
---
M lib/api/vdsm-api.yml
M lib/vdsm/osinfo.py
M vdsm/caps.py
3 files changed, 19 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/15/65715/1

diff --git a/lib/api/vdsm-api.yml b/lib/api/vdsm-api.yml
index f311b17..e44e06a 100644
--- a/lib/api/vdsm-api.yml
+++ b/lib/api/vdsm-api.yml
@@ -6489,6 +6489,13 @@
             name: kernelArgs
             type: string
             added: '4.0'
+
+        -   defaultvalue: no-default
+            description: Indication whether the running kernel is compiled
+                with RT_PREEMPT enabled
+            name: realtimeKernel
+            type: string
+            added: '4.1'
         type: object
 
     VmShortStatus: &VmShortStatus
diff --git a/lib/vdsm/osinfo.py b/lib/vdsm/osinfo.py
index 23bb2c2..f5342a4 100644
--- a/lib/vdsm/osinfo.py
+++ b/lib/vdsm/osinfo.py
@@ -25,6 +25,8 @@
 import logging
 import os
 
+from collections import namedtuple
+
 from vdsm import utils
 
 # For debian systems we can use python-apt if available
@@ -46,6 +48,9 @@
     glusterEnabled = True
 except ImportError:
     glusterEnabled = False
+
+
+KernelFlags = namedtuple('KernelFlags', 'version, realtime')
 
 
 class OSName:
@@ -178,7 +183,7 @@
 
 
 def package_versions():
-    pkgs = {'kernel': _runtime_kernel_version()}
+    pkgs = {'kernel': runtime_kernel_flags().version}
 
     if _release_name() in (OSName.RHEVH, OSName.OVIRT, OSName.FEDORA,
                            OSName.RHEL, OSName.POWERKVM):
@@ -243,7 +248,7 @@
     return pkgs
 
 
-def _runtime_kernel_version():
+def runtime_kernel_flags():
     ret = os.uname()
     try:
         ver, rel = ret[2].split('-', 1)
@@ -251,4 +256,6 @@
         logging.error('kernel release not found', exc_info=True)
         ver, rel = '0', '0'
 
-    return dict(version=ver, release=rel)
+    realtime = 'RT' in ret[3]
+
+    return KernelFlags(dict(version=ver, release=rel), realtime)
diff --git a/vdsm/caps.py b/vdsm/caps.py
index 703b500..57ea7e9 100644
--- a/vdsm/caps.py
+++ b/vdsm/caps.py
@@ -168,7 +168,8 @@
     caps['operatingSystem'] = osinfo.version()
     caps['uuid'] = host.uuid()
     caps['packages2'] = osinfo.package_versions()
-    caps['kernelArgs'] = osinfo.kernel_args()
+    caps['realtimeKernel'] = str(
+        osinfo.runtime_kernel_flags().realtime).lower()
     caps['emulatedMachines'] = machinetype.emulated_machines(
         cpuarch.effective())
     caps['ISCSIInitiatorName'] = _getIscsiIniName()


-- 
To view, visit https://gerrit.ovirt.org/65715
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I016ae8a66963a973a1a2f78a9c2706af84f804d1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <mpoled...@redhat.com>
_______________________________________________
vdsm-patches mailing list -- vdsm-patches@lists.fedorahosted.org
To unsubscribe send an email to vdsm-patches-le...@lists.fedorahosted.org

Reply via email to