# 02110-1301, USA.
+# pylint: disable-msg=W0401,W0614
+# W0401: Wildcard import ganeti.cli
+# W0614: Unused import %s from wildcard import (since we need cli)
+
import sys
from optparse import make_option
import os.path
from ganeti import utils
from ganeti import bootstrap
from ganeti import ssh
-from ganeti import ssconf
def InitCluster(opts, args):
if hvlist is not None:
hvlist = hvlist.split(",")
else:
- hvlist = constants.DEFAULT_ENABLED_HYPERVISOR
+ hvlist = [constants.DEFAULT_ENABLED_HYPERVISOR]
+
+ # avoid an impossible situation
+ if opts.default_hypervisor in hvlist:
+ default_hypervisor = opts.default_hypervisor
+ else:
+ default_hypervisor = hvlist[0]
hvparams = opts.hvparams
if hvparams:
master_netdev=opts.master_netdev,
file_storage_dir=opts.file_storage_dir,
enabled_hypervisors=hvlist,
+ default_hypervisor=default_hypervisor,
hvparams=hvparams,
beparams=beparams)
return 0
ToStdout("Architecture (this node): %s (%s)",
result["architecture"][0], result["architecture"][1])
- ToStdout("Default hypervisor: %s", result["hypervisor_type"])
+ ToStdout("Default hypervisor: %s", result["default_hypervisor"])
ToStdout("Enabled hypervisors: %s", ", ".join(result["enabled_hypervisors"]))
ToStdout("Hypervisor parameters:")
make_option("--enabled-hypervisors", dest="enabled_hypervisors",
help="Comma-separated list of hypervisors",
type="string", default=None),
+ make_option("-t", "--default-hypervisor",
+ dest="default_hypervisor",
+ help="Default hypervisor to use for instance creation",
+ choices=list(constants.HYPER_TYPES),
+ default=constants.DEFAULT_ENABLED_HYPERVISOR),
ikv_option("-H", "--hypervisor-parameters", dest="hvparams",
help="Hypervisor and hypervisor options, in the"
" format"