pacemaker  2.1.5-b7adf64e51
Scalable High-Availability cluster resource manager
crm.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-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_CRM__H
11 # define PCMK__CRM_CRM__H
12 
13 # include <crm_config.h>
14 # include <stdlib.h>
15 # include <glib.h>
16 # include <stdbool.h>
17 
18 # include <string.h>
19 
20 # include <libxml/tree.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
32 #ifndef PCMK_ALLOW_DEPRECATED
33 
44 #define PCMK_ALLOW_DEPRECATED 1
45 #endif
46 
69 # define CRM_FEATURE_SET "3.16.1"
70 
71 /* Pacemaker's CPG protocols use fixed-width binary fields for the sender and
72  * recipient of a CPG message. This imposes an arbitrary limit on cluster node
73  * names.
74  */
76 #define MAX_NAME 256
77 
78 # define CRM_META "CRM_meta"
79 
80 extern char *crm_system_name;
81 
82 /* *INDENT-OFF* */
83 
84 // How we represent "infinite" scores
85 # define CRM_SCORE_INFINITY 1000000
86 # define CRM_INFINITY_S "INFINITY"
87 # define CRM_PLUS_INFINITY_S "+" CRM_INFINITY_S
88 # define CRM_MINUS_INFINITY_S "-" CRM_INFINITY_S
89 
90 /* @COMPAT API < 2.0.0 Deprecated "infinity" aliases
91  *
92  * INFINITY might be defined elsewhere (e.g. math.h), so undefine it first.
93  * This, of course, complicates any attempt to use the other definition in any
94  * code that includes this header.
95  */
96 # undef INFINITY
97 # define INFINITY_S "INFINITY"
98 # define MINUS_INFINITY_S "-INFINITY"
99 # define INFINITY 1000000
100 
101 /* Sub-systems */
102 # define CRM_SYSTEM_DC "dc"
103 #define CRM_SYSTEM_DCIB "dcib" // Primary instance of CIB manager
104 # define CRM_SYSTEM_CIB "cib"
105 # define CRM_SYSTEM_CRMD "crmd"
106 # define CRM_SYSTEM_LRMD "lrmd"
107 # define CRM_SYSTEM_PENGINE "pengine"
108 # define CRM_SYSTEM_TENGINE "tengine"
109 # define CRM_SYSTEM_STONITHD "stonithd"
110 # define CRM_SYSTEM_MCP "pacemakerd"
111 
112 // Names of internally generated node attributes
113 # define CRM_ATTR_UNAME "#uname"
114 # define CRM_ATTR_ID "#id"
115 # define CRM_ATTR_KIND "#kind"
116 # define CRM_ATTR_ROLE "#role"
117 # define CRM_ATTR_IS_DC "#is_dc"
118 # define CRM_ATTR_CLUSTER_NAME "#cluster-name"
119 # define CRM_ATTR_SITE_NAME "#site-name"
120 # define CRM_ATTR_UNFENCED "#node-unfenced"
121 # define CRM_ATTR_DIGESTS_ALL "#digests-all"
122 # define CRM_ATTR_DIGESTS_SECURE "#digests-secure"
123 # define CRM_ATTR_PROTOCOL "#attrd-protocol"
124 # define CRM_ATTR_FEATURE_SET "#feature-set"
125 
126 /* Valid operations */
127 # define CRM_OP_NOOP "noop"
128 # define CRM_OP_JOIN_ANNOUNCE "join_announce"
129 # define CRM_OP_JOIN_OFFER "join_offer"
130 # define CRM_OP_JOIN_REQUEST "join_request"
131 # define CRM_OP_JOIN_ACKNAK "join_ack_nack"
132 # define CRM_OP_JOIN_CONFIRM "join_confirm"
133 # define CRM_OP_PING "ping"
134 # define CRM_OP_NODE_INFO "node-info"
135 # define CRM_OP_THROTTLE "throttle"
136 # define CRM_OP_VOTE "vote"
137 # define CRM_OP_NOVOTE "no-vote"
138 # define CRM_OP_HELLO "hello"
139 # define CRM_OP_PECALC "pe_calc"
140 # define CRM_OP_QUIT "quit"
141 # define CRM_OP_LOCAL_SHUTDOWN "start_shutdown"
142 # define CRM_OP_SHUTDOWN_REQ "req_shutdown"
143 # define CRM_OP_SHUTDOWN "do_shutdown"
144 # define CRM_OP_FENCE "stonith"
145 # define CRM_OP_REGISTER "register"
146 # define CRM_OP_IPC_FWD "ipc_fwd"
147 # define CRM_OP_INVOKE_LRM "lrm_invoke"
148 # define CRM_OP_LRM_REFRESH "lrm_refresh"
149 # define CRM_OP_LRM_DELETE "lrm_delete"
150 # define CRM_OP_LRM_FAIL "lrm_fail"
151 # define CRM_OP_PROBED "probe_complete"
152 # define CRM_OP_REPROBE "probe_again"
153 # define CRM_OP_CLEAR_FAILCOUNT "clear_failcount"
154 # define CRM_OP_REMOTE_STATE "remote_state"
155 # define CRM_OP_RELAXED_SET "one-or-more"
156 # define CRM_OP_RELAXED_CLONE "clone-one-or-more"
157 # define CRM_OP_RM_NODE_CACHE "rm_node_cache"
158 # define CRM_OP_MAINTENANCE_NODES "maintenance_nodes"
159 
160 /* Possible cluster membership states */
161 # define CRMD_JOINSTATE_DOWN "down"
162 # define CRMD_JOINSTATE_PENDING "pending"
163 # define CRMD_JOINSTATE_MEMBER "member"
164 # define CRMD_JOINSTATE_NACK "banned"
165 
166 # define CRMD_ACTION_DELETE "delete"
167 # define CRMD_ACTION_CANCEL "cancel"
168 
169 # define CRMD_ACTION_RELOAD "reload"
170 # define CRMD_ACTION_RELOAD_AGENT "reload-agent"
171 # define CRMD_ACTION_MIGRATE "migrate_to"
172 # define CRMD_ACTION_MIGRATED "migrate_from"
173 
174 # define CRMD_ACTION_START "start"
175 # define CRMD_ACTION_STARTED "running"
176 
177 # define CRMD_ACTION_STOP "stop"
178 # define CRMD_ACTION_STOPPED "stopped"
179 
180 # define CRMD_ACTION_PROMOTE "promote"
181 # define CRMD_ACTION_PROMOTED "promoted"
182 # define CRMD_ACTION_DEMOTE "demote"
183 # define CRMD_ACTION_DEMOTED "demoted"
184 
185 # define CRMD_ACTION_NOTIFY "notify"
186 # define CRMD_ACTION_NOTIFIED "notified"
187 
188 # define CRMD_ACTION_STATUS "monitor"
189 # define CRMD_ACTION_METADATA "meta-data"
190 # define CRMD_METADATA_CALL_TIMEOUT 30000
191 
192 /* short names */
193 # define RSC_DELETE CRMD_ACTION_DELETE
194 # define RSC_CANCEL CRMD_ACTION_CANCEL
195 
196 # define RSC_MIGRATE CRMD_ACTION_MIGRATE
197 # define RSC_MIGRATED CRMD_ACTION_MIGRATED
198 
199 # define RSC_START CRMD_ACTION_START
200 # define RSC_STARTED CRMD_ACTION_STARTED
201 
202 # define RSC_STOP CRMD_ACTION_STOP
203 # define RSC_STOPPED CRMD_ACTION_STOPPED
204 
205 # define RSC_PROMOTE CRMD_ACTION_PROMOTE
206 # define RSC_PROMOTED CRMD_ACTION_PROMOTED
207 # define RSC_DEMOTE CRMD_ACTION_DEMOTE
208 # define RSC_DEMOTED CRMD_ACTION_DEMOTED
209 
210 # define RSC_NOTIFY CRMD_ACTION_NOTIFY
211 # define RSC_NOTIFIED CRMD_ACTION_NOTIFIED
212 
213 # define RSC_STATUS CRMD_ACTION_STATUS
214 # define RSC_METADATA CRMD_ACTION_METADATA
215 /* *INDENT-ON* */
216 
217 # include <crm/common/cib.h>
218 # include <crm/common/logging.h>
219 # include <crm/common/util.h>
220 
221 static inline const char *
222 crm_action_str(const char *task, guint interval_ms) {
223  if ((task != NULL) && (interval_ms == 0)
224  && (strcasecmp(task, RSC_STATUS) == 0)) {
225  return "probe";
226  }
227  return task;
228 }
229 
230 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
231 #include <crm/crm_compat.h>
232 #endif
233 
234 #ifdef __cplusplus
235 }
236 #endif
237 
238 #endif
Deprecated Pacemaker utilities.
char * crm_system_name
Definition: utils.c:51
Wrappers for and extensions to libqb logging.
Utility functions.
#define RSC_STATUS
Definition: crm.h:213