Pablo Greco 40546a
From 8722ee949b2099c4a4ac246fba868ae47cb828d2 Mon Sep 17 00:00:00 2001
Pablo Greco 40546a
Message-Id: <8722ee949b2099c4a4ac246fba868ae47cb828d2@dist-git>
Pablo Greco 40546a
From: Andrea Bolognani <abologna@redhat.com>
Pablo Greco 40546a
Date: Tue, 11 Jun 2019 10:13:50 +0200
Pablo Greco 40546a
Subject: [PATCH] util: Propagate numad failures correctly
Pablo Greco 40546a
MIME-Version: 1.0
Pablo Greco 40546a
Content-Type: text/plain; charset=UTF-8
Pablo Greco 40546a
Content-Transfer-Encoding: 8bit
Pablo Greco 40546a
Pablo Greco 40546a
Right now, if numad fails, we raise an error but return an
Pablo Greco 40546a
empty string to the caller instead of a NULL pointer, which
Pablo Greco 40546a
means processing will continue and the user will see
Pablo Greco 40546a
Pablo Greco 40546a
  # virsh start guest
Pablo Greco 40546a
  error: Failed to start domain guest
Pablo Greco 40546a
  error: invalid argument: Failed to parse bitmap ''
Pablo Greco 40546a
Pablo Greco 40546a
instead of a more reasonable
Pablo Greco 40546a
Pablo Greco 40546a
  # virsh start guest
Pablo Greco 40546a
  error: Failed to start domain guest
Pablo Greco 40546a
  error: operation failed: Failed to query numad for the advisory nodeset
Pablo Greco 40546a
Pablo Greco 40546a
Make sure the user gets a better error message.
Pablo Greco 40546a
Pablo Greco 40546a
https://bugzilla.redhat.com/show_bug.cgi?id=1716387
Pablo Greco 40546a
Pablo Greco 40546a
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Pablo Greco 40546a
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Pablo Greco 40546a
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Pablo Greco 40546a
(cherry picked from commit b34fb1fb6f99628932ad68db1ce4985a06def17f)
Pablo Greco 40546a
Pablo Greco 40546a
https://bugzilla.redhat.com/show_bug.cgi?id=1716907
Pablo Greco 40546a
Pablo Greco 40546a
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Pablo Greco 40546a
Message-Id: <20190611081350.6476-2-abologna@redhat.com>
Pablo Greco 40546a
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Pablo Greco 40546a
---
Pablo Greco 40546a
 src/util/virnuma.c | 6 ++++--
Pablo Greco 40546a
 1 file changed, 4 insertions(+), 2 deletions(-)
Pablo Greco 40546a
Pablo Greco 40546a
diff --git a/src/util/virnuma.c b/src/util/virnuma.c
Pablo Greco 40546a
index 784db0a7ce..fd15714553 100644
Pablo Greco 40546a
--- a/src/util/virnuma.c
Pablo Greco 40546a
+++ b/src/util/virnuma.c
Pablo Greco 40546a
@@ -66,10 +66,12 @@ virNumaGetAutoPlacementAdvice(unsigned short vcpus,
Pablo Greco 40546a
 
Pablo Greco 40546a
     virCommandSetOutputBuffer(cmd, &output);
Pablo Greco 40546a
 
Pablo Greco 40546a
-    if (virCommandRun(cmd, NULL) < 0)
Pablo Greco 40546a
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
Pablo Greco 40546a
+    if (virCommandRun(cmd, NULL) < 0) {
Pablo Greco 40546a
+        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
Pablo Greco 40546a
                        _("Failed to query numad for the "
Pablo Greco 40546a
                          "advisory nodeset"));
Pablo Greco 40546a
+        VIR_FREE(output);
Pablo Greco 40546a
+    }
Pablo Greco 40546a
 
Pablo Greco 40546a
     virCommandFree(cmd);
Pablo Greco 40546a
     return output;
Pablo Greco 40546a
-- 
Pablo Greco 40546a
2.22.0
Pablo Greco 40546a