示例#1
0
def config_show_cib():
    lib = utils.get_library_wrapper()
    modifiers = utils.get_modifiers()

    print("Resources:")
    utils.pcs_options["--all"] = 1
    utils.pcs_options["--full"] = 1
    resource.resource_show([])

    print()
    print("Stonith Devices:")
    resource.resource_show([], True)
    print("Fencing Levels:")
    levels = stonith.stonith_level_config_to_str(
        lib.fencing_topology.get_config())
    if levels:
        print("\n".join(indent(levels, 2)))

    print()
    constraint.location_show([])
    order_command.show(lib, [], modifiers)
    colocation_command.show(lib, [], modifiers)
    ticket_command.show(lib, [], modifiers)

    print()
    alert.print_alert_config(lib, [], modifiers)

    print()
    del utils.pcs_options["--all"]
    print("Resources Defaults:")
    resource.show_defaults("rsc_defaults", indent=" ")
    print("Operations Defaults:")
    resource.show_defaults("op_defaults", indent=" ")
    print()
    prop.list_property([])
示例#2
0
文件: config.py 项目: dchirikov/pcs
def config_show_cib():
    print("Resources:")
    utils.pcs_options["--all"] = 1
    utils.pcs_options["--full"] = 1
    resource.resource_show([])
    print()
    print("Stonith Devices:")
    resource.resource_show([], True)
    print("Fencing Levels:")
    stonith.stonith_level_show()
    print()

    lib = utils.get_library_wrapper()
    constraint.location_show([])
    modificators = utils.get_modificators()
    order_command.show(lib, [], modificators)
    colocation_command.show(lib, [], modificators)
    ticket_command.show(lib, [], modificators)

    print()
    alert.print_alert_config(lib, [], modificators)

    print()
    del utils.pcs_options["--all"]
    print("Resources Defaults:")
    resource.show_defaults("rsc_defaults", indent=" ")
    print("Operations Defaults:")
    resource.show_defaults("op_defaults", indent=" ")
    print()
    prop.list_property([])
示例#3
0
def status_cmd(lib, argv, modifiers):
    if len(argv) < 1:
        full_status()
        sys.exit(0)

    sub_cmd, argv_next = argv[0], argv[1:]
    try:
        if sub_cmd == "help":
            usage.status(argv_next)
        elif sub_cmd == "booth":
            booth_status_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "corosync":
            corosync_status()
        elif sub_cmd == "cluster":
            cluster_status(argv_next)
        elif sub_cmd == "groups":
            resource.resource_group_list(argv_next)
        elif sub_cmd == "nodes":
            nodes_status(argv_next)
        elif sub_cmd == "pcsd":
            cluster_pcsd_status(argv_next)
        elif sub_cmd == "qdevice":
            qdevice_status_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "quorum":
            quorum_status_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "resources":
            resource.resource_show(argv_next)
        elif sub_cmd == "xml":
            xml_status()
        else:
            raise CmdLineInputError()
    except LibraryError as e:
        utils.process_library_reports(e.args)
    except CmdLineInputError as e:
        utils.exit_on_cmdline_input_errror(e, "status", sub_cmd)
示例#4
0
文件: status.py 项目: johnruemker/pcs
def status_cmd(argv):
    if len(argv) == 0:
        full_status()
        sys.exit(0)

    sub_cmd = argv.pop(0)
    if (sub_cmd == "help"):
        usage.status(argv)
    elif (sub_cmd == "resources"):
        resource.resource_show(argv)
    elif (sub_cmd == "groups"):
        resource.resource_group_list(argv)
    elif (sub_cmd == "cluster"):
        cluster_status(argv)
    elif (sub_cmd == "nodes"):
        nodes_status(argv)
    elif (sub_cmd == "pcsd"):
        cluster_pcsd_status(argv)
    elif (sub_cmd == "xml"):
        xml_status()
    elif (sub_cmd == "corosync"):
        corosync_status()
    else:
        usage.status()
        sys.exit(1)
