Unify the last “--hypervisor” (as list) option
authorIustin Pop <iustin@google.com>
Thu, 17 Sep 2009 10:28:24 +0000 (12:28 +0200)
committerIustin Pop <iustin@google.com>
Fri, 18 Sep 2009 10:53:50 +0000 (12:53 +0200)
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
scripts/gnt-cluster

index 1bde744..3f4d938 100644 (file)
@@ -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.
index eeea8ee..33ddd76 100755 (executable)
@@ -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={},