cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-numa-clarify-error-message-when-node-index-is-out-of.patch

ae23c9
From 14578f9dce566ccbedaba80885043cc907bf740b Mon Sep 17 00:00:00 2001
ae23c9
From: Igor Mammedov <imammedo@redhat.com>
ae23c9
Date: Mon, 2 Jul 2018 13:57:09 +0200
ae23c9
Subject: [PATCH 181/268] numa: clarify error message when node index is out of
ae23c9
 range in -numa dist, ...
ae23c9
ae23c9
RH-Author: Igor Mammedov <imammedo@redhat.com>
ae23c9
Message-id: <1530539829-260581-1-git-send-email-imammedo@redhat.com>
ae23c9
Patchwork-id: 81184
ae23c9
O-Subject: [RHEL-7.6 qemu-kvm-rhev PATCH] numa: clarify error message when node index is out of range in -numa dist, ...
ae23c9
Bugzilla: 1578381
ae23c9
RH-Acked-by: Andrew Jones <drjones@redhat.com>
ae23c9
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
ae23c9
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
ae23c9
RH-Acked-by: Pankaj Gupta <pagupta@redhat.com>
ae23c9
ae23c9
When using following CLI:
ae23c9
  -numa dist,src=128,dst=1,val=20
ae23c9
user gets a rather confusing error message:
ae23c9
   "Invalid node 128, max possible could be 128"
ae23c9
ae23c9
Where 128 is number of nodes that QEMU supports (MAX_NODES),
ae23c9
while src/dst is an index up to that limit, so it should be
ae23c9
MAX_NODES - 1 in error message.
ae23c9
Make error message to explicitly state valid range for node
ae23c9
index to be more clear.
ae23c9
ae23c9
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
ae23c9
Message-Id: <1526483174-169008-1-git-send-email-imammedo@redhat.com>
ae23c9
Reviewed-by: Eric Blake <eblake@redhat.com>
ae23c9
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
ae23c9
(cherry picked from commit 74f38e96b321ef8df2bf7fa1bd4f673ef06aca5b)
ae23c9
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
ae23c9
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
ae23c9
---
ae23c9
 numa.c | 5 ++---
ae23c9
 1 file changed, 2 insertions(+), 3 deletions(-)
ae23c9
ae23c9
diff --git a/numa.c b/numa.c
ae23c9
index 1116c90..a767a9d 100644
ae23c9
--- a/numa.c
ae23c9
+++ b/numa.c
ae23c9
@@ -140,9 +140,8 @@ static void parse_numa_distance(NumaDistOptions *dist, Error **errp)
ae23c9
     uint8_t val = dist->val;
ae23c9
 
ae23c9
     if (src >= MAX_NODES || dst >= MAX_NODES) {
ae23c9
-        error_setg(errp,
ae23c9
-                   "Invalid node %d, max possible could be %d",
ae23c9
-                   MAX(src, dst), MAX_NODES);
ae23c9
+        error_setg(errp, "Parameter '%s' expects an integer between 0 and %d",
ae23c9
+                   src >= MAX_NODES ? "src" : "dst", MAX_NODES - 1);
ae23c9
         return;
ae23c9
     }
ae23c9
 
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9