]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virt-host-validate: Fix IOMMU output on S390
authorBoris Fiuczynski <fiuczy@linux.ibm.com>
Fri, 17 Dec 2021 15:20:37 +0000 (16:20 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 17 Dec 2021 15:34:20 +0000 (16:34 +0100)
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@linux.ibm.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
tools/virt-host-validate-common.c

index 647ed7b48bddebab0cf4497b5de9edb07f3d4420..1cb9d206b55c10ec2834e7ed70d0f1ea8cb9f529 100644 (file)
@@ -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,