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’?
---
 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 1bde744..3f4d938 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 eeea8ee..33ddd76 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={},
-- 
1.6.3.3

Reply via email to