This source file includes following definitions.
- services_lrm_status_str
- services_get_ocf_exitcode
1
2
3
4
5
6
7
8
9
10 #ifndef PCMK__CRM_SERVICES_COMPAT__H
11 # define PCMK__CRM_SERVICES_COMPAT__H
12
13 #include <crm/common/actions.h>
14 #include <crm/common/results.h>
15 #include <crm/services.h>
16 #include <glib.h>
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21
22
23
24
25
26
27
28
29
30
31 # ifndef LSB_ROOT_DIR
32
33 # define LSB_ROOT_DIR "/etc/init.d"
34 # endif
35
36
37 enum op_status {
38 PCMK_LRM_OP_UNKNOWN = PCMK_EXEC_UNKNOWN,
39 PCMK_LRM_OP_PENDING = PCMK_EXEC_PENDING,
40 PCMK_LRM_OP_DONE = PCMK_EXEC_DONE,
41 PCMK_LRM_OP_CANCELLED = PCMK_EXEC_CANCELLED,
42 PCMK_LRM_OP_TIMEOUT = PCMK_EXEC_TIMEOUT,
43 PCMK_LRM_OP_NOTSUPPORTED = PCMK_EXEC_NOT_SUPPORTED,
44 PCMK_LRM_OP_ERROR = PCMK_EXEC_ERROR,
45 PCMK_LRM_OP_ERROR_HARD = PCMK_EXEC_ERROR_HARD,
46 PCMK_LRM_OP_ERROR_FATAL = PCMK_EXEC_ERROR_FATAL,
47 PCMK_LRM_OP_NOT_INSTALLED = PCMK_EXEC_NOT_INSTALLED,
48 PCMK_LRM_OP_NOT_CONNECTED = PCMK_EXEC_NOT_CONNECTED,
49 PCMK_LRM_OP_INVALID = PCMK_EXEC_INVALID,
50 };
51
52
53 svc_action_t *services_action_create(const char *name, const char *action,
54 guint interval_ms, int timeout);
55
56
57 GList *services_list(void);
58
59
60 static inline const char *
61 services_lrm_status_str(enum op_status status)
62 {
63 return pcmk_exec_status_str((enum pcmk_exec_status) status);
64 }
65
66
67 static inline enum ocf_exitcode
68 services_get_ocf_exitcode(const char *action, int lsb_exitcode)
69 {
70
71 if ((action != NULL) && (strcmp(action, PCMK_ACTION_STATUS) != 0)
72 && (strcmp(action, PCMK_ACTION_MONITOR) != 0)) {
73 if ((lsb_exitcode < 0) || (lsb_exitcode > PCMK_LSB_NOT_RUNNING)) {
74 return PCMK_OCF_UNKNOWN_ERROR;
75 }
76 return (enum ocf_exitcode)lsb_exitcode;
77 }
78
79
80 switch (lsb_exitcode) {
81 case PCMK_LSB_STATUS_OK:
82 return PCMK_OCF_OK;
83 case PCMK_LSB_STATUS_NOT_INSTALLED:
84 return PCMK_OCF_NOT_INSTALLED;
85 case PCMK_LSB_STATUS_INSUFFICIENT_PRIV:
86 return PCMK_OCF_INSUFFICIENT_PRIV;
87 case PCMK_LSB_STATUS_VAR_PID:
88 case PCMK_LSB_STATUS_VAR_LOCK:
89 case PCMK_LSB_STATUS_NOT_RUNNING:
90 return PCMK_OCF_NOT_RUNNING;
91 }
92 return PCMK_OCF_UNKNOWN_ERROR;
93 }
94
95 #ifdef __cplusplus
96 }
97 #endif
98
99 #endif