From 519bfbae92716d9bda5b3fcd764926346b77304b Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Sun, 4 Nov 2007 23:26:43 +0000
Subject: [PATCH] Add option to burnin only a given set of nodes

This patch adds a '-n' option to burnin that takes a comma-separated
list of nodes to perform the burnin on.

Reviewed-by: ultrotter
---
 tools/burnin | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/tools/burnin b/tools/burnin
index 4110c481b..eed35559c 100755
--- a/tools/burnin
+++ b/tools/burnin
@@ -68,6 +68,9 @@ def ParseOptions():
                     choices=("remote_raid1", "drbd8"), default="remote_raid1",
                     help="Template type for network mirroring (remote_raid1"
                     " or drbd8) [remote_raid1]")
+  parser.add_option("-n", "--nodes", dest="nodes", default="",
+                    help="Comma separated list of nodes to perform the burnin"
+                    " on (defaults to all nodes)")
 
   options, args = parser.parse_args()
   if len(args) < 1 or options.os is None:
@@ -86,8 +89,17 @@ def BurninCluster(opts, args):
 
   logger.SetupLogging(debug=True, program="ganeti/burnin")
   proc = mcpu.Processor(feedback=Feedback)
-  result = proc.ExecOpCode(opcodes.OpQueryNodes(output_fields=["name"],
-                                                names=[]))
+  if opts.nodes:
+    names = opts.nodes.split(",")
+  else:
+    names = []
+  try:
+    result = proc.ExecOpCode(opcodes.OpQueryNodes(output_fields=["name"],
+                                                  names=names))
+  except errors.GenericError, err:
+    err_code, msg = cli.FormatError(err)
+    Feedback(msg)
+    return err_code
   nodelist = [data[0] for data in result]
 
   Feedback("- Testing global parameters")
-- 
GitLab