pacemaker 2.1.5-a3f44794f94
Scalable High-Availability cluster resource manager
services_compat.h
Go to the documentation of this file.
1/*
2 * Copyright 2010-2022 the Pacemaker project contributors
3 *
4 * The version control history for this file may have further details.
5 *
6 * This source code is licensed under the GNU Lesser General Public License
7 * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
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
19extern "C" {
20#endif
21
31# ifndef LSB_ROOT_DIR
33# define LSB_ROOT_DIR "/etc/init.d"
34# endif
35
50};
51
53svc_action_t *services_action_create(const char *name, const char *action,
54 guint interval_ms, int timeout);
55
57GList *services_list(void);
58
60static inline const char *
61services_lrm_status_str(enum op_status status)
62{
63 return pcmk_exec_status_str((enum pcmk_exec_status) status);
64}
65
67static inline enum ocf_exitcode
68services_get_ocf_exitcode(const char *action, int lsb_exitcode)
69{
70 /* For non-status actions, LSB and OCF share error code meaning <= 7 */
71 if (action && strcmp(action, "status") && strcmp(action, "monitor")) {
74 }
75 return (enum ocf_exitcode)lsb_exitcode;
76 }
77
78 /* status has different return codes */
79 switch (lsb_exitcode) {
81 return PCMK_OCF_OK;
90 }
92}
93
94#ifdef __cplusplus
95}
96#endif
97
98#endif
const char * name
Definition: cib.c:24
unsigned int timeout
Definition: pcmk_fence.c:32
const char * action
Definition: pcmk_fence.c:30
Function and executable result codes.
ocf_exitcode
Exit status codes for resource agents.
Definition: results.h:163
@ PCMK_OCF_INSUFFICIENT_PRIV
Insufficient privileges.
Definition: results.h:168
@ PCMK_OCF_NOT_INSTALLED
Dependencies not available locally.
Definition: results.h:169
@ PCMK_OCF_UNKNOWN_ERROR
Unspecified error.
Definition: results.h:165
@ PCMK_OCF_NOT_RUNNING
Service safely stopped.
Definition: results.h:171
@ PCMK_OCF_OK
Success.
Definition: results.h:164
pcmk_exec_status
Execution status.
Definition: results.h:309
@ PCMK_EXEC_CANCELLED
Action was cancelled.
Definition: results.h:313
@ PCMK_EXEC_ERROR_FATAL
Execution failed, do not retry anywhere.
Definition: results.h:318
@ PCMK_EXEC_NOT_INSTALLED
Agent or dependency not available locally.
Definition: results.h:319
@ PCMK_EXEC_INVALID
Action cannot be attempted (e.g. shutdown)
Definition: results.h:321
@ PCMK_EXEC_DONE
Action completed, result is known.
Definition: results.h:312
@ PCMK_EXEC_ERROR
Execution failed, may be retried.
Definition: results.h:316
@ PCMK_EXEC_NOT_SUPPORTED
Agent does not implement requested action.
Definition: results.h:315
@ PCMK_EXEC_TIMEOUT
Action did not complete in time.
Definition: results.h:314
@ PCMK_EXEC_PENDING
Action is in progress.
Definition: results.h:311
@ PCMK_EXEC_UNKNOWN
Used only to initialize variables.
Definition: results.h:310
@ PCMK_EXEC_ERROR_HARD
Execution failed, do not retry on node.
Definition: results.h:317
@ PCMK_EXEC_NOT_CONNECTED
No connection to executor.
Definition: results.h:320
Services API.
@ PCMK_LSB_STATUS_NOT_INSTALLED
Definition: services.h:69
@ PCMK_LSB_STATUS_OK
Definition: services.h:62
@ PCMK_LSB_STATUS_VAR_PID
Definition: services.h:63
@ PCMK_LSB_STATUS_INSUFFICIENT_PRIV
Definition: services.h:70
@ PCMK_LSB_STATUS_VAR_LOCK
Definition: services.h:64
@ PCMK_LSB_STATUS_NOT_RUNNING
Definition: services.h:65
lsb_exitcode
Definition: services.h:49
@ PCMK_LSB_NOT_RUNNING
Definition: services.h:57
op_status
@ PCMK_LRM_OP_DONE
@ PCMK_LRM_OP_NOT_INSTALLED
@ PCMK_LRM_OP_TIMEOUT
@ PCMK_LRM_OP_INVALID
@ PCMK_LRM_OP_CANCELLED
@ PCMK_LRM_OP_ERROR_HARD
@ PCMK_LRM_OP_ERROR_FATAL
@ PCMK_LRM_OP_UNKNOWN
@ PCMK_LRM_OP_PENDING
@ PCMK_LRM_OP_NOT_CONNECTED
@ PCMK_LRM_OP_NOTSUPPORTED
@ PCMK_LRM_OP_ERROR
GList * services_list(void)
Definition: services_lsb.c:335
svc_action_t * services_action_create(const char *name, const char *action, guint interval_ms, int timeout)
Definition: services_lsb.c:327
Object for executing external actions.
Definition: services.h:112