示例#5
0
文件: stonith.py 项目: OndrejHome/pcs
def stonith_cmd(argv):
    if len(argv) < 1:
        sub_cmd, argv_next = "show", []
    else:
        sub_cmd, argv_next = argv[0], argv[1:]

    lib = utils.get_library_wrapper()
    modifiers = utils.get_modifiers()

    try:
        if sub_cmd == "help":
            usage.stonith([" ".join(argv_next)] if argv_next else [])
        elif sub_cmd == "list":
            stonith_list_available(lib, argv_next, modifiers)
        elif sub_cmd == "describe":
            stonith_list_options(lib, argv_next, modifiers)
        elif sub_cmd == "create":
            stonith_create(lib, argv_next, modifiers)
        elif sub_cmd == "update":
            if len(argv_next) > 1:
                stn_id = argv_next.pop(0)
                resource.resource_update(stn_id, argv_next)
            else:
                raise CmdLineInputError()
        elif sub_cmd == "delete":
            if len(argv_next) == 1:
                stn_id = argv_next.pop(0)
                resource.resource_remove(stn_id)
            else:
                raise CmdLineInputError()
        elif sub_cmd == "show":
            resource.resource_show(argv_next, True)
            levels = stonith_level_config_to_str(
                lib.fencing_topology.get_config())
            if levels:
                print("\n".join(indent(levels, 1)))
        elif sub_cmd == "level":
            stonith_level_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "fence":
            stonith_fence(argv_next)
        elif sub_cmd == "cleanup":
            resource.resource_cleanup(argv_next)
        elif sub_cmd == "refresh":
            resource.resource_refresh(argv_next)
        elif sub_cmd == "confirm":
            stonith_confirm(argv_next)
        elif sub_cmd == "get_fence_agent_info":
            get_fence_agent_info(argv_next)
        elif sub_cmd == "sbd":
            sbd_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "enable":
            resource.resource_enable_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "disable":
            resource.resource_disable_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, "stonith", sub_cmd)
示例#6
0
def stonith_cmd(argv):
    if len(argv) < 1:
        sub_cmd, argv_next = "show", []
    else:
        sub_cmd, argv_next = argv[0], argv[1:]

    lib = utils.get_library_wrapper()
    modifiers = utils.get_modificators()

    try:
        if sub_cmd == "help":
            usage.stonith(argv)
        elif sub_cmd == "list":
            stonith_list_available(lib, argv_next, modifiers)
        elif sub_cmd == "describe":
            stonith_list_options(lib, argv_next, modifiers)
        elif sub_cmd == "create":
            stonith_create(lib, argv_next, modifiers)
        elif sub_cmd == "update":
            if len(argv_next) > 1:
                stn_id = argv_next.pop(0)
                resource.resource_update(stn_id, argv_next)
            else:
                raise CmdLineInputError()
        elif sub_cmd == "delete":
            if len(argv_next) == 1:
                stn_id = argv_next.pop(0)
                resource.resource_remove(stn_id)
            else:
                raise CmdLineInputError()
        elif sub_cmd == "show":
            resource.resource_show(argv_next, True)
            levels = stonith_level_config_to_str(
                lib.fencing_topology.get_config()
            )
            if levels:
                print("\n".join(indent(levels, 1)))
        elif sub_cmd == "level":
            stonith_level_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "fence":
            stonith_fence(argv_next)
        elif sub_cmd == "cleanup":
            resource.resource_cleanup(argv_next)
        elif sub_cmd == "confirm":
            stonith_confirm(argv_next)
        elif sub_cmd == "get_fence_agent_info":
            get_fence_agent_info(argv_next)
        elif sub_cmd == "sbd":
            sbd_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "enable":
            resource.resource_enable(argv_next)
        elif sub_cmd == "disable":
            resource.resource_disable(argv_next)
        else:
            raise CmdLineInputError()
    except LibraryError as e:
        utils.process_library_reports(e.args)
    except CmdLineInputError as e:
        utils.exit_on_cmdline_input_errror(e, "stonith", sub_cmd)
