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