Esempio n. 1
0
def rrp_active_not_supported(warning=False):
    """
    active RRP mode is not supported, require user confirmation
    warning set to True if user confirmed he/she wants to proceed
    """
    return ReportItem(
        report_codes.RRP_ACTIVE_NOT_SUPPORTED,
        ReportItemSeverity.WARNING if warning else ReportItemSeverity.ERROR,
        forceable=(None if warning else report_codes.FORCE_ACTIVE_RRP))
Esempio n. 2
0
def quorum_cannot_disable_atb_due_to_sbd(severity=ReportItemSeverity.ERROR,
                                         forceable=None):
    """
    Quorum option auto_tie_breaker cannot be disbled due to SBD.
    """
    return ReportItem(
        report_codes.COROSYNC_QUORUM_CANNOT_DISABLE_ATB_DUE_TO_SBD,
        severity,
        forceable=forceable)
Esempio n. 3
0
def corosync_not_running_check_node_error(node,
                                          severity=ReportItemSeverity.ERROR,
                                          forceable=None):
    """
    communication error occured when checking corosync is not running on a node
    node string faulty node address / name
    """
    return ReportItem(report_codes.COROSYNC_NOT_RUNNING_CHECK_NODE_ERROR,
                      severity,
                      info={"node": node},
                      forceable=forceable)
Esempio n. 4
0
def corosync_config_distribution_node_error(node,
                                            severity=ReportItemSeverity.ERROR,
                                            forceable=None):
    """
    communication error occured when saving corosync configuration to a node
    node string faulty node address / name
    """
    return ReportItem(report_codes.COROSYNC_CONFIG_DISTRIBUTION_NODE_ERROR,
                      severity,
                      info={"node": node},
                      forceable=forceable)
Esempio n. 5
0
def qdevice_used_by_clusters(clusters,
                             severity=ReportItemSeverity.ERROR,
                             forceable=None):
    """
    Qdevice is currently being used by clusters, cannot stop it unless forced
    """
    return ReportItem(report_codes.QDEVICE_USED_BY_CLUSTERS,
                      severity,
                      info={
                          "clusters": clusters,
                      },
                      forceable=forceable)
Esempio n. 6
0
def node_not_found(node, severity=ReportItemSeverity.ERROR, forceable=None):
    """
    specified node does not exist
    node string specified node
    """
    return ReportItem(
        report_codes.NODE_NOT_FOUND,
        severity,
        info={
            "node": node,
        },
        forceable=forceable
    )
Esempio n. 7
0
def file_io_error(
    file_role, file_path="", reason="", operation="work with",
    severity=ReportItemSeverity.ERROR
):
    return ReportItem(
        report_codes.FILE_IO_ERROR,
        severity,
        info={
            "file_role": file_role,
            "file_path": file_path,
            "reason": reason,
            "operation": operation
        },
    )
Esempio n. 8
0
def booth_config_read_error(name,
                            severity=ReportItemSeverity.ERROR,
                            forceable=None):
    """
    Unable to read from specified booth instance config.

    name -- name of booth instance
    severity -- severity of report item
    forceable -- is this report item forceable? by what category?
    """
    return ReportItem(report_codes.BOOTH_CONFIG_READ_ERROR,
                      severity,
                      info={"name": name},
                      forceable=forceable)
Esempio n. 9
0
def unable_to_get_sbd_config(node, reason, severity=ReportItemSeverity.ERROR):
    """
    unable to get SBD config from specified node (communication or parsing
    error)

    node -- node name
    reason -- reason of failure
    """
    return ReportItem(report_codes.UNABLE_TO_GET_SBD_CONFIG,
                      severity,
                      info={
                          "node": node,
                          "reason": reason
                      })
Esempio n. 10
0
def file_already_exists(
        file_role, file_path, severity=ReportItemSeverity.ERROR,
        forceable=None, node=None
    ):
    return ReportItem(
        report_codes.FILE_ALREADY_EXISTS,
        severity,
        info={
            "file_role": file_role,
            "file_path": file_path,
            "node": node,
        },
        forceable=forceable,
    )
