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

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