render / rpms / libvirt

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