This also required a change, as one of the cases used a different
default.
---
lib/cli.py | 6 ++++++
scripts/gnt-cluster | 11 ++++-------
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/lib/cli.py b/lib/cli.py
index 3b414ed..9d5763a 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 b2ec12b..173f3de 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",
--
1.6.3.3