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