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
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 && strcmp(action, "status") && strcmp(action, "monitor")) {
72 if ((lsb_exitcode < 0) || (lsb_exitcode > PCMK_LSB_NOT_RUNNING)) {
73 return PCMK_OCF_UNKNOWN_ERROR;
74 }
75 return (enum ocf_exitcode)lsb_exitcode;
76 }
77
78
79 switch (lsb_exitcode) {
80 case PCMK_LSB_STATUS_OK:
81 return PCMK_OCF_OK;
82 case PCMK_LSB_STATUS_NOT_INSTALLED:
83 return PCMK_OCF_NOT_INSTALLED;
84 case PCMK_LSB_STATUS_INSUFFICIENT_PRIV:
85 return PCMK_OCF_INSUFFICIENT_PRIV;
86 case PCMK_LSB_STATUS_VAR_PID:
87 case PCMK_LSB_STATUS_VAR_LOCK:
88 case PCMK_LSB_STATUS_NOT_RUNNING:
89 return PCMK_OCF_NOT_RUNNING;
90 }
91 return PCMK_OCF_UNKNOWN_ERROR;
92 }
93
94 #ifdef __cplusplus
95 }
96 #endif
97
98 #endif