def quorum_cmd(lib, argv, modifiers): if not argv: sub_cmd, argv_next = "config", [] else: sub_cmd, argv_next = argv[0], argv[1:] try: if sub_cmd == "help": usage.quorum([" ".join(argv_next)] if argv_next else []) elif sub_cmd == "config": quorum_config_cmd(lib, argv_next, modifiers) elif sub_cmd == "expected-votes": quorum_expected_votes_cmd(lib, argv_next, modifiers) elif sub_cmd == "status": quorum_status_cmd(lib, argv_next, modifiers) elif sub_cmd == "device": quorum_device_cmd(lib, argv_next, modifiers) elif sub_cmd == "unblock": # TODO switch to new architecture quorum_unblock_cmd(lib, argv_next, modifiers) elif sub_cmd == "update": quorum_update_cmd(lib, argv_next, modifiers) else: raise CmdLineInputError() except LibraryError as e: utils.process_library_reports(e.args) except CmdLineInputError as e: utils.exit_on_cmdline_input_errror(e, "quorum", sub_cmd)
def quorum_cmd(lib, argv, modificators): if len(argv) < 1: sub_cmd, argv_next = "config", [] else: sub_cmd, argv_next = argv[0], argv[1:] try: if sub_cmd == "help": usage.quorum(argv) elif sub_cmd == "config": quorum_config_cmd(lib, argv_next, modificators) elif sub_cmd == "expected-votes": quorum_expected_votes_cmd(lib, argv_next, modificators) elif sub_cmd == "status": quorum_status_cmd(lib, argv_next, modificators) elif sub_cmd == "device": quorum_device_cmd(lib, argv_next, modificators) elif sub_cmd == "unblock": # TODO switch to new architecture quorum_unblock_cmd(argv_next) elif sub_cmd == "update": quorum_update_cmd(lib, argv_next, modificators) else: raise CmdLineInputError() except LibraryError as e: utils.process_library_reports(e.args) except CmdLineInputError as e: utils.exit_on_cmdline_input_errror(e, "quorum", sub_cmd)
def quorum_unblock_cmd(argv): if len(argv) > 0: usage.quorum(["unblock"]) sys.exit(1) if utils.is_rhel6(): utils.err("operation is not supported on CMAN clusters") output, retval = utils.run( ["corosync-cmapctl", "-g", "runtime.votequorum.wait_for_all_status"] ) if retval != 0: utils.err("unable to check quorum status") if output.split("=")[-1].strip() != "1": utils.err("cluster is not waiting for nodes to establish quorum") unjoined_nodes = ( set(utils.getNodesFromCorosyncConf()) - set(utils.getCorosyncActiveNodes()) ) if not unjoined_nodes: utils.err("no unjoined nodes found") if "--force" not in utils.pcs_options: answer = utils.get_terminal_input( ( "WARNING: If node(s) {nodes} are not powered off or they do" + " have access to shared resources, data corruption and/or" + " cluster failure may occur. Are you sure you want to" + " continue? [y/N] " ).format(nodes=", ".join(unjoined_nodes)) ) if answer.lower() not in ["y", "yes"]: print("Canceled") return for node in unjoined_nodes: stonith.stonith_confirm([node], skip_question=True) output, retval = utils.run( ["corosync-cmapctl", "-s", "quorum.cancel_wait_for_all", "u8", "1"] ) if retval != 0: utils.err("unable to cancel waiting for nodes") print("Quorum unblocked") startup_fencing = utils.get_set_properties().get("startup-fencing", "") utils.set_cib_property( "startup-fencing", "false" if startup_fencing.lower() != "false" else "true" ) utils.set_cib_property("startup-fencing", startup_fencing) print("Waiting for nodes canceled")
def quorum_cmd(lib, argv, modificators): if len(argv) < 1: usage.quorum() sys.exit(1) sub_cmd, argv_next = argv[0], argv[1:] try: if sub_cmd == "help": usage.quorum(argv) elif sub_cmd == "config": quorum_config_cmd(lib, argv_next, modificators) elif sub_cmd == "device": quorum_device_cmd(lib, argv_next, modificators) elif sub_cmd == "unblock": cluster_quorum_unblock(argv_next) elif sub_cmd == "update": quorum_update_cmd(lib, argv_next, modificators) else: raise CmdLineInputError() except LibraryError as e: utils.process_library_reports(e.args) except CmdLineInputError as e: utils.exit_on_cmdline_input_errror(e, "quorum", sub_cmd)
from pcs import ( quorum, usage, ) from pcs.cli.common.routing import create_router quorum_cmd = create_router( { "help": lambda lib, argv, modifiers: usage.quorum(argv), "config": quorum.quorum_config_cmd, "expected-votes": quorum.quorum_expected_votes_cmd, "status": quorum.quorum_status_cmd, "device": create_router( { "add": quorum.quorum_device_add_cmd, "heuristics": create_router( { "delete": quorum.quorum_device_heuristics_remove_cmd, "remove": quorum.quorum_device_heuristics_remove_cmd, }, ["quorum", "device", "heuristics"]), "delete": quorum.quorum_device_remove_cmd, "remove": quorum.quorum_device_remove_cmd,
from pcs import ( quorum, usage, ) from pcs.cli.common.routing import create_router quorum_cmd = create_router( { "help": lambda lib, argv, modifiers: usage.quorum(argv), "config": quorum.quorum_config_cmd, "expected-votes": quorum.quorum_expected_votes_cmd, "status": quorum.quorum_status_cmd, "device": create_router( { "add": quorum.quorum_device_add_cmd, "heuristics": create_router( { "delete": quorum.quorum_device_heuristics_remove_cmd, "remove": quorum.quorum_device_heuristics_remove_cmd, }, ["quorum", "device", "heuristics"] ), "delete": quorum.quorum_device_remove_cmd, "remove": quorum.quorum_device_remove_cmd, "status": quorum.quorum_device_status_cmd, "update": quorum.quorum_device_update_cmd, }, ["quorum", "device"] ), # TODO switch to new architecture
from pcs import ( quorum, usage, ) from pcs.cli.common.routing import create_router quorum_cmd = create_router( { "help": lambda lib, argv, modifiers: print(usage.quorum(argv)), "config": quorum.quorum_config_cmd, "expected-votes": quorum.quorum_expected_votes_cmd, "status": quorum.quorum_status_cmd, "device": create_router( { "add": quorum.quorum_device_add_cmd, "heuristics": create_router( { "delete": quorum.quorum_device_heuristics_remove_cmd, "remove": quorum.quorum_device_heuristics_remove_cmd, }, ["quorum", "device", "heuristics"], ), "delete": quorum.quorum_device_remove_cmd, "remove": quorum.quorum_device_remove_cmd, "status": quorum.quorum_device_status_cmd, "update": quorum.quorum_device_update_cmd, }, ["quorum", "device"], ), # TODO switch to new architecture