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