Beispiel #1
0
def get_cluster_sbd_config(lib_env):
    """
    Returns list of SBD config from all cluster nodes in cluster. Structure
    of data:
    [
        {
            "node": <NodeAddress>
            "config": <sbd_config_dict> or None if there was failure,
        },
        ...
    ]
    If error occurs while obtaining config from some node, it's config will be
    None. If obtaining config fail on all node returns empty dictionary.

    lib_env -- LibraryEnvironment
    """
    node_list, get_nodes_report_list = get_existing_nodes_names(
        lib_env.get_corosync_conf()
    )
    if not node_list:
        get_nodes_report_list.append(reports.corosync_config_no_nodes_defined())
    lib_env.report_processor.process_list(get_nodes_report_list)

    com_cmd = GetSbdConfig(lib_env.report_processor)
    com_cmd.set_targets(
        lib_env.get_node_target_factory().get_target_list(
            node_list,
            skip_non_existing=True
        )
    )
    return run_com(lib_env.get_node_communicator(), com_cmd)
Beispiel #2
0
def get_cluster_sbd_config(lib_env):
    """
    Returns list of SBD config from all cluster nodes in cluster. Structure
    of data:
    [
        {
            "node": <NodeAddress>
            "config": <sbd_config_dict> or None if there was failure,
        },
        ...
    ]
    If error occurs while obtaining config from some node, it's config will be
    None. If obtaining config fail on all node returns empty dictionary.

    lib_env -- LibraryEnvironment
    """
    node_list, get_nodes_report_list = get_existing_nodes_names(
        lib_env.get_corosync_conf())
    if not node_list:
        get_nodes_report_list.append(
            reports.corosync_config_no_nodes_defined())
    if lib_env.report_processor.report_list(get_nodes_report_list).has_errors:
        raise LibraryError()

    com_cmd = GetSbdConfig(lib_env.report_processor)
    com_cmd.set_targets(lib_env.get_node_target_factory().get_target_list(
        node_list, skip_non_existing=True))
    return run_com(lib_env.get_node_communicator(), com_cmd)
Beispiel #3
0
def get_cluster_sbd_config(lib_env):
    """
    Returns list of SBD config from all cluster nodes in cluster. Structure
    of data:
    [
        {
            "node": <NodeAddress>
            "config": <sbd_config_dict> or None if there was failure,
        },
        ...
    ]
    If error occurs while obtaining config from some node, it's config will be
    None. If obtaining config fail on all node returns empty dictionary.

    lib_env -- LibraryEnvironment
    """
    com_cmd = GetSbdConfig(lib_env.report_processor)
    com_cmd.set_targets(lib_env.get_node_target_factory().get_target_list(
        _get_cluster_nodes(lib_env)))
    return run_com(lib_env.get_node_communicator(), com_cmd)