Beispiel #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([])
Beispiel #2
0
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([])
Beispiel #3
0
def config_show_cib(lib):
    """
    Commandline options:
      * -f - CIB file
    """
    print("Resources:")
    # update of pcs_options will change output of constraint show
    utils.pcs_options["--full"] = 1
    # get latest modifiers object after updating pcs_options
    modifiers = utils.get_input_modifiers()
    resource.resource_config(lib, [], modifiers.get_subset("-f"))

    print()
    print("Stonith Devices:")
    resource.resource_config(
        lib,
        [],
        modifiers.get_subset("-f"),
        stonith=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(lib, [], modifiers.get_subset("-f", "--full"))
    order_command.show(lib, [], modifiers.get_subset("-f", "--full"))
    colocation_command.show(lib, [], modifiers.get_subset("-f", "--full"))
    ticket_command.show(lib, [], modifiers.get_subset("-f", "--full"))

    print()
    alert.print_alert_config(lib, [], modifiers.get_subset("-f"))

    print()
    print("Resources Defaults:")
    resource.show_defaults("rsc_defaults", indent=" ")
    print("Operations Defaults:")
    resource.show_defaults("op_defaults", indent=" ")
    print()
    prop.list_property(lib, [],
                       modifiers.get_subset("--defaults", "--all", "-f"))
Beispiel #4
0
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([])
Beispiel #5
0
def _config_show_cib_lines(lib):
    """
    Commandline options:
      * -f - CIB file
    """
    # update of pcs_options will change output of constraint show
    utils.pcs_options["--full"] = 1
    # get latest modifiers object after updating pcs_options
    modifiers = utils.get_input_modifiers()
    cib_xml = utils.get_cib()
    cib_etree = utils.get_cib_etree(cib_xml=cib_xml)
    cib_dom = utils.get_cib_dom(cib_xml=cib_xml)

    resource_lines = []
    stonith_lines = []
    for resource_el in cib_etree.find(".//resources"):
        is_stonith = ("class" in resource_el.attrib
                      and resource_el.attrib["class"] == "stonith")
        resource_el_lines = resource.resource_node_lines(resource_el)
        if is_stonith:
            stonith_lines += resource_el_lines
        else:
            resource_lines += resource_el_lines

    all_lines = []

    all_lines.append("Resources:")
    all_lines.extend(indent(resource_lines, indent_step=1))
    all_lines.append("")
    all_lines.append("Stonith Devices:")
    all_lines.extend(indent(stonith_lines, indent_step=1))
    all_lines.append("Fencing Levels:")
    levels_lines = stonith.stonith_level_config_to_str(
        lib.fencing_topology.get_config())
    if levels_lines:
        all_lines.extend(indent(levels_lines, indent_step=2))

    all_lines.append("")
    constraints_element = cib_dom.getElementsByTagName("constraints")[0]
    all_lines.extend(
        constraint.location_lines(
            constraints_element,
            showDetail=True,
            show_expired=True,
            verify_expiration=False,
        ))
    all_lines.extend(
        constraint_command.show(
            "Ordering Constraints:",
            lib.constraint_order.show,
            constraints_reports.order_plain,
            modifiers.get_subset("-f", "--full"),
        ))
    all_lines.extend(
        constraint_command.show(
            "Colocation Constraints:",
            lib.constraint_colocation.show,
            constraints_reports.colocation_plain,
            modifiers.get_subset("-f", "--full"),
        ))
    all_lines.extend(
        constraint_command.show(
            "Ticket Constraints:",
            lib.constraint_ticket.show,
            constraints_reports.ticket_plain,
            modifiers.get_subset("-f", "--full"),
        ))

    all_lines.append("")
    all_lines.extend(alert.alert_config_lines(lib))

    all_lines.append("")
    all_lines.append("Resources Defaults:")
    all_lines.extend(
        indent(resource.show_defaults(cib_dom, "rsc_defaults"), indent_step=1))
    all_lines.append("Operations Defaults:")
    all_lines.extend(
        indent(resource.show_defaults(cib_dom, "op_defaults"), indent_step=1))

    all_lines.append("")
    all_lines.append("Cluster Properties:")
    properties = utils.get_set_properties()
    all_lines.extend(
        indent(
            [
                "{0}: {1}".format(prop, val)
                for prop, val in sorted(properties.items())
            ],
            indent_step=1,
        ))
    all_lines.append("")
    all_lines.append("Tags:")
    tags = lib.tag.config([])
    if not tags:
        all_lines.append(" No tags defined")
    tag_lines = []
    for tag in tags:
        tag_lines.append(tag["tag_id"])
        tag_lines.extend(indent(tag["idref_list"]))
    all_lines.extend(indent(tag_lines, indent_step=1))
    return all_lines
Beispiel #6
0
def _config_show_cib_lines(lib):
    """
    Commandline options:
      * -f - CIB file
    """
    # update of pcs_options will change output of constraint show
    utils.pcs_options["--full"] = 1
    # get latest modifiers object after updating pcs_options
    modifiers = utils.get_input_modifiers()
    cib_xml = utils.get_cib()
    cib_etree = utils.get_cib_etree(cib_xml=cib_xml)
    cib_dom = utils.get_cib_dom(cib_xml=cib_xml)

    resource_lines = []
    stonith_lines = []
    for resource_el in cib_etree.find(".//resources"):
        is_stonith = (
            "class" in resource_el.attrib
            and
            resource_el.attrib["class"] == "stonith"
        )
        resource_el_lines = resource.resource_node_lines(resource_el)
        if is_stonith:
            stonith_lines += resource_el_lines
        else:
            resource_lines += resource_el_lines

    all_lines = []

    all_lines.append("Resources:")
    all_lines.extend(indent(resource_lines, indent_step=1))
    all_lines.append("")
    all_lines.append("Stonith Devices:")
    all_lines.extend(indent(stonith_lines, indent_step=1))
    all_lines.append("Fencing Levels:")
    levels_lines = stonith.stonith_level_config_to_str(
        lib.fencing_topology.get_config()
    )
    if levels_lines:
        all_lines.extend(indent(levels_lines, indent_step=2))

    all_lines.append("")
    constraints_element = cib_dom.getElementsByTagName('constraints')[0]
    all_lines.extend(
        constraint.location_lines(constraints_element, showDetail=True)
    )
    all_lines.extend(constraint_command.show(
        "Ordering Constraints:",
        lib.constraint_order.show,
        order_console_report.constraint_plain,
        modifiers.get_subset("-f", "--full"),
    ))
    all_lines.extend(constraint_command.show(
         "Colocation Constraints:",
        lib.constraint_colocation.show,
        colocation_console_report.constraint_plain,
        modifiers.get_subset("-f", "--full"),
    ))
    all_lines.extend(constraint_command.show(
        "Ticket Constraints:",
        lib.constraint_ticket.show,
        ticket_console_report.constraint_plain,
        modifiers.get_subset("-f", "--full"),
    ))

    all_lines.append("")
    all_lines.extend(alert.alert_config_lines(lib))

    all_lines.append("")
    all_lines.append("Resources Defaults:")
    all_lines.extend(indent(
        resource.show_defaults(cib_dom, "rsc_defaults"),
        indent_step=1
    ))
    all_lines.append("Operations Defaults:")
    all_lines.extend(indent(
        resource.show_defaults(cib_dom, "op_defaults"),
        indent_step=1
    ))

    all_lines.append("")
    all_lines.append("Cluster Properties:")
    properties = utils.get_set_properties()
    all_lines.extend(indent(
        [
            "{0}: {1}".format(prop, val)
            for prop, val in sorted(properties.items())
        ],
        indent_step=1
    ))
    return all_lines