pacemaker
2.0.3-4b1f869f0f
Scalable High-Availability cluster resource manager
include
crm
crm.h
Go to the documentation of this file.
1
/*
2
* Copyright 2004-2019 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 CRM__H
11
# define CRM__H
12
13
#ifdef __cplusplus
14
extern
"C"
{
15
#endif
16
23
# include <
crm_config.h
>
24
# include <stdlib.h>
25
# include <glib.h>
26
# include <stdbool.h>
27
28
# include <string.h>
29
30
# include <libxml/tree.h>
31
55
# define CRM_FEATURE_SET "3.2.1"
56
57
# define EOS '\0'
58
# define DIMOF(a) ((int) (sizeof(a)/sizeof(a[0])) )
59
60
# ifndef MAX_NAME
61
# define MAX_NAME 256
62
# endif
63
64
# ifndef __GNUC__
65
# define __builtin_expect(expr, result) (expr)
66
# endif
67
68
/* Some handy macros used by the Linux kernel */
69
# define __likely(expr) __builtin_expect(expr, 1)
70
# define __unlikely(expr) __builtin_expect(expr, 0)
71
72
# define CRM_META "CRM_meta"
73
74
extern
char
*
crm_system_name
;
75
76
/* *INDENT-OFF* */
77
78
// Used for some internal IPC timeouts (maybe should be configurable option)
79
# define MAX_IPC_DELAY 120
80
81
// How we represent "infinite" scores
82
# define CRM_SCORE_INFINITY 1000000
83
# define CRM_INFINITY_S "INFINITY"
84
# define CRM_PLUS_INFINITY_S "+" CRM_INFINITY_S
85
# define CRM_MINUS_INFINITY_S "-" CRM_INFINITY_S
86
87
/* @COMPAT API < 2.0.0 Deprecated "infinity" aliases
88
*
89
* INFINITY might be defined elsewhere (e.g. math.h), so undefine it first.
90
* This, of course, complicates any attempt to use the other definition in any
91
* code that includes this header.
92
*/
93
# undef INFINITY
94
# define INFINITY_S "INFINITY"
95
# define MINUS_INFINITY_S "-INFINITY"
96
# define INFINITY 1000000
97
98
/* Sub-systems */
99
# define CRM_SYSTEM_DC "dc"
100
# define CRM_SYSTEM_DCIB "dcib"
101
/* The master CIB */
102
# define CRM_SYSTEM_CIB "cib"
103
# define CRM_SYSTEM_CRMD "crmd"
104
# define CRM_SYSTEM_LRMD "lrmd"
105
# define CRM_SYSTEM_PENGINE "pengine"
106
# define CRM_SYSTEM_TENGINE "tengine"
107
# define CRM_SYSTEM_STONITHD "stonithd"
108
# define CRM_SYSTEM_MCP "pacemakerd"
109
110
// Names of internally generated node attributes
111
# define CRM_ATTR_UNAME "#uname"
112
# define CRM_ATTR_ID "#id"
113
# define CRM_ATTR_KIND "#kind"
114
# define CRM_ATTR_ROLE "#role"
115
# define CRM_ATTR_IS_DC "#is_dc"
116
# define CRM_ATTR_CLUSTER_NAME "#cluster-name"
117
# define CRM_ATTR_SITE_NAME "#site-name"
118
# define CRM_ATTR_UNFENCED "#node-unfenced"
119
# define CRM_ATTR_DIGESTS_ALL "#digests-all"
120
# define CRM_ATTR_DIGESTS_SECURE "#digests-secure"
121
# define CRM_ATTR_RA_VERSION "#ra-version"
122
# define CRM_ATTR_PROTOCOL "#attrd-protocol"
123
124
/* Valid operations */
125
# define CRM_OP_NOOP "noop"
126
# define CRM_OP_JOIN_ANNOUNCE "join_announce"
127
# define CRM_OP_JOIN_OFFER "join_offer"
128
# define CRM_OP_JOIN_REQUEST "join_request"
129
# define CRM_OP_JOIN_ACKNAK "join_ack_nack"
130
# define CRM_OP_JOIN_CONFIRM "join_confirm"
131
# define CRM_OP_PING "ping"
132
# define CRM_OP_NODE_INFO "node-info"
133
# define CRM_OP_THROTTLE "throttle"
134
# define CRM_OP_VOTE "vote"
135
# define CRM_OP_NOVOTE "no-vote"
136
# define CRM_OP_HELLO "hello"
137
# define CRM_OP_PECALC "pe_calc"
138
# define CRM_OP_QUIT "quit"
139
# define CRM_OP_LOCAL_SHUTDOWN "start_shutdown"
140
# define CRM_OP_SHUTDOWN_REQ "req_shutdown"
141
# define CRM_OP_SHUTDOWN "do_shutdown"
142
# define CRM_OP_FENCE "stonith"
143
# define CRM_OP_REGISTER "register"
144
# define CRM_OP_IPC_FWD "ipc_fwd"
145
# define CRM_OP_INVOKE_LRM "lrm_invoke"
146
# define CRM_OP_LRM_REFRESH "lrm_refresh"
/* Deprecated */
147
# define CRM_OP_LRM_QUERY "lrm_query"
148
# define CRM_OP_LRM_DELETE "lrm_delete"
149
# define CRM_OP_LRM_FAIL "lrm_fail"
150
# define CRM_OP_PROBED "probe_complete"
151
# define CRM_OP_REPROBE "probe_again"
152
# define CRM_OP_CLEAR_FAILCOUNT "clear_failcount"
153
# define CRM_OP_REMOTE_STATE "remote_state"
154
# define CRM_OP_RELAXED_SET "one-or-more"
155
# define CRM_OP_RELAXED_CLONE "clone-one-or-more"
156
# define CRM_OP_RM_NODE_CACHE "rm_node_cache"
157
# define CRM_OP_MAINTENANCE_NODES "maintenance_nodes"
158
159
/* Possible cluster membership states */
160
# define CRMD_JOINSTATE_DOWN "down"
161
# define CRMD_JOINSTATE_PENDING "pending"
162
# define CRMD_JOINSTATE_MEMBER "member"
163
# define CRMD_JOINSTATE_NACK "banned"
164
165
# define CRMD_ACTION_DELETE "delete"
166
# define CRMD_ACTION_CANCEL "cancel"
167
168
# define CRMD_ACTION_RELOAD "reload"
169
# define CRMD_ACTION_MIGRATE "migrate_to"
170
# define CRMD_ACTION_MIGRATED "migrate_from"
171
172
# define CRMD_ACTION_START "start"
173
# define CRMD_ACTION_STARTED "running"
174
175
# define CRMD_ACTION_STOP "stop"
176
# define CRMD_ACTION_STOPPED "stopped"
177
178
# define CRMD_ACTION_PROMOTE "promote"
179
# define CRMD_ACTION_PROMOTED "promoted"
180
# define CRMD_ACTION_DEMOTE "demote"
181
# define CRMD_ACTION_DEMOTED "demoted"
182
183
# define CRMD_ACTION_NOTIFY "notify"
184
# define CRMD_ACTION_NOTIFIED "notified"
185
186
# define CRMD_ACTION_STATUS "monitor"
187
# define CRMD_ACTION_METADATA "meta-data"
188
# define CRMD_METADATA_CALL_TIMEOUT 30000
189
190
/* short names */
191
# define RSC_DELETE CRMD_ACTION_DELETE
192
# define RSC_CANCEL CRMD_ACTION_CANCEL
193
194
# define RSC_MIGRATE CRMD_ACTION_MIGRATE
195
# define RSC_MIGRATED CRMD_ACTION_MIGRATED
196
197
# define RSC_START CRMD_ACTION_START
198
# define RSC_STARTED CRMD_ACTION_STARTED
199
200
# define RSC_STOP CRMD_ACTION_STOP
201
# define RSC_STOPPED CRMD_ACTION_STOPPED
202
203
# define RSC_PROMOTE CRMD_ACTION_PROMOTE
204
# define RSC_PROMOTED CRMD_ACTION_PROMOTED
205
# define RSC_DEMOTE CRMD_ACTION_DEMOTE
206
# define RSC_DEMOTED CRMD_ACTION_DEMOTED
207
208
# define RSC_NOTIFY CRMD_ACTION_NOTIFY
209
# define RSC_NOTIFIED CRMD_ACTION_NOTIFIED
210
211
# define RSC_STATUS CRMD_ACTION_STATUS
212
# define RSC_METADATA CRMD_ACTION_METADATA
213
/* *INDENT-ON* */
214
215
typedef
GList *
GListPtr
;
216
217
# include <
crm/common/logging.h
>
218
# include <
crm/common/util.h
>
219
220
static
inline
const
char
*
221
crm_action_str(
const
char
*task, guint interval_ms) {
222
if
(
safe_str_eq
(task,
RSC_STATUS
) && !interval_ms) {
223
return
"probe"
;
224
}
225
return
task;
226
}
227
228
#ifdef __cplusplus
229
}
230
#endif
231
232
#endif
GListPtr
GList * GListPtr
Definition:
crm.h:215
crm_config.h
safe_str_eq
#define safe_str_eq(a, b)
Definition:
util.h:61
crm_system_name
char * crm_system_name
Definition:
utils.c:61
RSC_STATUS
#define RSC_STATUS
Definition:
crm.h:211
logging.h
Wrappers for and extensions to libqb logging.
util.h
Utility functions.
Generated on Wed Dec 9 2020 13:27:00 for pacemaker by
1.8.17