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)
73 return "Generic Pacemaker error";
75 return "Operation requires quorum";
77 return "Update does not conform to the configured schema";
79 return "Schema transform failed";
81 return "Update was older than existing configuration";
83 return "Application of an update diff failed";
85 return "Application of an update diff failed, requesting a full refresh";
87 return "The on-disk configuration was manually modified";
89 return "Could not archive the previous configuration";
91 return "Could not save the new configuration to disk";
93 return "Could not parse on-disk configuration";
95 return "Resource active on multiple nodes";
97 return "Node not found";
99 return "Situation already as requested";
101 return "Bad name/value pair given";
103 return "Schema is already the latest available";
105 return "Unknown output format";
110 return "Name not unique on network";
113 return "Communication error on send";
116 return "Can not access a needed shared library";
119 return "Remote I/O error";
122 return "Protocol driver not attached";
125 return "Required key not available";
128 return "Unknown error";
137 static struct pcmk__rc_info {
146 {
"pcmk_rc_unknown_format",
147 "Unknown output format",
150 {
"pcmk_rc_bad_nvpair",
151 "Bad name/value pair given",
155 "Already in requested state",
158 {
"pcmk_rc_node_unknown",
162 {
"pcmk_rc_multiple",
163 "Resource active on multiple nodes",
166 {
"pcmk_rc_cib_corrupt",
167 "Could not parse on-disk configuration",
170 {
"pcmk_rc_cib_save",
171 "Could not save new configuration to disk",
174 {
"pcmk_rc_cib_backup",
175 "Could not archive previous configuration",
178 {
"pcmk_rc_cib_modified",
179 "On-disk configuration was manually modified",
182 {
"pcmk_rc_diff_resync",
183 "Application of update diff failed, requesting full refresh",
186 {
"pcmk_rc_diff_failed",
187 "Application of update diff failed",
190 {
"pcmk_rc_old_data",
191 "Update was older than existing configuration",
194 {
"pcmk_rc_transform_failed",
195 "Schema transform failed",
198 {
"pcmk_rc_schema_unchanged",
199 "Schema is already the latest available",
202 {
"pcmk_rc_schema_validation",
203 "Update does not conform to the configured schema",
206 {
"pcmk_rc_no_quorum",
207 "Operation requires quorum",
210 {
"pcmk_rc_ipc_pid_only",
211 "IPC server process is active but not accepting connections",
214 {
"pcmk_rc_ipc_unresponsive",
215 "IPC server is unresponsive",
218 {
"pcmk_rc_ipc_unauthorized",
219 "IPC server is blocked by unauthorized process",
222 {
"pcmk_rc_op_unsatisifed",
223 "Not applicable under current conditions",
226 {
"pcmk_rc_undetermined",
227 "Result undetermined",
230 {
"pcmk_rc_before_range",
231 "Result occurs before given range",
234 {
"pcmk_rc_within_range",
235 "Result occurs within given range",
238 {
"pcmk_rc_after_range",
239 "Result occurs after given range",
242 {
"pcmk_rc_no_output",
243 "Output message produced no output",
246 {
"pcmk_rc_no_input",
247 "Input file not available",
250 {
"pcmk_rc_underflow",
251 "Value too small to be stored in data type",
254 {
"pcmk_rc_dot_error",
255 "Error writing dot(1) file",
258 {
"pcmk_rc_graph_error",
259 "Error writing graph file",
262 {
"pcmk_rc_invalid_transition",
263 "Cluster simulation produced invalid transition",
268 #define PCMK__N_RC (sizeof(pcmk__rcs) / sizeof(struct pcmk__rc_info)) 285 case E2BIG:
return "E2BIG";
286 case EACCES:
return "EACCES";
287 case EADDRINUSE:
return "EADDRINUSE";
288 case EADDRNOTAVAIL:
return "EADDRNOTAVAIL";
289 case EAFNOSUPPORT:
return "EAFNOSUPPORT";
290 case EAGAIN:
return "EAGAIN";
291 case EALREADY:
return "EALREADY";
292 case EBADF:
return "EBADF";
293 case EBADMSG:
return "EBADMSG";
294 case EBUSY:
return "EBUSY";
295 case ECANCELED:
return "ECANCELED";
296 case ECHILD:
return "ECHILD";
297 case ECOMM:
return "ECOMM";
298 case ECONNABORTED:
return "ECONNABORTED";
299 case ECONNREFUSED:
return "ECONNREFUSED";
300 case ECONNRESET:
return "ECONNRESET";
302 case EDESTADDRREQ:
return "EDESTADDRREQ";
303 case EDOM:
return "EDOM";
304 case EDQUOT:
return "EDQUOT";
305 case EEXIST:
return "EEXIST";
306 case EFAULT:
return "EFAULT";
307 case EFBIG:
return "EFBIG";
308 case EHOSTDOWN:
return "EHOSTDOWN";
309 case EHOSTUNREACH:
return "EHOSTUNREACH";
310 case EIDRM:
return "EIDRM";
311 case EILSEQ:
return "EILSEQ";
312 case EINPROGRESS:
return "EINPROGRESS";
313 case EINTR:
return "EINTR";
314 case EINVAL:
return "EINVAL";
315 case EIO:
return "EIO";
316 case EISCONN:
return "EISCONN";
317 case EISDIR:
return "EISDIR";
318 case ELIBACC:
return "ELIBACC";
319 case ELOOP:
return "ELOOP";
320 case EMFILE:
return "EMFILE";
321 case EMLINK:
return "EMLINK";
322 case EMSGSIZE:
return "EMSGSIZE";
323 #ifdef EMULTIHOP // Not available on OpenBSD 324 case EMULTIHOP:
return "EMULTIHOP";
326 case ENAMETOOLONG:
return "ENAMETOOLONG";
327 case ENETDOWN:
return "ENETDOWN";
328 case ENETRESET:
return "ENETRESET";
329 case ENETUNREACH:
return "ENETUNREACH";
330 case ENFILE:
return "ENFILE";
331 case ENOBUFS:
return "ENOBUFS";
332 case ENODATA:
return "ENODATA";
333 case ENODEV:
return "ENODEV";
334 case ENOENT:
return "ENOENT";
335 case ENOEXEC:
return "ENOEXEC";
336 case ENOKEY:
return "ENOKEY";
337 case ENOLCK:
return "ENOLCK";
338 #ifdef ENOLINK // Not available on OpenBSD 339 case ENOLINK:
return "ENOLINK";
341 case ENOMEM:
return "ENOMEM";
342 case ENOMSG:
return "ENOMSG";
343 case ENOPROTOOPT:
return "ENOPROTOOPT";
344 case ENOSPC:
return "ENOSPC";
345 case ENOSR:
return "ENOSR";
346 case ENOSTR:
return "ENOSTR";
347 case ENOSYS:
return "ENOSYS";
348 case ENOTBLK:
return "ENOTBLK";
349 case ENOTCONN:
return "ENOTCONN";
350 case ENOTDIR:
return "ENOTDIR";
351 case ENOTEMPTY:
return "ENOTEMPTY";
352 case ENOTSOCK:
return "ENOTSOCK";
353 #if ENOTSUP != EOPNOTSUPP 354 case ENOTSUP:
return "ENOTSUP";
356 case ENOTTY:
return "ENOTTY";
358 case ENXIO:
return "ENXIO";
359 case EOPNOTSUPP:
return "EOPNOTSUPP";
360 case EOVERFLOW:
return "EOVERFLOW";
361 case EPERM:
return "EPERM";
362 case EPFNOSUPPORT:
return "EPFNOSUPPORT";
363 case EPIPE:
return "EPIPE";
364 case EPROTO:
return "EPROTO";
365 case EPROTONOSUPPORT:
return "EPROTONOSUPPORT";
366 case EPROTOTYPE:
return "EPROTOTYPE";
367 case ERANGE:
return "ERANGE";
368 case EREMOTE:
return "EREMOTE";
370 case EROFS:
return "EROFS";
371 case ESHUTDOWN:
return "ESHUTDOWN";
372 case ESPIPE:
return "ESPIPE";
373 case ESOCKTNOSUPPORT:
return "ESOCKTNOSUPPORT";
374 case ESRCH:
return "ESRCH";
375 case ESTALE:
return "ESTALE";
376 case ETIME:
return "ETIME";
377 case ETIMEDOUT:
return "ETIMEDOUT";
378 case ETXTBSY:
return "ETXTBSY";
379 case EUNATCH:
return "EUNATCH";
380 case EUSERS:
return "EUSERS";
382 case EXDEV:
return "EXDEV";
384 #ifdef EBADE // Not available on OS X 385 case EBADE:
return "EBADE";
386 case EBADFD:
return "EBADFD";
387 case EBADSLT:
return "EBADSLT";
388 case EDEADLOCK:
return "EDEADLOCK";
389 case EBADR:
return "EBADR";
390 case EBADRQC:
return "EBADRQC";
391 case ECHRNG:
return "ECHRNG";
392 #ifdef EISNAM // Not available on OS X, Illumos, Solaris 393 case EISNAM:
return "EISNAM";
394 case EKEYEXPIRED:
return "EKEYEXPIRED";
396 case EKEYREVOKED:
return "EKEYREVOKED";
398 case EL2HLT:
return "EL2HLT";
399 case EL2NSYNC:
return "EL2NSYNC";
400 case EL3HLT:
return "EL3HLT";
401 case EL3RST:
return "EL3RST";
402 case ELIBBAD:
return "ELIBBAD";
403 case ELIBMAX:
return "ELIBMAX";
404 case ELIBSCN:
return "ELIBSCN";
405 case ELIBEXEC:
return "ELIBEXEC";
406 #ifdef ENOMEDIUM // Not available on OS X, Illumos, Solaris 407 case ENOMEDIUM:
return "ENOMEDIUM";
408 case EMEDIUMTYPE:
return "EMEDIUMTYPE";
410 case ENONET:
return "ENONET";
411 case ENOPKG:
return "ENOPKG";
412 case EREMCHG:
return "EREMCHG";
413 case ERESTART:
return "ERESTART";
414 case ESTRPIPE:
return "ESTRPIPE";
415 #ifdef EUCLEAN // Not available on OS X, Illumos, Solaris 416 case EUCLEAN:
return "EUCLEAN";
418 case EXFULL:
return "EXFULL";
420 default:
return "Unknown";
441 return "Unknown error";
464 legacy_rc = abs(legacy_rc);
484 default:
return legacy_rc;
536 return "CRM_EX_UNKNOWN";
558 case CRM_EX_OSERR:
return "Operating system error occurred";
566 case CRM_EX_FATAL:
return "Fatal error occurred, will not respawn";
579 case CRM_EX_OLD:
return "Update was older than existing configuration";
585 if ((exit_code > 128) && (exit_code <
CRM_EX_MAX)) {
586 return "Interrupted by signal";
588 return "Unknown exit status";
671 case EPROTONOSUPPORT:
696 #if EOPNOTSUPP != ENOTSUP 762 #if EOPNOTSUPP != ENOTSUP 786 case BZ_CONFIG_ERROR:
787 return "libbz2 has been improperly compiled on your platform";
788 case BZ_SEQUENCE_ERROR:
789 return "library functions called in the wrong order";
791 return "parameter is out of range or otherwise incorrect";
793 return "memory allocation failed";
795 return "data integrity error is detected during decompression";
796 case BZ_DATA_ERROR_MAGIC:
797 return "the compressed stream does not start with the correct magic bytes";
799 return "error reading or writing in the compressed file";
800 case BZ_UNEXPECTED_EOF:
801 return "compressed file finishes before the logical end of stream is detected";
802 case BZ_OUTBUFF_FULL:
803 return "output data will not fit into the buffer provided";
805 return "Unknown error";
851 if (result == NULL) {
860 result->
exit_reason = (exit_reason == NULL)? NULL : strdup(exit_reason);
880 if (result == NULL) {
900 if (result == NULL) {
#define pcmk_err_old_data
const char * bz2_strerror(int rc)
#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.
const char * crm_exit_name(crm_exit_t exit_code)
int pcmk_rc2legacy(int rc)
Update older than existing config.
Could not determine status.
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.
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.
#define PCMK_ERROR_OFFSET
Requested item has multiple matches.
int pcmk_legacy2rc(int legacy_rc)
#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...)
Wrappers for and extensions to libxml2.
#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.
Requires –force or new conditions.
#define pcmk_err_diff_resync
void pcmk__cli_option_cleanup(void)
#define crm_err(fmt, args...)
#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.
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)
void pcmk__set_result(pcmk__action_result_t *result, int exit_status, enum pcmk_exec_status exec_status, const char *exit_reason)