Esempio n. 11
0
def stonith_resources_do_not_exist(
    stonith_ids, severity=ReportItemSeverity.ERROR, forceable=None
):
    """
    specified stonith resource doesn't exist (e.g. when creating in constraints)
    iterable stoniths -- list of specified stonith id
    """
    return ReportItem(
        report_codes.STONITH_RESOURCES_DO_NOT_EXIST,
        severity,
        info={
            "stonith_ids": stonith_ids,
        },
        forceable=forceable
    )
Esempio n. 12
0
def unable_to_get_agent_metadata(agent,
                                 reason,
                                 severity=ReportItemSeverity.ERROR,
                                 forceable=None):
    """
    There were some issues trying to get metadata of agent

    string agent agent which metadata were unable to obtain
    string reason reason of failure
    """
    return ReportItem(report_codes.UNABLE_TO_GET_AGENT_METADATA,
                      severity,
                      info={
                          "agent": agent,
                          "reason": reason
                      },
                      forceable=forceable)
Esempio n. 13
0
def cib_alert_recipient_already_exists(alert_id,
                                       recipient_value,
                                       severity=ReportItemSeverity.ERROR,
                                       forceable=None):
    """
    Recipient with specified value already exists in alert with id 'alert_id'

    alert_id -- id of alert to which recipient belongs
    recipient_value -- value of recipient
    """
    return ReportItem(report_codes.CIB_ALERT_RECIPIENT_ALREADY_EXISTS,
                      severity,
                      info={
                          "recipient": recipient_value,
                          "alert": alert_id
                      },
                      forceable=forceable)
Esempio n. 14
0
def duplicate_constraints_exist(constraint_type,
                                constraint_info_list,
                                severity=ReportItemSeverity.ERROR,
                                forceable=None):
    """
    when creating a constraint it was detected the constraint already exists
    constraint_type string "rsc_colocation", "rsc_order", "rsc_ticket"
    constraint_info_list list of structured constraint data according to type
    severity report item severity
    forceable is this report item forceable? by what cathegory?
    """
    return ReportItem(report_codes.DUPLICATE_CONSTRAINTS_EXIST,
                      severity,
                      info={
                          "constraint_type": constraint_type,
                          "constraint_info_list": constraint_info_list,
                      },
                      forceable=forceable)
Esempio n. 15
0
def node_communication_error_other_error(node,
                                         command,
                                         reason,
                                         severity=ReportItemSeverity.ERROR,
                                         forceable=None):
    """
    node rejected a request for another reason (may be faulty node)
    node string node address / name
    reason string decription of the error
    """
    return ReportItem(report_codes.NODE_COMMUNICATION_ERROR,
                      severity,
                      info={
                          "node": node,
                          "command": command,
                          "reason": reason,
                      },
                      forceable=forceable)
Esempio n. 16
0
def node_communication_error_not_authorized(node,
                                            command,
                                            reason,
                                            severity=ReportItemSeverity.ERROR,
                                            forceable=None):
    """
    node rejected a request as we are not authorized
    node string node address / name
    reason string decription of the error
    """
    return ReportItem(report_codes.NODE_COMMUNICATION_ERROR_NOT_AUTHORIZED,
                      severity,
                      info={
                          "node": node,
                          "command": command,
                          "reason": reason,
                      },
                      forceable=forceable)
Esempio n. 17
0
def booth_multiple_times_in_cib(name, severity=ReportItemSeverity.ERROR):
    """
    Each booth instance should be in a cib once maximally. But multiple
        occurences detected. For example during remove booth instance from cib.
        Notify user about this fact is required. When operation is forced
        user should be notified about multiple occurences.
    string name is booth instance name
    ReportItemSeverity severit should be ERROR or WARNING (depends on context)
        is flag for next report processing
        Because of severity coupling with ReportItem is it specified here.
    """
    return ReportItem(report_codes.BOOTH_MULTIPLE_TIMES_IN_CIB,
                      severity,
                      info={
                          "name": name,
                      },
                      forceable=report_codes.FORCE_BOOTH_REMOVE_FROM_CIB
                      if severity == ReportItemSeverity.ERROR else None)
