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