From 320eda24d4dc5b08efec0a153e3e11b779d066e2 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Fri, 16 Jan 2009 10:41:17 +0000
Subject: [PATCH] burnin: add option to not remove instances

This patch adds a burnin option to keep instances at the end, so that
debugging after a burnin failure is easier.

Also, we reorder the command line parsing and client query so that one
can use ./tools/burnin --help even on non-ganeti machines.

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

diff --git a/tools/burnin b/tools/burnin
index 80076b6d6..230c803dd 100755
--- a/tools/burnin
+++ b/tools/burnin
@@ -88,8 +88,8 @@ class Burner(object):
     self.instances = []
     self.to_rem = []
     self.opts = None
-    self.cl = cli.GetClient()
     self.ParseOptions()
+    self.cl = cli.GetClient()
     self.GetState()
 
   def ClearFeedbackBuf(self):
@@ -222,6 +222,12 @@ class Burner(object):
                       help="Enable checking of instance status via http,"
                       " looking for /hostname.txt that should contain the"
                       " name of the instance")
+    parser.add_option("-K", "--keep-instances", default=False,
+                      action="store_true",
+                      dest="keep_instances",
+                      help="Leave instances on the cluster after burnin,"
+                      " for investigation in case of errors or simply"
+                      " to use them")
 
 
     options, args = parser.parse_args()
@@ -724,7 +730,8 @@ class Burner(object):
         Log("Error detected: opcode buffer follows:\n\n")
         Log(self.GetFeedbackBuf())
         Log("\n\n")
-      self.Remove()
+      if not self.opts.keep_instances:
+        self.Remove()
 
     return 0
 
-- 
GitLab