From 073271f61a7fc839463e7156f683b0f12a5099e4 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 17 Sep 2009 12:28:24 +0200
Subject: [PATCH] =?UTF-8?q?Unify=20the=20last=20=E2=80=9C--hypervisor?=
 =?UTF-8?q?=E2=80=9D=20(as=20list)=20option?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This third form takes a list of name+options, and is used only in
gnt-cluster. Who knew that we have three forms of β€˜-H’?

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 lib/cli.py          |  6 ++++++
 scripts/gnt-cluster | 15 ++-------------
 2 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/lib/cli.py b/lib/cli.py
index 1bde74454..3f4d938d8 100644
--- a/lib/cli.py
+++ b/lib/cli.py
@@ -52,6 +52,7 @@ __all__ = [
   "FIELDS_OPT",
   "FILESTORE_DIR_OPT",
   "FILESTORE_DRIVER_OPT",
+  "HVLIST_OPT",
   "HVOPTS_OPT",
   "HYPERVISOR_OPT",
   "IALLOCATOR_OPT",
@@ -527,6 +528,11 @@ HYPERVISOR_OPT = cli_option("-H", "--hypervisor-parameters", dest="hypervisor",
                             " format hypervisor:option=value,option=value,...",
                             default=None, type="identkeyval")
 
+HVLIST_OPT = cli_option("-H", "--hypervisor-parameters", dest="hvparams",
+                        help="Hypervisor and hypervisor options, in the"
+                        " format hypervisor:option=value,option=value,...",
+                        default=[], action="append", type="identkeyval")
+
 
 def _ParseArgs(argv, commands, aliases):
   """Parser for the command line arguments.
diff --git a/scripts/gnt-cluster b/scripts/gnt-cluster
index eeea8eebd..33ddd762f 100755
--- a/scripts/gnt-cluster
+++ b/scripts/gnt-cluster
@@ -635,12 +635,7 @@ commands = {
                        help="Comma-separated list of hypervisors",
                        type="string",
                        default=constants.DEFAULT_ENABLED_HYPERVISOR),
-            cli_option("-H", "--hypervisor-parameters", dest="hvparams",
-                       help="Hypervisor and hypervisor options, in the format"
-                            " hypervisor:option=value,option=value,...",
-                       default=[],
-                       action="append",
-                       type="identkeyval"),
+            HVLIST_OPT,
             BACKEND_OPT,
             cli_option("-N", "--nic-parameters", dest="nicparams",
                        type="keyval", default={},
@@ -734,13 +729,7 @@ commands = {
               cli_option("--enabled-hypervisors", dest="enabled_hypervisors",
                          help="Comma-separated list of hypervisors",
                          type="string", default=None),
-              cli_option("-H", "--hypervisor-parameters", dest="hvparams",
-                         help="Hypervisor and hypervisor options, in the"
-                         " format"
-                         " hypervisor:option=value,option=value,...",
-                         default=[],
-                         action="append",
-                         type="identkeyval"),
+              HVLIST_OPT,
               BACKEND_OPT,
               cli_option("-N", "--nic-parameters", dest="nicparams",
                          type="keyval", default={},
-- 
GitLab