20 #include <qb/qbdefs.h> 25 G_DEFINE_QUARK(pcmk-rc-error-quark, pcmk__rc_error)
26 G_DEFINE_QUARK(pcmk-exitc-error-quark, pcmk__exitc_error)
46 const char *code_name = NULL;
47 const char *code_desc = NULL;
95 CRM_ASSERT((lower != NULL) && (upper != NULL));
159 static const struct pcmk__rc_info {
168 {
"pcmk_rc_unknown_format",
169 "Unknown output format",
172 {
"pcmk_rc_bad_nvpair",
173 "Bad name/value pair given",
177 "Already in requested state",
180 {
"pcmk_rc_node_unknown",
184 {
"pcmk_rc_multiple",
185 "Resource active on multiple nodes",
188 {
"pcmk_rc_cib_corrupt",
189 "Could not parse on-disk configuration",
192 {
"pcmk_rc_cib_save",
193 "Could not save new configuration to disk",
196 {
"pcmk_rc_cib_backup",
197 "Could not archive previous configuration",
200 {
"pcmk_rc_cib_modified",
201 "On-disk configuration was manually modified",
204 {
"pcmk_rc_diff_resync",
205 "Application of update diff failed, requesting full refresh",
208 {
"pcmk_rc_diff_failed",
209 "Application of update diff failed",
212 {
"pcmk_rc_old_data",
213 "Update was older than existing configuration",
216 {
"pcmk_rc_transform_failed",
217 "Schema transform failed",
220 {
"pcmk_rc_schema_unchanged",
221 "Schema is already the latest available",
224 {
"pcmk_rc_schema_validation",
225 "Update does not conform to the configured schema",
228 {
"pcmk_rc_no_quorum",
229 "Operation requires quorum",
232 {
"pcmk_rc_ipc_unauthorized",
233 "IPC server is blocked by unauthorized process",
236 {
"pcmk_rc_ipc_unresponsive",
237 "IPC server is unresponsive",
240 {
"pcmk_rc_ipc_pid_only",
241 "IPC server process is active but not accepting connections",
244 {
"pcmk_rc_op_unsatisfied",
245 "Not applicable under current conditions",
248 {
"pcmk_rc_undetermined",
249 "Result undetermined",
252 {
"pcmk_rc_before_range",
253 "Result occurs before given range",
256 {
"pcmk_rc_within_range",
257 "Result occurs within given range",
260 {
"pcmk_rc_after_range",
261 "Result occurs after given range",
264 {
"pcmk_rc_no_output",
265 "Output message produced no output",
268 {
"pcmk_rc_no_input",
269 "Input file not available",
272 {
"pcmk_rc_underflow",
273 "Value too small to be stored in data type",
276 {
"pcmk_rc_dot_error",
277 "Error writing dot(1) file",
280 {
"pcmk_rc_graph_error",
281 "Error writing graph file",
284 {
"pcmk_rc_invalid_transition",
285 "Cluster simulation produced invalid transition",
288 {
"pcmk_rc_unpack_error",
289 "Unable to parse CIB XML",
292 {
"pcmk_rc_duplicate_id",
293 "Two or more XML elements have the same ID",
296 {
"pcmk_rc_disabled",
300 {
"pcmk_rc_bad_input",
301 "Bad input value provided",
304 {
"pcmk_rc_bad_xml_patch",
305 "Bad XML patch format",
335 case E2BIG:
return "E2BIG";
336 case EACCES:
return "EACCES";
337 case EADDRINUSE:
return "EADDRINUSE";
338 case EADDRNOTAVAIL:
return "EADDRNOTAVAIL";
339 case EAFNOSUPPORT:
return "EAFNOSUPPORT";
340 case EAGAIN:
return "EAGAIN";
341 case EALREADY:
return "EALREADY";
342 case EBADF:
return "EBADF";
343 case EBADMSG:
return "EBADMSG";
344 case EBUSY:
return "EBUSY";
345 case ECANCELED:
return "ECANCELED";
346 case ECHILD:
return "ECHILD";
347 case ECOMM:
return "ECOMM";
348 case ECONNABORTED:
return "ECONNABORTED";
349 case ECONNREFUSED:
return "ECONNREFUSED";
350 case ECONNRESET:
return "ECONNRESET";
352 case EDESTADDRREQ:
return "EDESTADDRREQ";
353 case EDOM:
return "EDOM";
354 case EDQUOT:
return "EDQUOT";
355 case EEXIST:
return "EEXIST";
356 case EFAULT:
return "EFAULT";
357 case EFBIG:
return "EFBIG";
358 case EHOSTDOWN:
return "EHOSTDOWN";
359 case EHOSTUNREACH:
return "EHOSTUNREACH";
360 case EIDRM:
return "EIDRM";
361 case EILSEQ:
return "EILSEQ";
362 case EINPROGRESS:
return "EINPROGRESS";
363 case EINTR:
return "EINTR";
364 case EINVAL:
return "EINVAL";
365 case EIO:
return "EIO";
366 case EISCONN:
return "EISCONN";
367 case EISDIR:
return "EISDIR";
368 case ELIBACC:
return "ELIBACC";
369 case ELOOP:
return "ELOOP";
370 case EMFILE:
return "EMFILE";
371 case EMLINK:
return "EMLINK";
372 case EMSGSIZE:
return "EMSGSIZE";
373 #ifdef EMULTIHOP // Not available on OpenBSD 374 case EMULTIHOP:
return "EMULTIHOP";
376 case ENAMETOOLONG:
return "ENAMETOOLONG";
377 case ENETDOWN:
return "ENETDOWN";
378 case ENETRESET:
return "ENETRESET";
379 case ENETUNREACH:
return "ENETUNREACH";
380 case ENFILE:
return "ENFILE";
381 case ENOBUFS:
return "ENOBUFS";
382 case ENODATA:
return "ENODATA";
383 case ENODEV:
return "ENODEV";
384 case ENOENT:
return "ENOENT";
385 case ENOEXEC:
return "ENOEXEC";
386 case ENOKEY:
return "ENOKEY";
387 case ENOLCK:
return "ENOLCK";
388 #ifdef ENOLINK // Not available on OpenBSD 389 case ENOLINK:
return "ENOLINK";
391 case ENOMEM:
return "ENOMEM";
392 case ENOMSG:
return "ENOMSG";
393 case ENOPROTOOPT:
return "ENOPROTOOPT";
394 case ENOSPC:
return "ENOSPC";
396 case ENOSR:
return "ENOSR";
399 case ENOSTR:
return "ENOSTR";
401 case ENOSYS:
return "ENOSYS";
402 case ENOTBLK:
return "ENOTBLK";
403 case ENOTCONN:
return "ENOTCONN";
404 case ENOTDIR:
return "ENOTDIR";
405 case ENOTEMPTY:
return "ENOTEMPTY";
406 case ENOTSOCK:
return "ENOTSOCK";
407 #if ENOTSUP != EOPNOTSUPP 408 case ENOTSUP:
return "ENOTSUP";
410 case ENOTTY:
return "ENOTTY";
412 case ENXIO:
return "ENXIO";
413 case EOPNOTSUPP:
return "EOPNOTSUPP";
414 case EOVERFLOW:
return "EOVERFLOW";
415 case EPERM:
return "EPERM";
416 case EPFNOSUPPORT:
return "EPFNOSUPPORT";
417 case EPIPE:
return "EPIPE";
418 case EPROTO:
return "EPROTO";
419 case EPROTONOSUPPORT:
return "EPROTONOSUPPORT";
420 case EPROTOTYPE:
return "EPROTOTYPE";
421 case ERANGE:
return "ERANGE";
422 case EREMOTE:
return "EREMOTE";
424 case EROFS:
return "EROFS";
425 case ESHUTDOWN:
return "ESHUTDOWN";
426 case ESPIPE:
return "ESPIPE";
427 case ESOCKTNOSUPPORT:
return "ESOCKTNOSUPPORT";
428 case ESRCH:
return "ESRCH";
429 case ESTALE:
return "ESTALE";
430 case ETIME:
return "ETIME";
431 case ETIMEDOUT:
return "ETIMEDOUT";
432 case ETXTBSY:
return "ETXTBSY";
434 case EUNATCH:
return "EUNATCH";
436 case EUSERS:
return "EUSERS";
438 case EXDEV:
return "EXDEV";
440 #ifdef EBADE // Not available on OS X 441 case EBADE:
return "EBADE";
442 case EBADFD:
return "EBADFD";
443 case EBADSLT:
return "EBADSLT";
444 case EDEADLOCK:
return "EDEADLOCK";
445 case EBADR:
return "EBADR";
446 case EBADRQC:
return "EBADRQC";
447 case ECHRNG:
return "ECHRNG";
448 #ifdef EISNAM // Not available on OS X, Illumos, Solaris 449 case EISNAM:
return "EISNAM";
450 case EKEYEXPIRED:
return "EKEYEXPIRED";
451 case EKEYREVOKED:
return "EKEYREVOKED";
454 case EL2HLT:
return "EL2HLT";
455 case EL2NSYNC:
return "EL2NSYNC";
456 case EL3HLT:
return "EL3HLT";
457 case EL3RST:
return "EL3RST";
458 case ELIBBAD:
return "ELIBBAD";
459 case ELIBMAX:
return "ELIBMAX";
460 case ELIBSCN:
return "ELIBSCN";
461 case ELIBEXEC:
return "ELIBEXEC";
462 #ifdef ENOMEDIUM // Not available on OS X, Illumos, Solaris 463 case ENOMEDIUM:
return "ENOMEDIUM";
464 case EMEDIUMTYPE:
return "EMEDIUMTYPE";
466 case ENONET:
return "ENONET";
467 case ENOPKG:
return "ENOPKG";
468 case EREMCHG:
return "EREMCHG";
469 case ERESTART:
return "ERESTART";
470 case ESTRPIPE:
return "ESTRPIPE";
471 #ifdef EUCLEAN // Not available on OS X, Illumos, Solaris 472 case EUCLEAN:
return "EUCLEAN";
474 case EXFULL:
return "EXFULL";
476 default:
return "Unknown";
502 #ifdef PCMK__ENOTUNIQ 503 case ENOTUNIQ:
return "Name not unique on network";
506 case ECOMM:
return "Communication error on send";
509 case ELIBACC:
return "Can not access a needed shared library";
511 #ifdef PCMK__EREMOTEIO 512 case EREMOTEIO:
return "Remote I/O error";
515 case ENOKEY:
return "Required key not available";
518 case ENODATA:
return "No data available";
521 case ETIME:
return "Timer expired";
523 #ifdef PCMK__EKEYREJECTED 524 case EKEYREJECTED:
return "Key was rejected by service";
548 legacy_rc = abs(legacy_rc);
568 default:
return legacy_rc;
623 return "CRM_EX_UNKNOWN";
647 case CRM_EX_OSERR:
return "Operating system error occurred";
655 case CRM_EX_FATAL:
return "Fatal error occurred, will not respawn";
668 case CRM_EX_OLD:
return "Update was older than existing configuration";
672 case CRM_EX_NONE:
return "No exit status available";
675 if ((exit_code > 128) && (exit_code <
CRM_EX_MAX)) {
676 return "Interrupted by signal";
678 return "Unknown exit status";
726 case EPROTONOSUPPORT:
750 #if EOPNOTSUPP != ENOTSUP 827 #if EOPNOTSUPP != ENOTSUP 851 case BZ_CONFIG_ERROR:
852 return "libbz2 has been improperly compiled on your platform";
853 case BZ_SEQUENCE_ERROR:
854 return "library functions called in the wrong order";
856 return "parameter is out of range or otherwise incorrect";
858 return "memory allocation failed";
860 return "data integrity error is detected during decompression";
861 case BZ_DATA_ERROR_MAGIC:
862 return "the compressed stream does not start with the correct magic bytes";
864 return "error reading or writing in the compressed file";
865 case BZ_UNEXPECTED_EOF:
866 return "compressed file finishes before the logical end of stream is detected";
867 case BZ_OUTBUFF_FULL:
868 return "output data will not fit into the buffer provided";
870 return "Data compression error";
879 if ((((
int) rc) < 0) || (((
int) rc) >
CRM_EX_MAX)) {
946 const
char *format, ...)
959 if (format != NULL) {
960 va_start(ap, format);
961 len = vasprintf(&reason, format, ap);
1029 CRM_CHECK((src != NULL) && (dst != NULL),
return);
#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
Ensure crm_exit_t can hold this.
char * strerror(int errnum)
#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.
void pcmk__str_update(char **str, const char *value)
Wrappers for and extensions to libxml2.
Service failed and possibly promoted.
#define pcmk_err_cib_modified
Service active but more likely to fail soon.
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)
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)