action="store_true", dest="groups",
help="Arguments are node groups instead of nodes")
-SHOW_MACHINE_OPT = cli_option("-M", "--show-machine-names", default=False,
- action="store_true",
- help="Show machine name for every line in output")
+FORCE_FAILOVER = cli_option("--yes-do-it", dest="yes_do_it",
+ help="Override interactive check for --no-voting",
+ default=False, action="store_true")
_EPO_PING_INTERVAL = 30 # 30 seconds between pings
_EPO_PING_TIMEOUT = 1 # 1 second
hv_state = dict(opts.hv_state)
+ enabled_storage_types = opts.enabled_storage_types
+ if enabled_storage_types is not None:
+ enabled_storage_types = enabled_storage_types.split(",")
+ else:
+ enabled_storage_types = list(constants.DEFAULT_ENABLED_STORAGE_TYPES)
+
bootstrap.InitCluster(cluster_name=args[0],
secondary_ip=opts.secondary_ip,
vg_name=vg_name,
use_external_mip_script=external_ip_setup_script,
hv_state=hv_state,
disk_state=disk_state,
+ enabled_storage_types=enabled_storage_types,
)
op = opcodes.OpClusterPostInit()
SubmitOpCode(op, opts=opts)
result["shared_file_storage_dir"])
ToStdout(" - maintenance of node health: %s",
result["maintain_node_health"])
- ToStdout(" - uid pool: %s",
- uidpool.FormatUidPool(result["uid_pool"],
- roman=opts.roman_integers))
+ ToStdout(" - uid pool: %s", uidpool.FormatUidPool(result["uid_pool"]))
ToStdout(" - default instance allocator: %s", result["default_iallocator"])
ToStdout(" - primary ip version: %d", result["primary_ip_version"])
ToStdout(" - preallocation wipe disks: %s", result["prealloc_wipe_disks"])
ToStdout(" - OS search path: %s", utils.CommaJoin(pathutils.OS_SEARCH_PATH))
+ ToStdout(" - ExtStorage Providers search path: %s",
+ utils.CommaJoin(pathutils.ES_SEARCH_PATH))
+ ToStdout(" - enabled storage types: %s",
+ utils.CommaJoin(result["enabled_storage_types"]))
ToStdout("Default node parameters:")
_PrintGroupedParams(result["ndparams"], roman=opts.roman_integers)
for name in nodes:
result = srun.Run(name, constants.SSH_LOGIN_USER, command)
+
+ if opts.failure_only and result.exit_code == constants.EXIT_SUCCESS:
+ # Do not output anything for successful commands
+ continue
+
ToStdout("------------------------------------------------")
if opts.show_machine_names:
for line in result.output.splitlines():
@return: the desired exit code
"""
- if opts.no_voting:
+ if opts.no_voting and not opts.yes_do_it:
usertext = ("This will perform the failover even if most other nodes"
" are down, or if this node is outdated. This is dangerous"
" as it can lead to a non-consistent cluster. Check the"
opts.use_external_mip_script is not None or
opts.prealloc_wipe_disks is not None or
opts.hv_state or
+ opts.enabled_storage_types or
opts.disk_state or
opts.ispecs_mem_size or
opts.ispecs_cpu_count or
if hvlist is not None:
hvlist = hvlist.split(",")
+ enabled_storage_types = opts.enabled_storage_types
+ if enabled_storage_types is not None:
+ enabled_storage_types = enabled_storage_types.split(",")
+
# a list of (name, dict) we can pass directly to dict() (or [])
hvparams = dict(opts.hvparams)
for hv_params in hvparams.values():
hv_state = dict(opts.hv_state)
- op = opcodes.OpClusterSetParams(vg_name=vg_name,
- drbd_helper=drbd_helper,
- enabled_hypervisors=hvlist,
- hvparams=hvparams,
- os_hvp=None,
- beparams=beparams,
- nicparams=nicparams,
- ndparams=ndparams,
- diskparams=diskparams,
- ipolicy=ipolicy,
- candidate_pool_size=opts.candidate_pool_size,
- maintain_node_health=mnh,
- uid_pool=uid_pool,
- add_uids=add_uids,
- remove_uids=remove_uids,
- default_iallocator=opts.default_iallocator,
- prealloc_wipe_disks=opts.prealloc_wipe_disks,
- master_netdev=opts.master_netdev,
- master_netmask=opts.master_netmask,
- reserved_lvs=opts.reserved_lvs,
- use_external_mip_script=ext_ip_script,
- hv_state=hv_state,
- disk_state=disk_state,
- )
+ op = opcodes.OpClusterSetParams(
+ vg_name=vg_name,
+ drbd_helper=drbd_helper,
+ enabled_hypervisors=hvlist,
+ hvparams=hvparams,
+ os_hvp=None,
+ beparams=beparams,
+ nicparams=nicparams,
+ ndparams=ndparams,
+ diskparams=diskparams,
+ ipolicy=ipolicy,
+ candidate_pool_size=opts.candidate_pool_size,
+ maintain_node_health=mnh,
+ uid_pool=uid_pool,
+ add_uids=add_uids,
+ remove_uids=remove_uids,
+ default_iallocator=opts.default_iallocator,
+ prealloc_wipe_disks=opts.prealloc_wipe_disks,
+ master_netdev=opts.master_netdev,
+ master_netmask=opts.master_netmask,
+ reserved_lvs=opts.reserved_lvs,
+ use_external_mip_script=ext_ip_script,
+ hv_state=hv_state,
+ disk_state=disk_state,
+ enabled_storage_types=enabled_storage_types,
+ )
SubmitOrSend(op, opts)
return 0
MAINTAIN_NODE_HEALTH_OPT, UIDPOOL_OPT, DRBD_HELPER_OPT, NODRBD_STORAGE_OPT,
DEFAULT_IALLOCATOR_OPT, PRIMARY_IP_VERSION_OPT, PREALLOC_WIPE_DISKS_OPT,
NODE_PARAMS_OPT, GLOBAL_SHARED_FILEDIR_OPT, USE_EXTERNAL_MIP_SCRIPT,
- DISK_PARAMS_OPT, HV_STATE_OPT, DISK_STATE_OPT] + INSTANCE_POLICY_OPTS,
+ DISK_PARAMS_OPT, HV_STATE_OPT, DISK_STATE_OPT, ENABLED_STORAGE_TYPES_OPT]
+ + INSTANCE_POLICY_OPTS,
"[opts...] <cluster_name>", "Initialises a new cluster configuration"),
"destroy": (
DestroyCluster, ARGS_NONE, [YES_DOIT_OPT],
RepairDiskSizes, ARGS_MANY_INSTANCES, [DRY_RUN_OPT, PRIORITY_OPT],
"[instance...]", "Updates mismatches in recorded disk sizes"),
"master-failover": (
- MasterFailover, ARGS_NONE, [NOVOTING_OPT],
+ MasterFailover, ARGS_NONE, [NOVOTING_OPT, FORCE_FAILOVER],
"", "Makes the current node the master"),
"master-ping": (
MasterPing, ARGS_NONE, [],
"[-n node...] <filename>", "Copies a file to all (or only some) nodes"),
"command": (
RunClusterCommand, [ArgCommand(min=1)],
- [NODE_LIST_OPT, NODEGROUP_OPT, SHOW_MACHINE_OPT],
+ [NODE_LIST_OPT, NODEGROUP_OPT, SHOW_MACHINE_OPT, FAILURE_ONLY_OPT],
"[-n node...] <command>", "Runs a command on all (or only some) nodes"),
"info": (
ShowClusterConfig, ARGS_NONE, [ROMAN_OPT],
DRBD_HELPER_OPT, NODRBD_STORAGE_OPT, DEFAULT_IALLOCATOR_OPT,
RESERVED_LVS_OPT, DRY_RUN_OPT, PRIORITY_OPT, PREALLOC_WIPE_DISKS_OPT,
NODE_PARAMS_OPT, USE_EXTERNAL_MIP_SCRIPT, DISK_PARAMS_OPT, HV_STATE_OPT,
- DISK_STATE_OPT, SUBMIT_OPT] +
+ DISK_STATE_OPT, SUBMIT_OPT, ENABLED_STORAGE_TYPES_OPT] +
INSTANCE_POLICY_OPTS,
"[opts...]",
"Alters the parameters of the cluster"),