From 42959a7f87ba885324213b20d779e7f74fdb60b5 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Tue, 15 Jan 2013 12:07:18 +0100
Subject: [PATCH] burnin: Disk template option cleanup
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Burnin doesn't support all disk templates (specifically it doesn't
support β€œblockdev”). The code, however, used manually composed lists in
some places, constants.DISK_TEMPLATES in others, and an internal list of
supported templates in some.

This patch changes burnin to only use its internal list of supported
disk templates.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 tools/burnin | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/tools/burnin b/tools/burnin
index 183bf40d7..1d740d50c 100755
--- a/tools/burnin
+++ b/tools/burnin
@@ -221,10 +221,11 @@ OPTIONS = [
                        " to start the renaming sequence"),
                  metavar="<instance_name>"),
   cli.cli_option("-t", "--disk-template", dest="disk_template",
-                 choices=list(constants.DISK_TEMPLATES),
+                 choices=list(_SUPPORTED_DISK_TEMPLATES),
                  default=constants.DT_DRBD8,
-                 help="Disk template (diskless, file, plain, sharedfile"
-                 " or drbd) [drbd]"),
+                 help=("Disk template (default %s, otherwise one of %s)" %
+                       (constants.DT_DRBD8,
+                        utils.CommaJoin(_SUPPORTED_DISK_TEMPLATES)))),
   cli.cli_option("-n", "--nodes", dest="nodes", default="",
                  help=("Comma separated list of nodes to perform"
                        " the burnin on (defaults to all nodes)"),
@@ -486,7 +487,7 @@ class Burner(object):
       Err("Maximum memory lower than minimum memory")
 
     if options.disk_template not in _SUPPORTED_DISK_TEMPLATES:
-      Err("Unknown disk template '%s'" % options.disk_template)
+      Err("Unknown or unsupported disk template '%s'" % options.disk_template)
 
     if options.disk_template == constants.DT_DISKLESS:
       disk_size = disk_growth = []
-- 
GitLab