"add": cluster.node_add, "add-guest": cluster_command.node_add_guest, "add-outside": cluster.node_add_outside_cluster, "add-remote": cluster_command.node_add_remote, "clear": cluster_command.node_clear, "delete": cluster.node_remove, "delete-guest": cluster_command.node_remove_guest, "delete-remote": cluster_command.create_node_remove_remote( resource.resource_remove), "remove": cluster.node_remove, "remove-guest": cluster_command.node_remove_guest, "remove-remote": cluster_command.create_node_remove_remote( resource.resource_remove), }, ["cluster", "node"], ), "uidgid": cluster.cluster_uidgid, "corosync": cluster.cluster_get_corosync_conf, "reload":
"remove": cluster.link_remove, "update": cluster.link_update, }, ["cluster", "link"] ), "node": create_router( { "add": cluster.node_add, "add-guest": cluster_command.node_add_guest, "add-outside": cluster.node_add_outside_cluster, "add-remote": cluster_command.node_add_remote, "clear": cluster_command.node_clear, "delete": cluster.node_remove, "delete-guest": cluster_command.node_remove_guest, "delete-remote": cluster_command.create_node_remove_remote( resource.resource_remove ), "remove": cluster.node_remove, "remove-guest": cluster_command.node_remove_guest, "remove-remote": cluster_command.create_node_remove_remote( resource.resource_remove ), }, ["cluster", "node"] ), "uidgid": cluster.cluster_uidgid, "corosync": cluster.cluster_get_corosync_conf, "reload": cluster.cluster_reload, "destroy": cluster.cluster_destroy, "verify": cluster.cluster_verify, "report": cluster.cluster_report,
def cluster_cmd(argv): if len(argv) == 0: usage.cluster() exit(1) sub_cmd = argv.pop(0) if (sub_cmd == "help"): usage.cluster([" ".join(argv)] if argv else []) elif (sub_cmd == "setup"): try: cluster_setup(utils.get_library_wrapper(), argv, utils.get_modifiers()) except LibraryError as e: process_library_reports(e.args) except CmdLineInputError as e: utils.exit_on_cmdline_input_errror(e, "cluster", sub_cmd) elif (sub_cmd == "sync"): sync_nodes(utils.get_corosync_conf_facade().get_nodes_names(), utils.getCorosyncConf()) elif (sub_cmd == "status"): status.cluster_status(argv) elif (sub_cmd == "pcsd-status"): status.cluster_pcsd_status(argv) elif (sub_cmd == "certkey"): cluster_certkey(argv) elif (sub_cmd == "auth"): try: cluster_auth_cmd(utils.get_library_wrapper(), argv, utils.get_modifiers()) except LibraryError as e: process_library_reports(e.args) except CmdLineInputError as e: utils.exit_on_cmdline_input_errror(e, "cluster", sub_cmd) elif (sub_cmd == "start"): if "--all" in utils.pcs_options: if argv: utils.err(ERR_NODE_LIST_AND_ALL_MUTUALLY_EXCLUSIVE) start_cluster_all() else: start_cluster(argv) elif (sub_cmd == "stop"): if "--all" in utils.pcs_options: if argv: utils.err(ERR_NODE_LIST_AND_ALL_MUTUALLY_EXCLUSIVE) stop_cluster_all() else: stop_cluster(argv) elif (sub_cmd == "kill"): kill_cluster(argv) elif (sub_cmd == "standby"): try: node.node_standby_cmd(utils.get_library_wrapper(), argv, utils.get_modifiers(), True) except LibraryError as e: utils.process_library_reports(e.args) except CmdLineInputError as e: utils.exit_on_cmdline_input_errror(e, "node", "standby") elif (sub_cmd == "unstandby"): try: node.node_standby_cmd(utils.get_library_wrapper(), argv, utils.get_modifiers(), False) except LibraryError as e: utils.process_library_reports(e.args) except CmdLineInputError as e: utils.exit_on_cmdline_input_errror(e, "node", "unstandby") elif (sub_cmd == "enable"): if "--all" in utils.pcs_options: if argv: utils.err(ERR_NODE_LIST_AND_ALL_MUTUALLY_EXCLUSIVE) enable_cluster_all() else: enable_cluster(argv) elif (sub_cmd == "disable"): if "--all" in utils.pcs_options: if argv: utils.err(ERR_NODE_LIST_AND_ALL_MUTUALLY_EXCLUSIVE) disable_cluster_all() else: disable_cluster(argv) elif (sub_cmd == "remote-node"): try: cluster_remote_node(argv) except LibraryError as e: utils.process_library_reports(e.args) elif (sub_cmd == "cib"): get_cib(argv) elif (sub_cmd == "cib-push"): cluster_push(argv) elif (sub_cmd == "cib-upgrade"): utils.cluster_upgrade() elif (sub_cmd == "edit"): cluster_edit(argv) elif (sub_cmd == "node"): node_command_map = { "add": node_add, "add-guest": cluster_command.node_add_guest, "add-outside": node_add_outside_cluster, "add-remote": cluster_command.node_add_remote, "clear": cluster_command.node_clear, "remove": node_remove, "remove-guest": cluster_command.node_remove_guest, "remove-remote": cluster_command.create_node_remove_remote( resource.resource_remove), } if argv and argv[0] in node_command_map: try: node_command_map[argv[0]](utils.get_library_wrapper(), argv[1:], utils.get_modifiers()) except LibraryError as e: process_library_reports(e.args) except CmdLineInputError as e: utils.exit_on_cmdline_input_errror(e, "cluster", "node " + argv[0]) else: usage.cluster(["node"]) sys.exit(1) elif (sub_cmd == "uidgid"): cluster_uidgid(argv) elif (sub_cmd == "corosync"): cluster_get_corosync_conf(argv) elif (sub_cmd == "reload"): cluster_reload(argv) elif (sub_cmd == "destroy"): try: cluster_destroy(argv) except CmdLineInputError as e: utils.exit_on_cmdline_input_errror(e, "cluster", sub_cmd) elif (sub_cmd == "verify"): cluster_verify(argv) elif (sub_cmd == "report"): cluster_report(argv) elif (sub_cmd == "quorum"): if argv and argv[0] == "unblock": quorum.quorum_unblock_cmd(argv[1:]) else: usage.cluster() sys.exit(1) elif (sub_cmd == "remove_nodes_from_cib"): try: remove_nodes_from_cib( utils.get_library_wrapper(), argv, utils.get_modifiers(), ) except LibraryError as e: process_library_reports(e.args) except CmdLineInputError as e: utils.exit_on_cmdline_input_errror(e, "cluster", sub_cmd) else: usage.cluster() sys.exit(1)