diff --git a/lib/cli.py b/lib/cli.py index 717d99efe408c68e7d48a4d040f21e315bc3d539..bcf8d8b828769e77c676a8ad179439469295ae91 100644 --- a/lib/cli.py +++ b/lib/cli.py @@ -56,6 +56,7 @@ __all__ = [ "DISK_OPT", "DISK_TEMPLATE_OPT", "DRAINED_OPT", + "ENABLED_HV_OPT", "FIELDS_OPT", "FILESTORE_DIR_OPT", "FILESTORE_DRIVER_OPT", @@ -721,6 +722,11 @@ NOLVM_STORAGE_OPT = cli_option("--no-lvm-storage", dest="lvm_storage", " (cluster-wide)", action="store_false", default=True) +ENABLED_HV_OPT = cli_option("--enabled-hypervisors", + dest="enabled_hypervisors", + help="Comma-separated list of hypervisors", + type="string", default=None) + def _ParseArgs(argv, commands, aliases): """Parser for the command line arguments. diff --git a/scripts/gnt-cluster b/scripts/gnt-cluster index b2ec12bd12c9534beb59912b7f60bf340303275f..173f3ded262b98792e2d446b612f184d55c35b88 100755 --- a/scripts/gnt-cluster +++ b/scripts/gnt-cluster @@ -58,6 +58,8 @@ def InitCluster(opts, args): vg_name = constants.DEFAULT_VG hvlist = opts.enabled_hypervisors + if hvlist is None: + hvlist = constants.DEFAULT_ENABLED_HYPERVISOR hvlist = hvlist.split(",") hvparams = dict(opts.hvparams) @@ -617,10 +619,7 @@ commands = { help="Don't modify /etc/hosts" " (cluster-wide)", action="store_false", default=True,), - cli_option("--enabled-hypervisors", dest="enabled_hypervisors", - help="Comma-separated list of hypervisors", - type="string", - default=constants.DEFAULT_ENABLED_HYPERVISOR), + ENABLED_HV_OPT, HVLIST_OPT, BACKEND_OPT, cli_option("-N", "--nic-parameters", dest="nicparams", @@ -710,9 +709,7 @@ commands = { "and enable lvm based storage", metavar="VG",), NOLVM_STORAGE_OPT, - cli_option("--enabled-hypervisors", dest="enabled_hypervisors", - help="Comma-separated list of hypervisors", - type="string", default=None), + ENABLED_HV_OPT, HVLIST_OPT, BACKEND_OPT, cli_option("-N", "--nic-parameters", dest="nicparams",