pacemaker  2.1.4-dc6eb4362
Scalable High-Availability cluster resource manager
Macros | Typedefs | Enumerations | Functions
results.h File Reference

Function and executable result codes. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _Noreturn
 
#define CRM_ASSERT(expr)
 
#define pcmk_ok   0
 
#define PCMK_ERROR_OFFSET   190 /* Replacements on non-linux systems, see include/portability.h */
 
#define PCMK_CUSTOM_OFFSET   200 /* Purely custom codes */
 
#define pcmk_err_generic   201
 
#define pcmk_err_no_quorum   202
 
#define pcmk_err_schema_validation   203
 
#define pcmk_err_transform_failed   204
 
#define pcmk_err_old_data   205
 
#define pcmk_err_diff_failed   206
 
#define pcmk_err_diff_resync   207
 
#define pcmk_err_cib_modified   208
 
#define pcmk_err_cib_backup   209
 
#define pcmk_err_cib_save   210
 
#define pcmk_err_schema_unchanged   211
 
#define pcmk_err_cib_corrupt   212
 
#define pcmk_err_multiple   213
 
#define pcmk_err_node_unknown   214
 
#define pcmk_err_already   215
 
#define pcmk_err_bad_nvpair   216
 
#define pcmk_err_unknown_format   217
 

Typedefs

typedef enum crm_exit_e crm_exit_t
 

Enumerations

enum  pcmk_rc_e {
  pcmk_rc_invalid_transition = -1031, pcmk_rc_graph_error = -1030, pcmk_rc_dot_error = -1029, pcmk_rc_underflow = -1028,
  pcmk_rc_no_input = -1027, pcmk_rc_no_output = -1026, pcmk_rc_after_range = -1025, pcmk_rc_within_range = -1024,
  pcmk_rc_before_range = -1023, pcmk_rc_undetermined = -1022, pcmk_rc_op_unsatisfied = -1021, pcmk_rc_ipc_pid_only = -1020,
  pcmk_rc_ipc_unresponsive = -1019, pcmk_rc_ipc_unauthorized = -1018, pcmk_rc_no_quorum = -1017, pcmk_rc_schema_validation = -1016,
  pcmk_rc_schema_unchanged = -1015, pcmk_rc_transform_failed = -1014, pcmk_rc_old_data = -1013, pcmk_rc_diff_failed = -1012,
  pcmk_rc_diff_resync = -1011, pcmk_rc_cib_modified = -1010, pcmk_rc_cib_backup = -1009, pcmk_rc_cib_save = -1008,
  pcmk_rc_cib_corrupt = -1007, pcmk_rc_multiple = -1006, pcmk_rc_node_unknown = -1005, pcmk_rc_already = -1004,
  pcmk_rc_bad_nvpair = -1003, pcmk_rc_unknown_format = -1002, pcmk_rc_error = -1001, pcmk_rc_ok = 0
}
 Return codes for Pacemaker API functions. More...
 
enum  ocf_exitcode {
  PCMK_OCF_OK = 0, PCMK_OCF_UNKNOWN_ERROR = 1, PCMK_OCF_INVALID_PARAM = 2, PCMK_OCF_UNIMPLEMENT_FEATURE = 3,
  PCMK_OCF_INSUFFICIENT_PRIV = 4, PCMK_OCF_NOT_INSTALLED = 5, PCMK_OCF_NOT_CONFIGURED = 6, PCMK_OCF_NOT_RUNNING = 7,
  PCMK_OCF_RUNNING_PROMOTED = 8, PCMK_OCF_FAILED_PROMOTED = 9, PCMK_OCF_DEGRADED = 190, PCMK_OCF_DEGRADED_PROMOTED = 191,
  PCMK_OCF_CONNECTION_DIED = 189, PCMK_OCF_UNKNOWN = 193, PCMK_OCF_EXEC_ERROR = 192, PCMK_OCF_SIGNAL = 194,
  PCMK_OCF_NOT_SUPPORTED = 195, PCMK_OCF_PENDING = 196, PCMK_OCF_CANCELLED = 197, PCMK_OCF_TIMEOUT = 198,
  PCMK_OCF_OTHER_ERROR = 199, PCMK_OCF_RUNNING_MASTER = PCMK_OCF_RUNNING_PROMOTED, PCMK_OCF_FAILED_MASTER = PCMK_OCF_FAILED_PROMOTED, PCMK_OCF_DEGRADED_MASTER = PCMK_OCF_DEGRADED_PROMOTED
}
 Exit status codes for resource agents. More...
 
