21 #include <qb/qbdefs.h> 26 G_DEFINE_QUARK(pcmk-rc-error-quark, pcmk__rc_error)
27 G_DEFINE_QUARK(pcmk-exitc-error-quark, pcmk__exitc_error)
47 const char *code_name = NULL;
48 const char *code_desc = NULL;
96 CRM_ASSERT((lower != NULL) && (upper != NULL));
160 static const struct pcmk__rc_info {
169 {
"pcmk_rc_unknown_format",
170 "Unknown output format",
173 {
"pcmk_rc_bad_nvpair",
174 "Bad name/value pair given",
178 "Already in requested state",
181 {
"pcmk_rc_node_unknown",
185 {
"pcmk_rc_multiple",
186 "Resource active on multiple nodes",
189 {
"pcmk_rc_cib_corrupt",
190 "Could not parse on-disk configuration",
193 {
"pcmk_rc_cib_save",
194 "Could not save new configuration to disk",
197 {
"pcmk_rc_cib_backup",
198 "Could not archive previous configuration",
201 {
"pcmk_rc_cib_modified",
202 "On-disk configuration was manually modified",
205 {
"pcmk_rc_diff_resync",
206 "Application of update diff failed, requesting full refresh",
209 {
"pcmk_rc_diff_failed",
210 "Application of update diff failed",
213 {
"pcmk_rc_old_data",
214 "Update was older than existing configuration",
217 {
"pcmk_rc_transform_failed",
218 "Schema transform failed",
221 {
"pcmk_rc_schema_unchanged",
222 "Schema is already the latest available",
225 {
"pcmk_rc_schema_validation",
226 "Update does not conform to the configured schema",
229 {
"pcmk_rc_no_quorum",
230 "Operation requires quorum",
233 {
"pcmk_rc_ipc_unauthorized",
234 "IPC server is blocked by unauthorized process",
237 {
"pcmk_rc_ipc_unresponsive",
238 "IPC server is unresponsive",
241 {
"pcmk_rc_ipc_pid_only",
242 "IPC server process is active but not accepting connections",
245 {
"pcmk_rc_op_unsatisfied",
246 "Not applicable under current conditions",
249 {
"pcmk_rc_undetermined",
250 "Result undetermined",
253 {
"pcmk_rc_before_range",
254 "Result occurs before given range",
257 {
"pcmk_rc_within_range",
258 "Result occurs within given range",
261 {
"pcmk_rc_after_range",
262 "Result occurs after given range",
265 {
"pcmk_rc_no_output",
266 "Output message produced no output",
269 {
"pcmk_rc_no_input",
270 "Input file not available",
273 {
"pcmk_rc_underflow",
274 "Value too small to be stored in data type",
277 {
"pcmk_rc_dot_error",
278 "Error writing dot(1) file",
281 {
"pcmk_rc_graph_error",
282 "Error writing graph file",
285 {
"pcmk_rc_invalid_transition",
286 "Cluster simulation produced invalid transition",
289 {
"pcmk_rc_unpack_error",
290 "Unable to parse CIB XML",
293 {
"pcmk_rc_duplicate_id",
294 "Two or more XML elements have the same ID",
297 {
"pcmk_rc_disabled",
301 {
"pcmk_rc_bad_input",
302 "Bad input value provided",
305 {
"pcmk_rc_bad_xml_patch",
306 "Bad XML patch format",
309 {
"pcmk_rc_no_transaction",
310 "No active transaction found",
313 {
"pcmk_rc_ns_resolution",
314 "Nameserver resolution error",
317 {
"pcmk_rc_compression",
318 "Compression/decompression error",
348 case E2BIG:
return "E2BIG";
349 case EACCES:
return "EACCES";
350 case EADDRINUSE:
return "EADDRINUSE";
351 case EADDRNOTAVAIL:
return "EADDRNOTAVAIL";
352 case EAFNOSUPPORT:
return "EAFNOSUPPORT";
353 case EAGAIN:
return "EAGAIN";
354 case EALREADY:
return "EALREADY";
355 case EBADF:
return "EBADF";
356 case EBADMSG:
return "EBADMSG";
357 case EBUSY:
return "EBUSY";
358 case ECANCELED:
return "ECANCELED";
359 case ECHILD:
return "ECHILD";
360 case ECOMM:
return "ECOMM";
361 case ECONNABORTED:
return "ECONNABORTED";
362 case ECONNREFUSED:
return "ECONNREFUSED";
363 case ECONNRESET:
return "ECONNRESET";
365 case EDESTADDRREQ:
return "EDESTADDRREQ";
366 case EDOM:
return "EDOM";
367 case EDQUOT:
return "EDQUOT";
368 case EEXIST:
return "EEXIST";
369 case EFAULT:
return "EFAULT";
370 case EFBIG:
return "EFBIG";
371 case EHOSTDOWN:
return "EHOSTDOWN";
372 case EHOSTUNREACH:
return "EHOSTUNREACH";
373 case EIDRM:
return "EIDRM";
374 case EILSEQ:
return "EILSEQ";
375 case EINPROGRESS:
return "EINPROGRESS";
376 case EINTR:
return "EINTR";
377 case EINVAL:
return "EINVAL";
378 case EIO:
return "EIO";
379 case EISCONN:
return "EISCONN";
380 case EISDIR:
return "EISDIR";
381 case ELIBACC:
return "ELIBACC";
382 case ELOOP:
return "ELOOP";
383 case EMFILE:
return "EMFILE";
384 case EMLINK:
return "EMLINK";
385 case EMSGSIZE:
return "EMSGSIZE";
386 #ifdef EMULTIHOP // Not available on OpenBSD 387 case EMULTIHOP:
return "EMULTIHOP";
389 case ENAMETOOLONG:
return "ENAMETOOLONG";
390 case ENETDOWN:
return "ENETDOWN";
391 case ENETRESET:
return "ENETRESET";
392 case ENETUNREACH:
return "ENETUNREACH";
393 case ENFILE:
return "ENFILE";
394 case ENOBUFS:
return "ENOBUFS";
395 case ENODATA:
return "ENODATA";
396 case ENODEV:
return "ENODEV";
397 case ENOENT:
return "ENOENT";
398 case ENOEXEC:
return "ENOEXEC";
399 case ENOKEY:
return "ENOKEY";
400 case ENOLCK:
return "ENOLCK";
401 #ifdef ENOLINK // Not available on OpenBSD 402 case ENOLINK:
return "ENOLINK";
404 case ENOMEM:
return "ENOMEM";
405 case ENOMSG:
return "ENOMSG";
406 case ENOPROTOOPT:
return "ENOPROTOOPT";
407 case ENOSPC:
return "ENOSPC";
409 case ENOSR:
return "ENOSR";
412 case ENOSTR:
return "ENOSTR";
414 case ENOSYS:
return "ENOSYS";
415 case ENOTBLK:
return "ENOTBLK";
416 case ENOTCONN:
return "ENOTCONN";
417 case ENOTDIR:
return "ENOTDIR";
418 case ENOTEMPTY:
return "ENOTEMPTY";
419 case ENOTSOCK:
return "ENOTSOCK";
420 #if ENOTSUP != EOPNOTSUPP 421 case ENOTSUP:
return "ENOTSUP";
423 case ENOTTY:
return "ENOTTY";
425 case ENXIO:
return "ENXIO";
426 case EOPNOTSUPP:
return "EOPNOTSUPP";
427 case EOVERFLOW:
return "EOVERFLOW";
428 case EPERM:
return "EPERM";
429 case EPFNOSUPPORT:
return "EPFNOSUPPORT";
430 case EPIPE:
return "EPIPE";
431 case EPROTO:
return "EPROTO";
432 case EPROTONOSUPPORT:
return "EPROTONOSUPPORT";
433 case EPROTOTYPE:
return "EPROTOTYPE";
434 case ERANGE:
return "ERANGE";
435 case EREMOTE:
return "EREMOTE";
437 case EROFS:
return "EROFS";
438 case ESHUTDOWN:
return "ESHUTDOWN";
439 case ESPIPE:
return "ESPIPE";
440 case ESOCKTNOSUPPORT:
return "ESOCKTNOSUPPORT";
441 case ESRCH:
return "ESRCH";
442 case ESTALE:
return "ESTALE";
443 case ETIME:
return "ETIME";
444 case ETIMEDOUT:
return "ETIMEDOUT";
445 case ETXTBSY:
return "ETXTBSY";
447 case EUNATCH:
return "EUNATCH";
449 case EUSERS:
return "EUSERS";
451 case EXDEV:
return "EXDEV";
453 #ifdef EBADE // Not available on OS X 454 case EBADE:
return "EBADE";
455 case EBADFD:
return "EBADFD";
456 case EBADSLT:
return "EBADSLT";
457 case EDEADLOCK:
return "EDEADLOCK";
458 case EBADR:
return "EBADR";
459 case EBADRQC:
return "EBADRQC";
460 case ECHRNG:
return "ECHRNG";
461 #ifdef EISNAM // Not available on OS X, Illumos, Solaris 462 case EISNAM:
return "EISNAM";
463 case EKEYEXPIRED:
return "EKEYEXPIRED";
464 case EKEYREVOKED:
return "EKEYREVOKED";
467 case EL2HLT:
return "EL2HLT";
468 case EL2NSYNC:
return "EL2NSYNC";
469 case EL3HLT:
return "EL3HLT";
470 case EL3RST:
return "EL3RST";
471 case ELIBBAD:
return "ELIBBAD";
472 case ELIBMAX:
return "ELIBMAX";
473 case ELIBSCN:
return "ELIBSCN";
474 case ELIBEXEC:
return "ELIBEXEC";
475 #ifdef ENOMEDIUM // Not available on OS X, Illumos, Solaris 476 case ENOMEDIUM:
return "ENOMEDIUM";
477 case EMEDIUMTYPE:
return "EMEDIUMTYPE";
479 case ENONET:
return "ENONET";
480 case ENOPKG:
return "ENOPKG";
481 case EREMCHG:
return "EREMCHG";
482 case ERESTART:
return "ERESTART";
483 case ESTRPIPE:
return "ESTRPIPE";
484 #ifdef EUCLEAN // Not available on OS X, Illumos, Solaris 485 case EUCLEAN:
return "EUCLEAN";
487 case EXFULL:
return "EXFULL";
489 default:
return "Unknown";
515 #ifdef PCMK__ENOTUNIQ 516 case ENOTUNIQ:
return "Name not unique on network";
519 case ECOMM:
return "Communication error on send";
522 case ELIBACC:
return "Can not access a needed shared library";
524 #ifdef PCMK__EREMOTEIO 525 case EREMOTEIO:
return "Remote I/O error";
528 case ENOKEY:
return "Required key not available";
531 case ENODATA:
return "No data available";
534 case ETIME:
return "Timer expired";
536 #ifdef PCMK__EKEYREJECTED 537 case EKEYREJECTED:
return "Key was rejected by service";
539 default:
return strerror(rc);
561 legacy_rc = abs(legacy_rc);
581 default:
return legacy_rc;
636 return "CRM_EX_UNKNOWN";
660 case CRM_EX_OSERR:
return "Operating system error occurred";
668 case CRM_EX_FATAL:
return "Fatal error occurred, will not respawn";
681 case CRM_EX_OLD:
return "Update was older than existing configuration";
685 case CRM_EX_NONE:
return "No exit status available";
688 if ((exit_code > 128) && (exit_code <
CRM_EX_MAX)) {
689 return "Interrupted by signal";
691 return "Unknown exit status";
740 case EPROTONOSUPPORT:
764 #if EOPNOTSUPP != ENOTSUP 843 #if EOPNOTSUPP != ENOTSUP 888 return ESOCKTNOSUPPORT;
920 case BZ_DATA_ERROR_MAGIC:
921 case BZ_UNEXPECTED_EOF:
927 case BZ_OUTBUFF_FULL:
941 if ((((
int) rc) < 0) || (((
int) rc) >
CRM_EX_MAX)) {
1008 const
char *format, ...)
1012 char *reason = NULL;
1021 if (format != NULL) {
1022 va_start(ap, format);
1023 len = vasprintf(&reason, format, ap);
1091 CRM_CHECK((src != NULL) && (dst != NULL),
return);
1115 case BZ_CONFIG_ERROR:
1116 return "libbz2 has been improperly compiled on your platform";
1117 case BZ_SEQUENCE_ERROR:
1118 return "library functions called in the wrong order";
1119 case BZ_PARAM_ERROR:
1120 return "parameter is out of range or otherwise incorrect";
1122 return "memory allocation failed";
1124 return "data integrity error is detected during decompression";
1125 case BZ_DATA_ERROR_MAGIC:
1126 return "the compressed stream does not start with the correct magic bytes";
1128 return "error reading or writing in the compressed file";
1129 case BZ_UNEXPECTED_EOF:
1130 return "compressed file finishes before the logical end of stream is detected";
1131 case BZ_OUTBUFF_FULL:
1132 return "output data will not fit into the buffer provided";
1134 return "Data compression error";
#define pcmk_err_old_data
const char * bz2_strerror(int rc)
#define CRM_CHECK(expr, failure_action)
#define pcmk_err_schema_validation
ocf_exitcode
Exit status codes for resource agents.
crm_exit_t pcmk_rc2exitc(int rc)
Map a function return code to the most similar exit code.
#define pcmk_err_no_quorum
#define pcmk_err_schema_unchanged
Requested item does not exist.
crm_exit_t crm_errno2exit(int rc)
Dependencies not available locally.
int pcmk__result_bounds(enum pcmk_result_type type, int *lower, int *upper)
const char * crm_exit_name(crm_exit_t exit_code)
int pcmk_rc2legacy(int rc)
Update older than existing config.
Could not determine status.
Service active and promoted.
void crm_xml_cleanup(void)
Service promoted but more likely to fail soon.
#define pcmk_err_transform_failed
enum pcmk_exec_status execution_status
#define pcmk_err_node_unknown
void mainloop_cleanup(void)
Requested item does not satisfy constraints.
enum crm_exit_e crm_exit_t
Command line usage error.
enum crm_ais_msg_types type
int pcmk__gaierror2rc(int gai)
Map a getaddrinfo() return code to the most similar Pacemaker return code.
Ensure crm_exit_t can hold this.
#define pcmk_err_cib_backup
void pcmk__free_common_logger(void)
Non-file permission issue.
Wrappers for and extensions to glib mainloop.
const char * pcmk_rc_str(int rc)
Get a user-friendly description of a return code.
enum ocf_exitcode pcmk_rc2ocf(int rc)
Map a function return code to the most similar OCF exit code.
void pcmk__set_result_output(pcmk__action_result_t *result, char *out, char *err)
#define pcmk_err_cib_save
#define pcmk_err_diff_failed
User-supplied data incorrect.
Requested item has multiple matches.
int pcmk_legacy2rc(int legacy_rc)
void pcmk__copy_result(const pcmk__action_result_t *src, pcmk__action_result_t *dst)
#define pcmk_err_multiple
Requested action not implemented.
Parameter invalid (in local context)
const char * crm_exit_str(crm_exit_t exit_code)
Input file not available.
crm_exit_t crm_exit(crm_exit_t rc)
External (OS/environmental) problem.
#define crm_trace(fmt, args...)
int pcmk_result_get_strings(int code, enum pcmk_result_type type, const char **name, const char **desc)
Get the name and description of a given result code.
Wrappers for and extensions to libxml2.
Service failed and possibly promoted.
#define pcmk_err_cib_modified
Service active but more likely to fail soon.
#define pcmk__str_copy(str)
Requested item has expired.
void pcmk__reset_result(pcmk__action_result_t *result)
Requested action not implemented.
Legacy API function return code.
void pcmk__format_result(pcmk__action_result_t *result, int exit_status, enum pcmk_exec_status exec_status, const char *format,...)
Requires –force or new conditions.
#define pcmk_err_diff_resync
pcmk__action_result_t result
char * pcmk__our_nodename
Node name of the local node.
#define pcmk_err_unknown_format
Needed service unavailable.
File couldn't be created.
const char * pcmk_rc_name(int rc)
Get a return code constant name as a string.
Local partition does not have quorum.
Lost connection to something.
Requested item is not in effect.
Standard Pacemaker return code.
No exit status available.
Deprecated Pacemaker results API.
Digest comparison failed.
pcmk_exec_status
Execution status.
Parameter invalid (in local context)
int pcmk__bzlib2rc(int bz2)
Map a bz2 return code to the most similar Pacemaker return code.
Convention from timeout(1)
const char * pcmk_strerror(int rc)
#define pcmk_err_bad_nvpair
#define pcmk_err_cib_corrupt
Requested item already exists.
#define crm_info(fmt, args...)
Parameter invalid (inherently)
const char * pcmk_errorname(int rc)
pcmk_result_type
Types of Pacemaker result codes.
void pcmk__set_result(pcmk__action_result_t *result, int exit_status, enum pcmk_exec_status exec_status, const char *exit_reason)