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",
323 case E2BIG:
return "E2BIG";
324 case EACCES:
return "EACCES";
325 case EADDRINUSE:
return "EADDRINUSE";
326 case EADDRNOTAVAIL:
return "EADDRNOTAVAIL";
327 case EAFNOSUPPORT:
return "EAFNOSUPPORT";
328 case EAGAIN:
return "EAGAIN";
329 case EALREADY:
return "EALREADY";
330 case EBADF:
return "EBADF";
331 case EBADMSG:
return "EBADMSG";
332 case EBUSY:
return "EBUSY";
333 case ECANCELED:
return "ECANCELED";
334 case ECHILD:
return "ECHILD";
335 case ECOMM:
return "ECOMM";
336 case ECONNABORTED:
return "ECONNABORTED";
337 case ECONNREFUSED:
return "ECONNREFUSED";
338 case ECONNRESET:
return "ECONNRESET";
340 case EDESTADDRREQ:
return "EDESTADDRREQ";
341 case EDOM:
return "EDOM";
342 case EDQUOT:
return "EDQUOT";
343 case EEXIST:
return "EEXIST";
344 case EFAULT:
return "EFAULT";
345 case EFBIG:
return "EFBIG";
346 case EHOSTDOWN:
return "EHOSTDOWN";
347 case EHOSTUNREACH:
return "EHOSTUNREACH";
348 case EIDRM:
return "EIDRM";
349 case EILSEQ:
return "EILSEQ";
350 case EINPROGRESS:
return "EINPROGRESS";
351 case EINTR:
return "EINTR";
352 case EINVAL:
return "EINVAL";
353 case EIO:
return "EIO";
354 case EISCONN:
return "EISCONN";
355 case EISDIR:
return "EISDIR";
356 case ELIBACC:
return "ELIBACC";
357 case ELOOP:
return "ELOOP";
358 case EMFILE:
return "EMFILE";
359 case EMLINK:
return "EMLINK";
360 case EMSGSIZE:
return "EMSGSIZE";
361 #ifdef EMULTIHOP // Not available on OpenBSD 362 case EMULTIHOP:
return "EMULTIHOP";
364 case ENAMETOOLONG:
return "ENAMETOOLONG";
365 case ENETDOWN:
return "ENETDOWN";
366 case ENETRESET:
return "ENETRESET";
367 case ENETUNREACH:
return "ENETUNREACH";
368 case ENFILE:
return "ENFILE";
369 case ENOBUFS:
return "ENOBUFS";
370 case ENODATA:
return "ENODATA";
371 case ENODEV:
return "ENODEV";
372 case ENOENT:
return "ENOENT";
373 case ENOEXEC:
return "ENOEXEC";
374 case ENOKEY:
return "ENOKEY";
375 case ENOLCK:
return "ENOLCK";
376 #ifdef ENOLINK // Not available on OpenBSD 377 case ENOLINK:
return "ENOLINK";
379 case ENOMEM:
return "ENOMEM";
380 case ENOMSG:
return "ENOMSG";
381 case ENOPROTOOPT:
return "ENOPROTOOPT";
382 case ENOSPC:
return "ENOSPC";
384 case ENOSR:
return "ENOSR";
387 case ENOSTR:
return "ENOSTR";
389 case ENOSYS:
return "ENOSYS";
390 case ENOTBLK:
return "ENOTBLK";
391 case ENOTCONN:
return "ENOTCONN";
392 case ENOTDIR:
return "ENOTDIR";
393 case ENOTEMPTY:
return "ENOTEMPTY";
394 case ENOTSOCK:
return "ENOTSOCK";
395 #if ENOTSUP != EOPNOTSUPP 396 case ENOTSUP:
return "ENOTSUP";
398 case ENOTTY:
return "ENOTTY";
400 case ENXIO:
return "ENXIO";
401 case EOPNOTSUPP:
return "EOPNOTSUPP";
402 case EOVERFLOW:
return "EOVERFLOW";
403 case EPERM:
return "EPERM";
404 case EPFNOSUPPORT:
return "EPFNOSUPPORT";
405 case EPIPE:
return "EPIPE";
406 case EPROTO:
return "EPROTO";
407 case EPROTONOSUPPORT:
return "EPROTONOSUPPORT";
408 case EPROTOTYPE:
return "EPROTOTYPE";
409 case ERANGE:
return "ERANGE";
410 case EREMOTE:
return "EREMOTE";
412 case EROFS:
return "EROFS";
413 case ESHUTDOWN:
return "ESHUTDOWN";
414 case ESPIPE:
return "ESPIPE";
415 case ESOCKTNOSUPPORT:
return "ESOCKTNOSUPPORT";
416 case ESRCH:
return "ESRCH";
417 case ESTALE:
return "ESTALE";
418 case ETIME:
return "ETIME";
419 case ETIMEDOUT:
return "ETIMEDOUT";
420 case ETXTBSY:
return "ETXTBSY";
422 case EUNATCH:
return "EUNATCH";
424 case EUSERS:
return "EUSERS";
426 case EXDEV:
return "EXDEV";
428 #ifdef EBADE // Not available on OS X 429 case EBADE:
return "EBADE";
430 case EBADFD:
return "EBADFD";
431 case EBADSLT:
return "EBADSLT";
432 case EDEADLOCK:
return "EDEADLOCK";
433 case EBADR:
return "EBADR";
434 case EBADRQC:
return "EBADRQC";
435 case ECHRNG:
return "ECHRNG";
436 #ifdef EISNAM // Not available on OS X, Illumos, Solaris 437 case EISNAM:
return "EISNAM";
438 case EKEYEXPIRED:
return "EKEYEXPIRED";
439 case EKEYREVOKED:
return "EKEYREVOKED";
442 case EL2HLT:
return "EL2HLT";
443 case EL2NSYNC:
return "EL2NSYNC";
444 case EL3HLT:
return "EL3HLT";
445 case EL3RST:
return "EL3RST";
446 case ELIBBAD:
return "ELIBBAD";
447 case ELIBMAX:
return "ELIBMAX";
448 case ELIBSCN:
return "ELIBSCN";
449 case ELIBEXEC:
return "ELIBEXEC";
450 #ifdef ENOMEDIUM // Not available on OS X, Illumos, Solaris 451 case ENOMEDIUM:
return "ENOMEDIUM";
452 case EMEDIUMTYPE:
return "EMEDIUMTYPE";
454 case ENONET:
return "ENONET";
455 case ENOPKG:
return "ENOPKG";
456 case EREMCHG:
return "EREMCHG";
457 case ERESTART:
return "ERESTART";
458 case ESTRPIPE:
return "ESTRPIPE";
459 #ifdef EUCLEAN // Not available on OS X, Illumos, Solaris 460 case EUCLEAN:
return "EUCLEAN";
462 case EXFULL:
return "EXFULL";
464 default:
return "Unknown";
490 #ifdef PCMK__ENOTUNIQ 491 case ENOTUNIQ:
return "Name not unique on network";
494 case ECOMM:
return "Communication error on send";
497 case ELIBACC:
return "Can not access a needed shared library";
499 #ifdef PCMK__EREMOTEIO 500 case EREMOTEIO:
return "Remote I/O error";
503 case ENOKEY:
return "Required key not available";
506 case ENODATA:
return "No data available";
509 case ETIME:
return "Timer expired";
511 #ifdef PCMK__EKEYREJECTED 512 case EKEYREJECTED:
return "Key was rejected by service";
536 legacy_rc = abs(legacy_rc);
556 default:
return legacy_rc;
611 return "CRM_EX_UNKNOWN";
635 case CRM_EX_OSERR:
return "Operating system error occurred";
643 case CRM_EX_FATAL:
return "Fatal error occurred, will not respawn";
656 case CRM_EX_OLD:
return "Update was older than existing configuration";
660 case CRM_EX_NONE:
return "No exit status available";
663 if ((exit_code > 128) && (exit_code <
CRM_EX_MAX)) {
664 return "Interrupted by signal";
666 return "Unknown exit status";
713 case EPROTONOSUPPORT:
738 #if EOPNOTSUPP != ENOTSUP 809 #if EOPNOTSUPP != ENOTSUP 833 case BZ_CONFIG_ERROR:
834 return "libbz2 has been improperly compiled on your platform";
835 case BZ_SEQUENCE_ERROR:
836 return "library functions called in the wrong order";
838 return "parameter is out of range or otherwise incorrect";
840 return "memory allocation failed";
842 return "data integrity error is detected during decompression";
843 case BZ_DATA_ERROR_MAGIC:
844 return "the compressed stream does not start with the correct magic bytes";
846 return "error reading or writing in the compressed file";
847 case BZ_UNEXPECTED_EOF:
848 return "compressed file finishes before the logical end of stream is detected";
849 case BZ_OUTBUFF_FULL:
850 return "output data will not fit into the buffer provided";
852 return "Data compression error";
861 if ((((
int) rc) < 0) || (((
int) rc) >
CRM_EX_MAX)) {
927 const
char *format, ...)
940 if (format != NULL) {
941 va_start(ap, format);
942 len = vasprintf(&reason, format, ap);
1010 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
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
void pcmk__cli_option_cleanup(void)
pcmk__action_result_t result
#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)