Martin Polednik has uploaded a new change for review.

Change subject: vdsm: add check for hostdev passthrough to caps
......................................................................

vdsm: add check for hostdev passthrough to caps

Currently only for intel + will not be 100% accurate source

Change-Id: I789f93679740e87b2f5a88351261bc58852990d4
Signed-off-by: Martin Polednik <[email protected]>
---
M vdsm/caps.py
1 file changed, 27 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/71/30471/1

diff --git a/vdsm/caps.py b/vdsm/caps.py
index 0993939..2b0aa21 100644
--- a/vdsm/caps.py
+++ b/vdsm/caps.py
@@ -246,6 +246,32 @@
     return None
 
 
+def _iommuPresent(cmdline):
+    if 'intel_iommu' in cmdline:
+        if 'intel_iommu=off' not in cmdline:
+            return 'yes'
+
+    return 'no'
+
+
+def _getIommuSupport():
+    try:
+        import systemd.journal
+        reader = systemd.journal.Reader()
+        reader.this_boot()
+        reader.add_match(_TRANSPORT='kernel')
+        for index, entry in enumerate(reader):
+            if 'Command line:' in entry['MESSAGE']:
+                return _iommuPresent(entry['MESSAGE'])
+    except:
+        with open('/var/log/dmesg', 'r') as fd:
+            for index, line in enumerate(fd):
+                if 'Command line:' in line:
+                    return _iommuPresent(line)
+
+    return 'no'
+
+
 @utils.memoized
 def getLiveMergeSupport():
     """
@@ -642,6 +668,7 @@
     caps['autoNumaBalancing'] = getAutoNumaBalancingInfo()
 
     caps['selinux'] = _getSELinux()
+    caps['hostdevSupport'] = _getIommuSupport()
 
     liveSnapSupported = _getLiveSnapshotSupport(targetArch)
     if liveSnapSupported is not None:


-- 
To view, visit http://gerrit.ovirt.org/30471
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I789f93679740e87b2f5a88351261bc58852990d4
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Martin Polednik <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to