diff --git a/lib/cli.py b/lib/cli.py index feb680e68d8d8ef79e2b4739eb0a469ef9c74b17..e3e67b418a43668216598f828d17cec2b0b00b2d 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -102,6 +102,7 @@ __all__ = [ "TAG_SRC_OPT", "USEUNITS_OPT", "VERBOSE_OPT", + "VG_NAME_OPT", # Generic functions for CLI programs "GenericMain", "GetClient", @@ -737,6 +738,12 @@ CP_SIZE_OPT = cli_option("-C", "--candidate-pool-size", default=None, dest="candidate_pool_size", type="int", help="Set the candidate pool size") +VG_NAME_OPT = cli_option("-g", "--vg-name", dest="vg_name", + help="Enables LVM and specifies the volume group" + " name (cluster-wide) for disk allocation [xenvg]", + metavar="VG", default=None) + + def _ParseArgs(argv, commands, aliases): """Parser for the command line arguments. diff --git a/scripts/gnt-cluster b/scripts/gnt-cluster index 32e012e296eb5eb33800ffeca844419f65ce072d..d6191d981b5b786196c922ae0585f1383f736b29 100755 --- a/scripts/gnt-cluster +++ b/scripts/gnt-cluster @@ -600,11 +600,7 @@ commands = { " addresses, in the format XX:XX:XX", metavar="PREFIX", default=constants.DEFAULT_MAC_PREFIX,), - cli_option("-g", "--vg-name", dest="vg_name", - help="Specify the volume group name " - " (cluster-wide) for disk allocation [xenvg]", - metavar="VG", - default=None,), + VG_NAME_OPT, cli_option("--master-netdev", dest="master_netdev", help="Specify the node interface (cluster-wide)" " on which the master IP address will be added " @@ -700,19 +696,8 @@ commands = { [DEBUG_OPT], "{pause <timespec>|continue|info}", "Change watcher properties"), 'modify': (SetClusterParams, ARGS_NONE, - [DEBUG_OPT, - cli_option("-g", "--vg-name", dest="vg_name", - help="Specify the volume group name " - " (cluster-wide) for disk allocation " - "and enable lvm based storage", - metavar="VG",), - NOLVM_STORAGE_OPT, - ENABLED_HV_OPT, - HVLIST_OPT, - BACKEND_OPT, - NIC_PARAMS_OPT, - CP_SIZE_OPT, - ], + [DEBUG_OPT, BACKEND_OPT, CP_SIZE_OPT, ENABLED_HV_OPT, HVLIST_OPT, + NIC_PARAMS_OPT, NOLVM_STORAGE_OPT, VG_NAME_OPT], "[opts...]", "Alters the parameters of the cluster"), }