pacemaker 2.1.8-2.1.8
Scalable High-Availability cluster resource manager
Loading...
Searching...
No Matches
services_compat.h
Go to the documentation of this file.
1/*
2 * Copyright 2010-2023 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#include <crm/common/actions.h>
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
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 != NULL) && (strcmp(action, PCMK_ACTION_STATUS) != 0)
72 && (strcmp(action, PCMK_ACTION_MONITOR) != 0)) {
75 }
76 return (enum ocf_exitcode)lsb_exitcode;
77 }
78
79 /* status has different return codes */
80 switch (lsb_exitcode) {
82 return PCMK_OCF_OK;
91 }
93}
94
95#ifdef __cplusplus
96}
97#endif
98
99#endif
APIs related to actions.
#define PCMK_ACTION_STATUS
Definition actions.h:73
#define PCMK_ACTION_MONITOR
Definition actions.h:60
const char * name
Definition cib.c:26
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:177
@ PCMK_OCF_INSUFFICIENT_PRIV
Insufficient privileges.
Definition results.h:185
@ PCMK_OCF_NOT_INSTALLED
Dependencies not available locally.
Definition results.h:186
@ PCMK_OCF_UNKNOWN_ERROR
Unspecified error.
Definition results.h:181
@ PCMK_OCF_NOT_RUNNING
Service safely stopped.
Definition results.h:190
@ PCMK_OCF_OK
Success.
Definition results.h:178
pcmk_exec_status
Execution status.
Definition results.h:330
@ PCMK_EXEC_CANCELLED
Action was cancelled.
Definition results.h:334
@ PCMK_EXEC_ERROR_FATAL
Execution failed, do not retry anywhere.
Definition results.h:339
@ PCMK_EXEC_NOT_INSTALLED
Agent or dependency not available locally.
Definition results.h:340
@ PCMK_EXEC_INVALID
Action cannot be attempted (e.g. shutdown)
Definition results.h:342
@ PCMK_EXEC_DONE
Action completed, result is known.
Definition results.h:333
@ PCMK_EXEC_ERROR
Execution failed, may be retried.
Definition results.h:337
@ PCMK_EXEC_NOT_SUPPORTED
Agent does not implement requested action.
Definition results.h:336
@ PCMK_EXEC_TIMEOUT
Action did not complete in time.
Definition results.h:335
@ PCMK_EXEC_PENDING
Action is in progress.
Definition results.h:332
@ PCMK_EXEC_UNKNOWN
Used only to initialize variables.
Definition results.h:331
@ PCMK_EXEC_ERROR_HARD
Execution failed, do not retry on node.
Definition results.h:338
@ PCMK_EXEC_NOT_CONNECTED
No connection to executor.
Definition results.h:341
Services API.
@ PCMK_LSB_STATUS_NOT_INSTALLED
Definition services.h:74
@ PCMK_LSB_STATUS_OK
Definition services.h:67
@ PCMK_LSB_STATUS_VAR_PID
Definition services.h:68
@ PCMK_LSB_STATUS_INSUFFICIENT_PRIV
Definition services.h:75
@ PCMK_LSB_STATUS_VAR_LOCK
Definition services.h:69
@ PCMK_LSB_STATUS_NOT_RUNNING
Definition services.h:70
lsb_exitcode
Definition services.h:51
@ PCMK_LSB_NOT_RUNNING
Definition services.h:62
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)
svc_action_t * services_action_create(const char *name, const char *action, guint interval_ms, int timeout)
Object for executing external actions.
Definition services.h:122