enum  crm_exit_e {
  CRM_EX_OK = 0, CRM_EX_ERROR = 1, CRM_EX_INVALID_PARAM = 2, CRM_EX_UNIMPLEMENT_FEATURE = 3,
  CRM_EX_INSUFFICIENT_PRIV = 4, CRM_EX_NOT_INSTALLED = 5, CRM_EX_NOT_CONFIGURED = 6, CRM_EX_NOT_RUNNING = 7,
  CRM_EX_USAGE = 64, CRM_EX_DATAERR = 65, CRM_EX_NOINPUT = 66, CRM_EX_NOUSER = 67,
  CRM_EX_NOHOST = 68, CRM_EX_UNAVAILABLE = 69, CRM_EX_SOFTWARE = 70, CRM_EX_OSERR = 71,
  CRM_EX_OSFILE = 72, CRM_EX_CANTCREAT = 73, CRM_EX_IOERR = 74, CRM_EX_TEMPFAIL = 75,
  CRM_EX_PROTOCOL = 76, CRM_EX_NOPERM = 77, CRM_EX_CONFIG = 78, CRM_EX_FATAL = 100,
  CRM_EX_PANIC = 101, CRM_EX_DISCONNECT = 102, CRM_EX_OLD = 103, CRM_EX_DIGEST = 104,
  CRM_EX_NOSUCH = 105, CRM_EX_QUORUM = 106, CRM_EX_UNSAFE = 107, CRM_EX_EXISTS = 108,
  CRM_EX_MULTIPLE = 109, CRM_EX_EXPIRED = 110, CRM_EX_NOT_YET_IN_EFFECT = 111, CRM_EX_INDETERMINATE = 112,
  CRM_EX_UNSATISFIED = 113, CRM_EX_TIMEOUT = 124, CRM_EX_DEGRADED = 190, CRM_EX_DEGRADED_PROMOTED = 191,
  CRM_EX_MAX = 255
}
 Exit status codes for tools and daemons. More...
 
enum  pcmk_exec_status {
  PCMK_EXEC_UNKNOWN = -2, PCMK_EXEC_PENDING = -1, PCMK_EXEC_DONE, PCMK_EXEC_CANCELLED,
  PCMK_EXEC_TIMEOUT, PCMK_EXEC_NOT_SUPPORTED, PCMK_EXEC_ERROR, PCMK_EXEC_ERROR_HARD,
  PCMK_EXEC_ERROR_FATAL, PCMK_EXEC_NOT_INSTALLED, PCMK_EXEC_NOT_CONNECTED, PCMK_EXEC_INVALID,
  PCMK_EXEC_NO_FENCE_DEVICE, PCMK_EXEC_NO_SECRETS, PCMK_EXEC_MAX = PCMK_EXEC_NO_SECRETS
}
 Execution status. More...
 

Functions

const char * pcmk_rc_name (int rc)
 Get a return code constant name as a string. More...
 
const char * pcmk_rc_str (int rc)
 Get a user-friendly description of a return code. More...
 
crm_exit_t pcmk_rc2exitc (int rc)
 Map a function return code to the most similar exit code. More...
 
enum ocf_exitcode pcmk_rc2ocf (int rc)
 Map a function return code to the most similar OCF exit code. More...
 
int pcmk_rc2legacy (int rc)
 
int pcmk_legacy2rc (int legacy_rc)
 
const char * pcmk_strerror (int rc)
 
const char * pcmk_errorname (int rc)
 
const char * bz2_strerror (int rc)
 
crm_exit_t crm_errno2exit (int rc)
 
const char * crm_exit_name (crm_exit_t exit_code)
 
const char * crm_exit_str (crm_exit_t exit_code)
 
_Noreturn crm_exit_t crm_exit (crm_exit_t rc)
 

Detailed Description

Function and executable result codes.

Definition in file results.h.

Macro Definition Documentation

◆ _Noreturn

#define _Noreturn

Definition at line 38 of file results.h.

◆ CRM_ASSERT

