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