示例#7
0
def stonith_cmd(lib, argv, modifiers):
    if argv:
        sub_cmd, argv_next = argv[0], argv[1:]
    else:
        sub_cmd, argv_next = "status", []

    try:
        if sub_cmd == "help":
            usage.stonith([" ".join(argv_next)] if argv_next else [])
        elif sub_cmd == "list":
            stonith_list_available(lib, argv_next, modifiers)
        elif sub_cmd == "describe":
            stonith_list_options(lib, argv_next, modifiers)
        elif sub_cmd == "create":
            stonith_create(lib, argv_next, modifiers)
        elif sub_cmd == "update":
            resource.resource_update(lib, argv_next, modifiers)
        elif sub_cmd in {"delete", "remove"}:
            resource.resource_remove_cmd(lib, argv_next, modifiers)
        # TODO remove, deprecated command
        # replaced with 'stonith status' and 'stonith config'
        elif sub_cmd == "show":
            resource.resource_show(lib, argv_next, modifiers, stonith=True)
            print_stonith_levels(lib)
        elif sub_cmd == "status":
            resource.resource_status(lib, argv_next, modifiers, stonith=True)
            print_stonith_levels(lib)
        elif sub_cmd == "config":
            resource.resource_config(lib, argv_next, modifiers, stonith=True)
            print_stonith_levels(lib)
        elif sub_cmd == "level":
            stonith_level_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "fence":
            stonith_fence(lib, argv_next, modifiers)
        elif sub_cmd == "cleanup":
            resource.resource_cleanup(lib, argv_next, modifiers)
        elif sub_cmd == "refresh":
            resource.resource_refresh(lib, argv_next, modifiers)
        elif sub_cmd == "confirm":
            stonith_confirm(lib, argv_next, modifiers)
        elif sub_cmd == "get_fence_agent_info":
            get_fence_agent_info(lib, argv_next, modifiers)
        elif sub_cmd == "sbd":
            sbd_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "enable":
            resource.resource_enable_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "disable":
            resource.resource_disable_cmd(lib, argv_next, modifiers)
        elif sub_cmd == "history":
            stonith_history_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, "stonith", sub_cmd)
示例#8
0
文件: stonith.py 项目: dchirikov/pcs
def stonith_cmd(argv):
    lib = utils.get_library_wrapper()
    modifiers = utils.get_modificators()
    if len(argv) == 0:
        argv = ["show"]

    sub_cmd = argv.pop(0)
    try:
        if (sub_cmd == "help"):
            usage.stonith(argv)
        elif (sub_cmd == "list"):
            stonith_list_available(argv)
        elif (sub_cmd == "describe"):
            if len(argv) == 1:
                stonith_list_options(argv[0])
            else:
                raise CmdLineInputError()
        elif (sub_cmd == "create"):
            stonith_create(argv)
        elif (sub_cmd == "update"):
            if len(argv) > 1:
                stn_id = argv.pop(0)
                resource.resource_update(stn_id,argv)
            else:
                raise CmdLineInputError()
        elif (sub_cmd == "delete"):
            if len(argv) == 1:
                stn_id = argv.pop(0)
                resource.resource_remove(stn_id)
            else:
                raise CmdLineInputError()
        elif (sub_cmd == "show"):
            resource.resource_show(argv, True)
            stonith_level([])
        elif (sub_cmd == "level"):
            stonith_level(argv)
        elif (sub_cmd == "fence"):
            stonith_fence(argv)
        elif (sub_cmd == "cleanup"):
            resource.resource_cleanup(argv)
        elif (sub_cmd == "confirm"):
            stonith_confirm(argv)
        elif (sub_cmd == "get_fence_agent_info"):
            get_fence_agent_info(argv)
        elif (sub_cmd == "sbd"):
            sbd_cmd(lib, argv, 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, "stonith", sub_cmd)
示例#9
0
def stonith_cmd(argv):
    if len(argv) == 0:
        argv = ["show"]

    sub_cmd = argv.pop(0)
    if (sub_cmd == "help"):
        usage.stonith(argv)
    elif (sub_cmd == "list"):
        stonith_list_available(argv)
    elif (sub_cmd == "describe"):
        if len(argv) == 1:
            stonith_list_options(argv[0])
        else:
            usage.stonith()
            sys.exit(1)
    elif (sub_cmd == "create"):
        stonith_create(argv)
    elif (sub_cmd == "update"):
        if len(argv) > 1:
            stn_id = argv.pop(0)
            resource.resource_update(stn_id,argv)
        else:
            usage.stonith(["update"])
            sys.exit(1)
    elif (sub_cmd == "delete"):
        if len(argv) == 1:
            stn_id = argv.pop(0)
            resource.resource_remove(stn_id)
        else:
            usage.stonith(["delete"])
            sys.exit(1)
    elif (sub_cmd == "show"):
        resource.resource_show(argv, True)
        stonith_level([])
    elif (sub_cmd == "level"):
        stonith_level(argv)
    elif (sub_cmd == "fence"):
        stonith_fence(argv)
    elif (sub_cmd == "cleanup"):
        try:
            resource.resource_cleanup(argv)
        except utils.CmdLineInputError as e:
            exit_on_cmdline_input_errror('cleanup')
        except LibraryError as e:
            utils.process_library_reports(e.args)
    elif (sub_cmd == "confirm"):
        stonith_confirm(argv)
    elif (sub_cmd == "get_fence_agent_info"):
        get_fence_agent_info(argv)
    else:
        usage.stonith()
        sys.exit(1)