Esempio n. 18
0
def node_communication_error_unable_to_connect(
    node, command, reason,
    severity=ReportItemSeverity.ERROR, forceable=None
):
    """
    we were unable to connect to a node
    node string node address / name
    reason string decription of the error
    """
    return ReportItem(
        report_codes.NODE_COMMUNICATION_ERROR_UNABLE_TO_CONNECT,
        severity,
        info={
            "node": node,
            "command": command,
            "reason": reason,
        },
        forceable=forceable
    )
Esempio n. 19
0
def node_communication_error_unsupported_command(
    node, command, reason,
    severity=ReportItemSeverity.ERROR, forceable=None
):
    """
    node rejected a request as it does not support the request
    node string node address / name
    reason string decription of the error
    """
    return ReportItem(
        report_codes.NODE_COMMUNICATION_ERROR_UNSUPPORTED_COMMAND,
        severity,
        info={
            "node": node,
            "command": command,
            "reason": reason,
        },
        forceable=forceable
    )
Esempio n. 20
0
def node_communication_error_permission_denied(
    node, command, reason,
    severity=ReportItemSeverity.ERROR, forceable=None
):
    """
    node rejected a request as we do not have permissions to run the request
    node string node address / name
    reason string decription of the error
    """
    return ReportItem(
        report_codes.NODE_COMMUNICATION_ERROR_PERMISSION_DENIED,
        severity,
        info={
            "node": node,
            "command": command,
            "reason": reason,
        },
        forceable=forceable
    )
Esempio n. 21
0
def booth_config_unexpected_lines(
    line_list,
    file_path=None,
    severity=ReportItemSeverity.ERROR,
    forceable=None,
):
    """
    Lines not conforming to expected config structure found in a booth config

    list line_list -- not valid lines
    string file_path -- path to the conf file if available
    """
    return ReportItem(report_codes.BOOTH_CONFIG_UNEXPECTED_LINES,
                      severity,
                      info={
                          "line_list": line_list,
                          "file_path": file_path,
                      },
                      forceable=forceable)
Esempio n. 22
0
def invalid_option(option_name,
                   allowed_options,
                   option_type,
                   severity=ReportItemSeverity.ERROR,
                   forceable=None):
    """
    specified option name is not valid, usualy an error or a warning
    option_name specified invalid option name
    allowed_options iterable of possible allowed option names
    option_type decsribes the option
    severity report item severity
    forceable is this report item forceable? by what cathegory?
    """
    return ReportItem(report_codes.INVALID_OPTION,
                      severity,
                      forceable,
                      info={
                          "option_name": option_name,
                          "option_type": option_type,
                          "allowed": sorted(allowed_options),
                      })
Esempio n. 23
0
def resource_for_constraint_is_multiinstance(resource_id,
                                             parent_type,
                                             parent_id,
                                             severity=ReportItemSeverity.ERROR,
                                             forceable=None):
    """
    when setting up a constraint a resource in a clone or a master was specified
    resource_id string specified resource
    parent_type string "clone" or "master"
    parent_id clone or master resource id
    severity report item severity
    forceable is this report item forceable? by what cathegory?
    """
    return ReportItem(report_codes.RESOURCE_FOR_CONSTRAINT_IS_MULTIINSTANCE,
                      severity,
                      info={
                          "resource_id": resource_id,
                          "parent_type": parent_type,
                          "parent_id": parent_id,
                      },
                      forceable=forceable)
Esempio n. 24
0
def invalid_option_value(option_name,
                         option_value,
                         allowed_values,
                         severity=ReportItemSeverity.ERROR,
                         forceable=None):
    """
    specified value is not valid for the option, usualy an error or a warning
    option_name specified option name whose value is not valid
    option_value specified value which is not valid
    allowed_options list of allowed values or string description
    severity report item severity
    forceable is this report item forceable? by what cathegory?
    """
    return ReportItem(report_codes.INVALID_OPTION_VALUE,
                      severity,
                      info={
                          "option_value": option_value,
                          "option_name": option_name,
                          "allowed_values": allowed_values,
                      },
                      forceable=forceable)
Esempio n. 25
0
def booth_cannot_identify_keyfile(severity=ReportItemSeverity.ERROR):
    return ReportItem(report_codes.BOOTH_CANNOT_IDENTIFY_KEYFILE,
                      severity,
                      info={},
                      forceable=report_codes.FORCE_BOOTH_DESTROY
                      if severity == ReportItemSeverity.ERROR else None)