#define CRM_ASSERT (   expr)
Value:
do { \
if (!(expr)) { \
crm_abort(__FILE__, __func__, __LINE__, #expr, TRUE, FALSE); \
abort(); /* crm_abort() doesn't always abort! */ \
} \
} while(0)

Definition at line 42 of file results.h.

◆ PCMK_CUSTOM_OFFSET

#define PCMK_CUSTOM_OFFSET   200 /* Purely custom codes */

Definition at line 70 of file results.h.

◆ pcmk_err_already

#define pcmk_err_already   215

Definition at line 85 of file results.h.

◆ pcmk_err_bad_nvpair

#define pcmk_err_bad_nvpair   216

Definition at line 91 of file results.h.

◆ pcmk_err_cib_backup

#define pcmk_err_cib_backup   209

Definition at line 79 of file results.h.

◆ pcmk_err_cib_corrupt

#define pcmk_err_cib_corrupt   212

Definition at line 82 of file results.h.

◆ pcmk_err_cib_modified

#define pcmk_err_cib_modified   208

Definition at line 78 of file results.h.

◆ pcmk_err_cib_save

#define pcmk_err_cib_save   210

Definition at line 80 of file results.h.

◆ pcmk_err_diff_failed

#define pcmk_err_diff_failed   206

Definition at line 76 of file results.h.

◆ pcmk_err_diff_resync

#define pcmk_err_diff_resync   207

Definition at line 77 of file results.h.

◆ pcmk_err_generic

#define pcmk_err_generic   201

Definition at line 71 of file results.h.

◆ pcmk_err_multiple

#define pcmk_err_multiple   213

Definition at line 83 of file results.h.

◆ pcmk_err_no_quorum

#define pcmk_err_no_quorum   202

Definition at line 72 of file results.h.

◆ pcmk_err_node_unknown

#define pcmk_err_node_unknown   214

Definition at line 84 of file results.h.

◆ pcmk_err_old_data

#define pcmk_err_old_data   205

Definition at line 75 of file results.h.

◆ pcmk_err_schema_unchanged

#define pcmk_err_schema_unchanged   211

Definition at line 81 of file results.h.

◆ pcmk_err_schema_validation

#define pcmk_err_schema_validation   203

Definition at line 73 of file results.h.

◆ pcmk_err_transform_failed

#define pcmk_err_transform_failed   204

Definition at line 74 of file results.h.

◆ pcmk_err_unknown_format

#define pcmk_err_unknown_format   217

Definition at line 92 of file results.h.

◆ PCMK_ERROR_OFFSET

#define PCMK_ERROR_OFFSET   190 /* Replacements on non-linux systems, see include/portability.h */

Definition at line 69 of file results.h.

◆ pcmk_ok

#define pcmk_ok   0

Definition at line 68 of file results.h.

Typedef Documentation

◆ crm_exit_t

typedef enum crm_exit_e crm_exit_t

Enumeration Type Documentation

◆ crm_exit_e

enum crm_exit_e

Exit status codes for tools and daemons.

We want well-specified (i.e. OS-invariant) exit status codes for our daemons and applications so they can be relied on by callers. (Function return codes and errno's do not make good exit statuses.)

The only hard rule is that exit statuses must be between 0 and 255; all else is convention. Universally, 0 is success, and 1 is generic error (excluding OSes we don't support – for example, OpenVMS considers 1 success!).

For init scripts, the LSB gives meaning to 0-7, and sets aside 150-199 for application use. OCF adds 8-9 and 190-191.

sysexits.h was an attempt to give additional meanings, but never really caught on. It uses 0 and 64-78.

Bash reserves 2 ("incorrect builtin usage") and 126-255 (126 is "command found but not executable", 127 is "command not found", 128 + n is "interrupted by signal n").

tldp.org recommends 64-113 for application use.

We try to overlap with the above conventions when practical.

Enumerator
CRM_EX_OK 

Success.

CRM_EX_ERROR 

Unspecified error.

CRM_EX_INVALID_PARAM 

Parameter invalid (in local context)

CRM_EX_UNIMPLEMENT_FEATURE 

Requested action not implemented.

CRM_EX_INSUFFICIENT_PRIV 

Insufficient privileges.

CRM_EX_NOT_INSTALLED 

Dependencies not available locally.

CRM_EX_NOT_CONFIGURED 

Parameter invalid (inherently)

CRM_EX_NOT_RUNNING 

Service safely stopped.

CRM_EX_USAGE 

Command line usage error.

CRM_EX_DATAERR 

User-supplied data incorrect.

CRM_EX_NOINPUT 

Input file not available.

CRM_EX_NOUSER 

User does not exist.

CRM_EX_NOHOST 

Host unknown.

CRM_EX_UNAVAILABLE 

Needed service unavailable.

CRM_EX_SOFTWARE 

Internal software bug.

CRM_EX_OSERR 

External (OS/environmental) problem.

CRM_EX_OSFILE 

System file not usable.

CRM_EX_CANTCREAT 

File couldn't be created.

CRM_EX_IOERR 

File I/O error.

CRM_EX_TEMPFAIL 

Try again.

CRM_EX_PROTOCOL 

Protocol violated.

CRM_EX_NOPERM 

Non-file permission issue.

CRM_EX_CONFIG 

Misconfiguration.

CRM_EX_FATAL 

Do not respawn.

CRM_EX_PANIC 

Panic the local host.

CRM_EX_DISCONNECT 

Lost connection to something.

CRM_EX_OLD 

Update older than existing config.

CRM_EX_DIGEST 

Digest comparison failed.

CRM_EX_NOSUCH 

Requested item does not exist.

CRM_EX_QUORUM 

Local partition does not have quorum.

CRM_EX_UNSAFE 

Requires –force or new conditions.

CRM_EX_EXISTS 

Requested item already exists.

CRM_EX_MULTIPLE 

Requested item has multiple matches.

CRM_EX_EXPIRED 

Requested item has expired.

CRM_EX_NOT_YET_IN_EFFECT 

Requested item is not in effect.

CRM_EX_INDETERMINATE 

Could not determine status.

CRM_EX_UNSATISFIED 

Requested item does not satisfy constraints.

CRM_EX_TIMEOUT 

Convention from timeout(1)

CRM_EX_DEGRADED 

Service active but more likely to fail soon.

CRM_EX_DEGRADED_PROMOTED 

Service promoted but more likely to fail soon.

CRM_EX_MAX 

Ensure crm_exit_t can hold this.

Definition at line 237 of file results.h.

◆ ocf_exitcode

Exit status codes for resource agents.

The OCF Resource Agent API standard enumerates the possible exit status codes that agents should return. Besides being used with OCF agents, these values are also used by the executor as a universal status for all agent standards; actual results are mapped to these before returning them to clients.

Enumerator
PCMK_OCF_OK 

Success.

PCMK_OCF_UNKNOWN_ERROR 

Unspecified error.

PCMK_OCF_INVALID_PARAM 

Parameter invalid (in local context)

PCMK_OCF_UNIMPLEMENT_FEATURE 

Requested action not implemented.

PCMK_OCF_INSUFFICIENT_PRIV 

Insufficient privileges.

PCMK_OCF_NOT_INSTALLED 

Dependencies not available locally.

PCMK_OCF_NOT_CONFIGURED 

Parameter invalid (inherently)

PCMK_OCF_NOT_RUNNING 

Service safely stopped.

PCMK_OCF_RUNNING_PROMOTED 

Service active and promoted.

PCMK_OCF_FAILED_PROMOTED 

Service failed and possibly in promoted role.

PCMK_OCF_DEGRADED 

Service active but more likely to fail soon.

PCMK_OCF_DEGRADED_PROMOTED 

Service promoted but more likely to fail soon.

PCMK_OCF_CONNECTION_DIED 
Deprecated:
See PCMK_EXEC_NOT_CONNECTED
PCMK_OCF_UNKNOWN 

Action is pending.

PCMK_OCF_EXEC_ERROR 
Deprecated:
(Unused)
PCMK_OCF_SIGNAL 
Deprecated:
(Unused)
PCMK_OCF_NOT_SUPPORTED 
Deprecated:
(Unused)
PCMK_OCF_PENDING 
Deprecated:
(Unused)
PCMK_OCF_CANCELLED 
Deprecated:
(Unused)
PCMK_OCF_TIMEOUT 
Deprecated:
(Unused)
PCMK_OCF_OTHER_ERROR 
Deprecated:
(Unused)
PCMK_OCF_RUNNING_MASTER 
Deprecated:
Use PCMK_OCF_RUNNING_PROMOTED instead
PCMK_OCF_FAILED_MASTER 
Deprecated:
Use PCMK_OCF_FAILED_PROMOTED instead
PCMK_OCF_DEGRADED_MASTER 
Deprecated:
Use PCMK_OCF_DEGRADED_PROMOTED instead

Definition at line 161 of file results.h.

◆ pcmk_exec_status

Execution status.

These codes are used to specify the result of the attempt to execute an agent, rather than the agent's result itself.

Enumerator
PCMK_EXEC_UNKNOWN 

Used only to initialize variables.

PCMK_EXEC_PENDING 

Action is in progress.

PCMK_EXEC_DONE 

Action completed, result is known.

PCMK_EXEC_CANCELLED 

Action was cancelled.

PCMK_EXEC_TIMEOUT 

Action did not complete in time.

PCMK_EXEC_NOT_SUPPORTED 

Agent does not implement requested action.

PCMK_EXEC_ERROR 

Execution failed, may be retried.

PCMK_EXEC_ERROR_HARD 

Execution failed, do not retry on node.

PCMK_EXEC_ERROR_FATAL 

Execution failed, do not retry anywhere.

PCMK_EXEC_NOT_INSTALLED 

Agent or dependency not available locally.

PCMK_EXEC_NOT_CONNECTED 

No connection to executor.

PCMK_EXEC_INVALID 

Action cannot be attempted (e.g. shutdown)

PCMK_EXEC_NO_FENCE_DEVICE 

No fence device is configured for target.

PCMK_EXEC_NO_SECRETS 

Necessary CIB secrets are unavailable.

PCMK_EXEC_MAX 

Maximum value for this enum.

Definition at line 305 of file results.h.

◆ pcmk_rc_e

enum pcmk_rc_e

Return codes for Pacemaker API functions.

Any Pacemaker API function documented as returning a "standard Pacemaker return code" will return pcmk_rc_ok (0) on success, and one of this enumeration's other (negative) values or a (positive) system error number otherwise. The custom codes are at -1001 and lower, so that the caller may use -1 through -1000 for their own custom values if desired. While generally referred to as "errors", nonzero values simply indicate a result, which might or might not be an error depending on the calling context.

Enumerator
pcmk_rc_invalid_transition 
pcmk_rc_graph_error 
pcmk_rc_dot_error 
pcmk_rc_underflow 
pcmk_rc_no_input 
pcmk_rc_no_output 
pcmk_rc_after_range 
pcmk_rc_within_range 
pcmk_rc_before_range 
pcmk_rc_undetermined 
pcmk_rc_op_unsatisfied 
pcmk_rc_ipc_pid_only 
pcmk_rc_ipc_unresponsive 
pcmk_rc_ipc_unauthorized 
pcmk_rc_no_quorum 
pcmk_rc_schema_validation 
pcmk_rc_schema_unchanged 
pcmk_rc_transform_failed 
pcmk_rc_old_data 
pcmk_rc_diff_failed 
pcmk_rc_diff_resync 
pcmk_rc_cib_modified 
pcmk_rc_cib_backup 
pcmk_rc_cib_save 
pcmk_rc_cib_corrupt 
pcmk_rc_multiple 
pcmk_rc_node_unknown 
pcmk_rc_already 
pcmk_rc_bad_nvpair 
pcmk_rc_unknown_format 
pcmk_rc_error 
pcmk_rc_ok 

Definition at line 107 of file results.h.

Function Documentation

◆ bz2_strerror()

const char* bz2_strerror ( int  rc)

Definition at line 742 of file results.c.

◆ crm_errno2exit()

crm_exit_t crm_errno2exit ( int  rc)
Deprecated:
Use standard return codes and pcmk_rc2exitc() instead

Definition at line 559 of file results.c.

◆ crm_exit()

_Noreturn crm_exit_t crm_exit ( crm_exit_t  rc)

Definition at line 775 of file results.c.

◆ crm_exit_name()

const char* crm_exit_name ( crm_exit_t  exit_code)

Definition at line 457 of file results.c.

◆ crm_exit_str()

const char* crm_exit_str ( crm_exit_t  exit_code)

Definition at line 506 of file results.c.

◆ pcmk_errorname()

const char* pcmk_errorname ( int  rc)
Deprecated:
Use standard return codes and pcmk_rc_name() instead

Definition at line 32 of file results.c.

◆ pcmk_legacy2rc()

int pcmk_legacy2rc ( int  legacy_rc)
Deprecated:
Use standard return codes instead

Definition at line 428 of file results.c.

◆ pcmk_rc2exitc()

crm_exit_t pcmk_rc2exitc ( int  rc)

Map a function return code to the most similar exit code.

Parameters
[in]rcFunction return code
Returns
Most similar exit code

Definition at line 602 of file results.c.

◆ pcmk_rc2legacy()

int pcmk_rc2legacy ( int  rc)
Deprecated:
Use standard return codes instead

Definition at line 415 of file results.c.

◆ pcmk_rc2ocf()

enum ocf_exitcode pcmk_rc2ocf ( int  rc)

Map a function return code to the most similar OCF exit code.

Parameters
[in]rcFunction return code
Returns
Most similar OCF exit code

Definition at line 715 of file results.c.

◆ pcmk_rc_name()

const char* pcmk_rc_name ( int  rc)

Get a return code constant name as a string.

Parameters
[in]rcInteger return code to convert
Returns
String of constant name corresponding to rc

Definition at line 210 of file results.c.

◆ pcmk_rc_str()

const char* pcmk_rc_str ( int  rc)

Get a user-friendly description of a return code.

Parameters
[in]rcInteger return code to convert
Returns
String description of rc

Definition at line 370 of file results.c.

◆ pcmk_strerror()

const char* pcmk_strerror ( int  rc)
Deprecated:
Use standard return codes and pcmk_rc_str() instead

Definition at line 58 of file results.c.