[libvirt PATCH] tests: add warning that qemucapsprobe prefers native host/guest arch

Daniel P. Berrangé posted 1 patch 1 week ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20210406110107.234447-1-berrange@redhat.com
tests/qemucapsprobe.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

[libvirt PATCH] tests: add warning that qemucapsprobe prefers native host/guest arch

Posted by Daniel P. Berrangé 1 week ago
Generally we want the QEMU capabilities data in git to report KVM
related features, and thus we strongly prefer that the capabilities are
generated on a native host.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 tests/qemucapsprobe.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/tests/qemucapsprobe.c b/tests/qemucapsprobe.c
index 26ea9ff5ed..e4d09468bd 100644
--- a/tests/qemucapsprobe.c
+++ b/tests/qemucapsprobe.c
@@ -46,6 +46,7 @@ main(int argc, char **argv)
 {
     virThread thread;
     virQEMUCapsPtr caps;
+    virArch guest, host;
     const char *mock = VIR_TEST_MOCK("qemucapsprobe");
 
     if (!virFileIsExecutable(mock)) {
@@ -80,6 +81,17 @@ main(int argc, char **argv)
                                                  -1, -1, NULL, 0, NULL)))
         return EXIT_FAILURE;
 
+    host = virArchFromHost();
+    guest = virQEMUCapsGetArch(caps);
+
+    if (host != guest)
+        fprintf(stderr,
+                "WARNING: guest architecture '%s' does not match host '%s'.\n"
+                "WARNING: When generating capabilities for the libvirt test\n"
+                "WARNING: suite, it is strongly desired to generate capabilities\n"
+                "WARNING: on the native host to capture KVM related features.\n",
+                virArchToString(guest), virArchToString(host));
+
     virObjectUnref(caps);
 
     return EXIT_SUCCESS;
-- 
2.30.2

Re: [libvirt PATCH] tests: add warning that qemucapsprobe prefers native host/guest arch

Posted by Andrea Bolognani 6 days, 22 hours ago
On Tue, 2021-04-06 at 12:01 +0100, Daniel P. Berrangé wrote:
> +++ b/tests/qemucapsprobe.c
> @@ -46,6 +46,7 @@ main(int argc, char **argv)
>  {
>      virThread thread;
>      virQEMUCapsPtr caps;
> +    virArch guest, host;

I believe it's preferred to declare each variable on its own line,
even though this preference is not spelled out in our coding style.

> +    if (host != guest)
> +        fprintf(stderr,
> +                "WARNING: guest architecture '%s' does not match host '%s'.\n"
> +                "WARNING: When generating capabilities for the libvirt test\n"
> +                "WARNING: suite, it is strongly desired to generate capabilities\n"
> +                "WARNING: on the native host to capture KVM related features.\n",
> +                virArchToString(guest), virArchToString(host));

Braces around this, please.


Reviewed-by: Andrea Bolognani <abologna@redhat.com>

-- 
Andrea Bolognani / Red Hat / Virtualization