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)
69 static struct pcmk__rc_info {
78 {
"pcmk_rc_unknown_format",
79 "Unknown output format",
82 {
"pcmk_rc_bad_nvpair",
83 "Bad name/value pair given",
87 "Already in requested state",
90 {
"pcmk_rc_node_unknown",
95 "Resource active on multiple nodes",
98 {
"pcmk_rc_cib_corrupt",
99 "Could not parse on-disk configuration",
102 {
"pcmk_rc_cib_save",
103 "Could not save new configuration to disk",
106 {
"pcmk_rc_cib_backup",
107 "Could not archive previous configuration",
110 {
"pcmk_rc_cib_modified",
111 "On-disk configuration was manually modified",
114 {
"pcmk_rc_diff_resync",
115 "Application of update diff failed, requesting full refresh",
118 {
"pcmk_rc_diff_failed",
119 "Application of update diff failed",
122 {
"pcmk_rc_old_data",
123 "Update was older than existing configuration",
126 {
"pcmk_rc_transform_failed",
127 "Schema transform failed",
130 {
"pcmk_rc_schema_unchanged",
131 "Schema is already the latest available",
134 {
"pcmk_rc_schema_validation",
135 "Update does not conform to the configured schema",
138 {
"pcmk_rc_no_quorum",
139 "Operation requires quorum",
142 {
"pcmk_rc_ipc_pid_only",
143 "IPC server process is active but not accepting connections",
146 {
"pcmk_rc_ipc_unresponsive",
147 "IPC server is unresponsive",
150 {
"pcmk_rc_ipc_unauthorized",
151 "IPC server is blocked by unauthorized process",
154 {
"pcmk_rc_op_unsatisifed",
155 "Not applicable under current conditions",
158 {
"pcmk_rc_undetermined",
159 "Result undetermined",
162 {
"pcmk_rc_before_range",
163 "Result occurs before given range",
166 {
"pcmk_rc_within_range",
167 "Result occurs within given range",
170 {
"pcmk_rc_after_range",
171 "Result occurs after given range",
174 {
"pcmk_rc_no_output",
175 "Output message produced no output",
178 {
"pcmk_rc_no_input",
179 "Input file not available",
182 {
"pcmk_rc_underflow",
183 "Value too small to be stored in data type",
186 {
"pcmk_rc_dot_error",
187 "Error writing dot(1) file",
190 {
"pcmk_rc_graph_error",
191 "Error writing graph file",
194 {
"pcmk_rc_invalid_transition",
195 "Cluster simulation produced invalid transition",
200 #define PCMK__N_RC (sizeof(pcmk__rcs) / sizeof(struct pcmk__rc_info)) 217 case E2BIG:
return "E2BIG";
218 case EACCES:
return "EACCES";
219 case EADDRINUSE:
return "EADDRINUSE";
220 case EADDRNOTAVAIL:
return "EADDRNOTAVAIL";
221 case EAFNOSUPPORT:
return "EAFNOSUPPORT";
222 case EAGAIN:
return "EAGAIN";
223 case EALREADY:
return "EALREADY";
224 case EBADF:
return "EBADF";
225 case EBADMSG:
return "EBADMSG";
226 case EBUSY:
return "EBUSY";
227 case ECANCELED:
return "ECANCELED";
228 case ECHILD:
return "ECHILD";
229 case ECOMM:
return "ECOMM";
230 case ECONNABORTED:
return "ECONNABORTED";
231 case ECONNREFUSED:
return "ECONNREFUSED";
232 case ECONNRESET:
return "ECONNRESET";
234 case EDESTADDRREQ:
return "EDESTADDRREQ";
235 case EDOM:
return "EDOM";
236 case EDQUOT:
return "EDQUOT";
237 case EEXIST:
return "EEXIST";
238 case EFAULT:
return "EFAULT";
239 case EFBIG:
return "EFBIG";
240 case EHOSTDOWN:
return "EHOSTDOWN";
241 case EHOSTUNREACH:
return "EHOSTUNREACH";
242 case EIDRM:
return "EIDRM";
243 case EILSEQ:
return "EILSEQ";
244 case EINPROGRESS:
return "EINPROGRESS";
245 case EINTR:
return "EINTR";
246 case EINVAL:
return "EINVAL";
247 case EIO:
return "EIO";
248 case EISCONN:
return "EISCONN";
249 case EISDIR:
return "EISDIR";
250 case ELIBACC:
return "ELIBACC";
251 case ELOOP:
return "ELOOP";
252 case EMFILE:
return "EMFILE";
253 case EMLINK:
return "EMLINK";
254 case EMSGSIZE:
return "EMSGSIZE";
255 #ifdef EMULTIHOP // Not available on OpenBSD 256 case EMULTIHOP:
return "EMULTIHOP";
258 case ENAMETOOLONG:
return "ENAMETOOLONG";
259 case ENETDOWN:
return "ENETDOWN";
260 case ENETRESET:
return "ENETRESET";
261 case ENETUNREACH:
return "ENETUNREACH";
262 case ENFILE:
return "ENFILE";
263 case ENOBUFS:
return "ENOBUFS";
264 case ENODATA:
return "ENODATA";
265 case ENODEV:
return "ENODEV";
266 case ENOENT:
return "ENOENT";
267 case ENOEXEC:
return "ENOEXEC";
268 case ENOKEY:
return "ENOKEY";
269 case ENOLCK:
return "ENOLCK";
270 #ifdef ENOLINK // Not available on OpenBSD 271 case ENOLINK:
return "ENOLINK";
273 case ENOMEM:
return "ENOMEM";
274 case ENOMSG:
return "ENOMSG";
275 case ENOPROTOOPT:
return "ENOPROTOOPT";
276 case ENOSPC:
return "ENOSPC";
278 case ENOSR:
return "ENOSR";
281 case ENOSTR:
return "ENOSTR";
283 case ENOSYS:
return "ENOSYS";
284 case ENOTBLK:
return "ENOTBLK";
285 case ENOTCONN:
return "ENOTCONN";
286 case ENOTDIR:
return "ENOTDIR";
287 case ENOTEMPTY:
return "ENOTEMPTY";
288 case ENOTSOCK:
return "ENOTSOCK";
289 #if ENOTSUP != EOPNOTSUPP 290 case ENOTSUP:
return "ENOTSUP";
292 case ENOTTY:
return "ENOTTY";
294 case ENXIO:
return "ENXIO";
295 case EOPNOTSUPP:
return "EOPNOTSUPP";
296 case EOVERFLOW:
return "EOVERFLOW";
297 case EPERM:
return "EPERM";
298 case EPFNOSUPPORT:
return "EPFNOSUPPORT";
299 case EPIPE:
return "EPIPE";
300 case EPROTO:
return "EPROTO";
301 case EPROTONOSUPPORT:
return "EPROTONOSUPPORT";
302 case EPROTOTYPE:
return "EPROTOTYPE";
303 case ERANGE:
return "ERANGE";
304 case EREMOTE:
return "EREMOTE";
306 case EROFS:
return "EROFS";
307 case ESHUTDOWN:
return "ESHUTDOWN";
308 case ESPIPE:
return "ESPIPE";
309 case ESOCKTNOSUPPORT:
return "ESOCKTNOSUPPORT";
310 case ESRCH:
return "ESRCH";
311 case ESTALE:
return "ESTALE";
312 case ETIME:
return "ETIME";
313 case ETIMEDOUT:
return "ETIMEDOUT";
314 case ETXTBSY:
return "ETXTBSY";
316 case EUNATCH:
return "EUNATCH";
318 case EUSERS:
return "EUSERS";
320 case EXDEV:
return "EXDEV";
322 #ifdef EBADE // Not available on OS X 323 case EBADE:
return "EBADE";
324 case EBADFD:
return "EBADFD";
325 case EBADSLT:
return "EBADSLT";
326 case EDEADLOCK:
return "EDEADLOCK";
327 case EBADR:
return "EBADR";
328 case EBADRQC:
return "EBADRQC";
329 case ECHRNG:
return "ECHRNG";
330 #ifdef EISNAM // Not available on OS X, Illumos, Solaris 331 case EISNAM:
return "EISNAM";
332 case EKEYEXPIRED:
return "EKEYEXPIRED";
333 case EKEYREVOKED:
return "EKEYREVOKED";
336 case EL2HLT:
return "EL2HLT";
337 case EL2NSYNC:
return "EL2NSYNC";
338 case EL3HLT:
return "EL3HLT";
339 case EL3RST:
return "EL3RST";
340 case ELIBBAD:
return "ELIBBAD";
341 case ELIBMAX:
return "ELIBMAX";
342 case ELIBSCN:
return "ELIBSCN";
343 case ELIBEXEC:
return "ELIBEXEC";
344 #ifdef ENOMEDIUM // Not available on OS X, Illumos, Solaris 345 case ENOMEDIUM:
return "ENOMEDIUM";
346 case EMEDIUMTYPE:
return "EMEDIUMTYPE";
348 case ENONET:
return "ENONET";
349 case ENOPKG:
return "ENOPKG";
350 case EREMCHG:
return "EREMCHG";
351 case ERESTART:
return "ERESTART";
352 case ESTRPIPE:
return "ESTRPIPE";
353 #ifdef EUCLEAN // Not available on OS X, Illumos, Solaris 354 case EUCLEAN:
return "EUCLEAN";
356 case EXFULL:
return "EXFULL";
358 default:
return "Unknown";
384 #ifdef PCMK__ENOTUNIQ 385 case ENOTUNIQ:
return "Name not unique on network";
388 case ECOMM:
return "Communication error on send";
391 case ELIBACC:
return "Can not access a needed shared library";
393 #ifdef PCMK__EREMOTEIO 394 case EREMOTEIO:
return "Remote I/O error";
397 case ENOKEY:
return "Required key not available";
400 case ENODATA:
return "No data available";
403 case ETIME:
return "Timer expired";
405 #ifdef PCMK__EKEYREJECTED 406 case EKEYREJECTED:
return "Key was rejected by service";
430 legacy_rc = abs(legacy_rc);
450 default:
return legacy_rc;
502 return "CRM_EX_UNKNOWN";
524 case CRM_EX_OSERR:
return "Operating system error occurred";
532 case CRM_EX_FATAL:
return "Fatal error occurred, will not respawn";
545 case CRM_EX_OLD:
return "Update was older than existing configuration";
551 if ((exit_code > 128) && (exit_code <
CRM_EX_MAX)) {
552 return "Interrupted by signal";
554 return "Unknown exit status";
637 case EPROTONOSUPPORT:
662 #if EOPNOTSUPP != ENOTSUP 728 #if EOPNOTSUPP != ENOTSUP 752 case BZ_CONFIG_ERROR:
753 return "libbz2 has been improperly compiled on your platform";
754 case BZ_SEQUENCE_ERROR:
755 return "library functions called in the wrong order";
757 return "parameter is out of range or otherwise incorrect";
759 return "memory allocation failed";
761 return "data integrity error is detected during decompression";
762 case BZ_DATA_ERROR_MAGIC:
763 return "the compressed stream does not start with the correct magic bytes";
765 return "error reading or writing in the compressed file";
766 case BZ_UNEXPECTED_EOF:
767 return "compressed file finishes before the logical end of stream is detected";
768 case BZ_OUTBUFF_FULL:
769 return "output data will not fit into the buffer provided";
771 return "Data compression error";
780 if ((((
int) rc) < 0) || (((
int) rc) >
CRM_EX_MAX)) {
846 const
char *format, ...)
859 if (format != NULL) {
860 va_start(ap, format);
861 len = vasprintf(&reason, format, ap);
929 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.
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.
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...)
void pcmk__str_update(char **str, const char *value)
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.
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.
void pcmk__copy_result(pcmk__action_result_t *src, pcmk__action_result_t *dst)
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)