Blame SOURCES/tuna-Add-distinction-between-spread-and-move-to-erro.patch

27e2ce
From c9d2fc624905cd0af96ee9f84317d562a042fe14 Mon Sep 17 00:00:00 2001
27e2ce
From: Leah Leshchinsky <lleshchi@redhat.com>
27e2ce
Date: Wed, 6 Oct 2021 13:21:50 -0400
27e2ce
Subject: [PATCH] tuna: Add distinction between --spread and --move to error
27e2ce
 message
27e2ce
27e2ce
Currently, the command `tuna --cpus=CPU-LIST --spread` generates an
27e2ce
error with the warning "tuna: --move requires a list of threads/irqs!".
27e2ce
Similarly, when the command `tuna --threads=THREAD-LIST --spread` is
27e2ce
run, it generates the warning "tuna: --move requires a cpu list!".
27e2ce
27e2ce
This can be confusing to the user, especially with commands that use both
27e2ce
the "--spread" and "--move" flags. The warning should specify "--spread"
27e2ce
when that is the source of the error.
27e2ce
27e2ce
Check whether the argument is a move or spread and update the warning
27e2ce
string accordingly.
27e2ce
27e2ce
Signed-off-by: Leah Leshchinsky <lleshchi@redhat.com>
27e2ce
---
27e2ce
 tuna-cmd.py | 7 +++----
27e2ce
 1 file changed, 3 insertions(+), 4 deletions(-)
27e2ce
27e2ce
diff --git a/tuna-cmd.py b/tuna-cmd.py
27e2ce
index 8617966..8dfad9e 100755
27e2ce
--- a/tuna-cmd.py
27e2ce
+++ b/tuna-cmd.py
27e2ce
@@ -633,15 +633,14 @@ def main():
27e2ce
         elif o in ("-n", "--show_sockets"):
27e2ce
             show_sockets = True
27e2ce
         elif o in ("-m", "--move", "-x", "--spread"):
27e2ce
+            spread = o in ("-x", "--spread")
27e2ce
             if not cpu_list:
27e2ce
-                print("tuna: --move " + _("requires a cpu list!"))
27e2ce
+                print("tuna: %s " % ("--spread" if spread else "--move") + _("requires a cpu list!"))
27e2ce
                 sys.exit(2)
27e2ce
             if not (thread_list or irq_list):
27e2ce
-                print("tuna: --move " + _("requires a list of threads/irqs!"))
27e2ce
+                print("tuna: %s " % ("--spread" if spread else "--move") + _("requires a list of threads/irqs!"))
27e2ce
                 sys.exit(2)
27e2ce
 
27e2ce
-            spread = o in ("-x", "--spread")
27e2ce
-
27e2ce
             if thread_list:
27e2ce
                 tuna.move_threads_to_cpu(cpu_list, thread_list, spread=spread)
27e2ce
 
27e2ce
-- 
27e2ce
2.27.0
27e2ce