[PATCH] virt-host-validate: Fix IOMMU output on S390

Boris Fiuczynski fiuczy at linux.ibm.com
Fri Dec 17 15:20:37 UTC 2021


Commit 93e9e92c1e eliminated the option for skipping but left code in
the s390 check which makes use of a skip. This leads to an output
without result destroying the correct format. e.g.

  QEMU: Checking for hardware virtualization                                 : PASS
  QEMU: Checking if device /dev/kvm exists                                   : PASS
  QEMU: Checking if device /dev/kvm is accessible                            : PASS
  QEMU: Checking if device /dev/vhost-net exists                             : PASS
  QEMU: Checking if device /dev/net/tun exists                               : PASS
  QEMU: Checking for cgroup 'cpu' controller support                         : PASS
  QEMU: Checking for cgroup 'cpuacct' controller support                     : PASS
  QEMU: Checking for cgroup 'cpuset' controller support                      : PASS
  QEMU: Checking for cgroup 'memory' controller support                      : PASS
  QEMU: Checking for cgroup 'devices' controller support                     : PASS
  QEMU: Checking for cgroup 'blkio' controller support                       : PASS
  QEMU: Checking for device assignment IOMMU support                         :   QEMU: Checking for secure guest support                                    : PASS

Signed-off-by: Boris Fiuczynski <fiuczy at linux.ibm.com>
---
 tools/virt-host-validate-common.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c
index 647ed7b48b..1cb9d206b5 100644
--- a/tools/virt-host-validate-common.c
+++ b/tools/virt-host-validate-common.c
@@ -378,11 +378,17 @@ int virHostValidateIOMMU(const char *hvname,
          * devices (which is quite usual on s390x). If there are
          * no PCI devices the directory is still there but is
          * empty. */
-        if (!virDirOpen(&dir, "/sys/bus/pci/devices"))
-            return 0;
+        if (!virDirOpen(&dir, "/sys/bus/pci/devices")) {
+            virHostMsgFail(VIR_HOST_VALIDATE_NOTE,
+                           "Skipped - PCI support disabled");
+            return VIR_HOST_VALIDATE_FAILURE(VIR_HOST_VALIDATE_NOTE);
+        }
         rc = virDirRead(dir, &dent, NULL);
-        if (rc <= 0)
-            return 0;
+        if (rc <= 0) {
+            virHostMsgFail(VIR_HOST_VALIDATE_NOTE,
+                           "Skipped - No PCI devices are online");
+            return VIR_HOST_VALIDATE_FAILURE(VIR_HOST_VALIDATE_NOTE);
+        }
         virHostMsgPass();
     } else {
         virHostMsgFail(level,
-- 
2.31.1




More information about the libvir-list mailing list