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
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"])
secondary_ips=opts.use_replication_network,
nodegroup=opts.nodegroup)
- srun = ssh.SshRunner(cluster_name=cluster_name)
+ srun = ssh.SshRunner(cluster_name)
for node in results:
if not srun.CopyFileToNode(node, filename):
ToStderr("Copy of file %s to node %s failed", filename, node)
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"
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],