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

Boris Fiuczynski posted 1 patch 2 years, 4 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20211217152037.6480-1-fiuczy@linux.ibm.com
tools/virt-host-validate-common.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
[PATCH] virt-host-validate: Fix IOMMU output on S390
Posted by Boris Fiuczynski 2 years, 4 months ago
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>
---
 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

Re: [PATCH] virt-host-validate: Fix IOMMU output on S390
Posted by Michal Prívozník 2 years, 4 months ago
On 12/17/21 16:20, Boris Fiuczynski wrote:
> 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>
> ---
>  tools/virt-host-validate-common.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

and pushed.

Michal