示例#10
0
def stonith_cmd(argv):
    if len(argv) < 1:
        sub_cmd, argv_next = "show", []
    else:
        sub_cmd, argv_next = argv[0], argv[1:]

    lib = utils.get_library_wrapper()
    modifiers = utils.get_modificators()

    try:
        if sub_cmd == "help":
            usage.stonith(argv)
        elif sub_cmd == "list":
            stonith_list_available(lib, argv_next, modifiers)
        elif sub_cmd == "describe":
            stonith_list_options(lib, argv_next, modifiers)
        elif sub_cmd == "create":
            stonith_create(argv_next)
        elif sub_cmd == "update":
            if len(argv_next) > 1:
                stn_id = argv_next.pop(0)
                resource.resource_update(stn_id, argv_next)
            else:
                raise CmdLineInputError()
        elif sub_cmd == "delete":
            if len(argv_next) == 1:
                stn_id = argv_next.pop(0)
                resource.resource_remove(stn_id)
            else:
                raise CmdLineInputError()
        elif sub_cmd == "show":
            resource.resource_show(argv_next, True)
            stonith_level([])
        elif sub_cmd == "level":
            stonith_level(argv_next)
        elif sub_cmd == "fence":
            stonith_fence(argv_next)
        elif sub_cmd == "cleanup":
            resource.resource_cleanup(argv_next)
        elif sub_cmd == "confirm":
            stonith_confirm(argv_next)
        elif sub_cmd == "get_fence_agent_info":
            get_fence_agent_info(argv_next)
        elif sub_cmd == "sbd":
            sbd_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, "stonith", sub_cmd)
示例#11
0
def status_cmd(argv):
    if len(argv) == 0:
        full_status()
        sys.exit(0)

    sub_cmd = argv.pop(0)
    if (sub_cmd == "help"):
        usage.status(argv)
    elif (sub_cmd == "resources"):
        resource.resource_show(argv)
    elif (sub_cmd == "groups"):
        resource.resource_group_list(argv)
    elif (sub_cmd == "cluster"):
        cluster_status(argv)
    elif (sub_cmd == "nodes"):
        nodes_status(argv)
    elif (sub_cmd == "pcsd"):
        cluster_pcsd_status(argv)
    elif (sub_cmd == "xml"):
        xml_status()
    elif (sub_cmd == "corosync"):
        corosync_status()
    elif sub_cmd == "qdevice":
        try:
            qdevice_status_cmd(
                utils.get_library_wrapper(),
                argv,
                utils.get_modificators()
            )
        except LibraryError as e:
            utils.process_library_reports(e.args)
        except CmdLineInputError as e:
            utils.exit_on_cmdline_input_errror(e, "status", sub_cmd)
    elif sub_cmd == "quorum":
        try:
            quorum_status_cmd(
                utils.get_library_wrapper(),
                argv,
                utils.get_modificators()
            )
        except LibraryError as e:
            utils.process_library_reports(e.args)
        except CmdLineInputError as e:
            utils.exit_on_cmdline_input_errror(e, "status", sub_cmd)
    else:
        usage.status()
        sys.exit(1)
示例#12
0
文件: config.py 项目: johnruemker/pcs
def config_show_cib():
    print("Resources:")
    utils.pcs_options["--all"] = 1
    utils.pcs_options["--full"] = 1
    resource.resource_show([])
    print()
    print("Stonith Devices:")
    resource.resource_show([], True)
    print("Fencing Levels:")
    print()
    stonith.stonith_level_show()
    constraint.location_show([])
    constraint.order_show([])
    constraint.colocation_show([])
    print()
    del utils.pcs_options["--all"]
    print("Resources Defaults:")
    resource.show_defaults("rsc_defaults", indent=" ")
    print("Operations Defaults:")
    resource.show_defaults("op_defaults", indent=" ")
    print()
    prop.list_property([])
示例#13
0
def stonith_show_cmd(lib, argv, modifiers):
    # TODO remove, deprecated command
    # replaced with 'stonith status' and 'stonith config'
    resource.resource_show(lib, argv, modifiers, stonith=True)
    print_stonith_levels(lib)
示例#14
0
def stonith_show_cmd(lib, argv, modifiers):
    # TODO remove, deprecated command
    # replaced with 'stonith status' and 'stonith config'
    resource.resource_show(lib, argv, modifiers, stonith=True)
    print_stonith_levels(lib)