pacemaker  2.0.2-debe490
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
compatibility.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 General Public License version 2
7  * or later (GPLv2+) WITHOUT ANY WARRANTY.
8  */
9 #ifndef CRM_COMPATIBILITY__H
10 # define CRM_COMPATIBILITY__H
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15 
16 #include <crm/msg_xml.h>
17 #include <crm/pengine/pe_types.h> // enum pe_obj_types
18 
19 /* Heartbeat-specific definitions. Support for heartbeat has been removed
20  * entirely, so any code branches relying on these should be deleted.
21  */
22 #define ACTIVESTATUS "active"
23 #define DEADSTATUS "dead"
24 #define PINGSTATUS "ping"
25 #define JOINSTATUS "join"
26 #define LEAVESTATUS "leave"
27 #define NORMALNODE "normal"
28 #define CRM_NODE_EVICTED "evicted"
29 #define CRM_LEGACY_CONFIG_DIR "/var/lib/heartbeat/crm"
30 #define HA_VARLIBHBDIR "/var/lib/heartbeat"
31 #define pcmk_cluster_heartbeat 0x0004
32 
33 /* Corosync-version-1-specific definitions */
34 
35 /* Support for corosync version 1 has been removed entirely, so any code
36  * branches relying on these should be deleted.
37  */
38 #define PCMK_SERVICE_ID 9
39 #define CRM_SERVICE PCMK_SERVICE_ID
40 #define XML_ATTR_EXPECTED_VOTES "expected-quorum-votes"
41 #define crm_class_members 1
42 #define crm_class_notify 2
43 #define crm_class_nodeid 3
44 #define crm_class_rmpeer 4
45 #define crm_class_quorum 5
46 #define pcmk_cluster_classic_ais 0x0010
47 #define pcmk_cluster_cman 0x0040
48 #define ais_fd_sync -1
49 
50 // These are always true now
51 #define CS_USES_LIBQB 1
52 #define HAVE_CMAP 1
53 #define SUPPORT_CS_QUORUM 1
54 #define SUPPORT_AIS 1
55 #define AIS_COROSYNC 1
56 
57 // These are always false now
58 #define HAVE_CONFDB 0
59 #define SUPPORT_CMAN 0
60 #define SUPPORT_PLUGIN 0
61 #define SUPPORT_STONITH_CONFIG 0
62 #define is_classic_ais_cluster() 0
63 #define is_cman_cluster() 0
64 
65 // These have newer names
66 #define is_openais_cluster() is_corosync_cluster()
67 #if SUPPORT_COROSYNC
68 #define SUPPORT_CS
69 #endif
70 
71 /* Isolation-specific definitions. Support for the resource isolation feature
72  * has been removed * entirely, so any code branches relying on these should be
73  * deleted.
74  */
75 #define XML_RSC_ATTR_ISOLATION_INSTANCE "isolation-instance"
76 #define XML_RSC_ATTR_ISOLATION_WRAPPER "isolation-wrapper"
77 #define XML_RSC_ATTR_ISOLATION_HOST "isolation-host"
78 #define XML_RSC_ATTR_ISOLATION "isolation"
79 
80 /* Schema-related definitions */
81 
82 // This has been renamed
83 #define CRM_DTD_DIRECTORY CRM_SCHEMA_DIRECTORY
84 
85 /* Exit-code-related definitions */
86 
87 #define DAEMON_RESPAWN_STOP CRM_EX_FATAL
88 #define pcmk_err_panic CRM_EX_PANIC
89 
90 // Deprecated symbols that were removed
91 #define APPNAME_LEN 256
92 #define CRM_NODE_ACTIVE CRM_NODE_MEMBER
93 #define CRM_OP_DIE "die_no_respawn"
94 #define CRM_OP_RETRIVE_CIB "retrieve_cib"
95 #define CRM_OP_HBEAT "dc_beat"
96 #define CRM_OP_ABORT "abort"
97 #define CRM_OP_DEBUG_UP "debug_inc"
98 #define CRM_OP_DEBUG_DOWN "debug_dec"
99 #define CRM_OP_EVENTCC "event_cc"
100 #define CRM_OP_TEABORT "te_abort"
101 #define CRM_OP_TEABORTED "te_abort_confirmed"
102 #define CRM_OP_TE_HALT "te_halt"
103 #define CRM_OP_TECOMPLETE "te_complete"
104 #define CRM_OP_TETIMEOUT "te_timeout"
105 #define CRM_OP_TRANSITION "transition"
106 #define CRM_OP_NODES_PROBED "probe_nodes_complete"
107 #define DOT_ALL_FSA_INPUTS 1
108 #define DOT_FSA_ACTIONS 1
109 #define F_LRMD_CANCEL_CALLID "lrmd_cancel_callid"
110 #define F_LRMD_RSC_METADATA "lrmd_rsc_metadata_res"
111 #define F_LRMD_IPC_PROXY_NODE "lrmd_ipc_proxy_node"
112 #define INSTANCE(x) crm_element_value(x, XML_CIB_ATTR_INSTANCE)
113 #define LOG_DEBUG_2 LOG_TRACE
114 #define LOG_DEBUG_3 LOG_TRACE
115 #define LOG_DEBUG_4 LOG_TRACE
116 #define LOG_DEBUG_5 LOG_TRACE
117 #define LOG_DEBUG_6 LOG_TRACE
118 #define LRMD_OP_RSC_CHK_REG "lrmd_rsc_check_register"
119 #define MAX_IPC_FAIL 5
120 #define NAME(x) crm_element_value(x, XML_NVPAIR_ATTR_NAME)
121 #define MSG_LOG 1
122 #define PE_OBJ_T_NATIVE "native"
123 #define PE_OBJ_T_GROUP "group"
124 #define PE_OBJ_T_INCARNATION "clone"
125 #define PE_OBJ_T_MASTER "master"
126 #define SERVICE_SCRIPT "/sbin/service"
127 #define SOCKET_LEN 1024
128 #define TSTAMP(x) crm_element_value(x, XML_ATTR_TSTAMP)
129 #define XML_ATTR_TAGNAME F_XML_TAGNAME
130 #define XML_ATTR_FILTER_TYPE "type-filter"
131 #define XML_ATTR_FILTER_ID "id-filter"
132 #define XML_ATTR_FILTER_PRIORITY "priority-filter"
133 #define XML_ATTR_DC "is_dc"
134 #define XML_MSG_TAG "crm_message"
135 #define XML_MSG_TAG_DATA "msg_data"
136 #define XML_FAIL_TAG_RESOURCE "failed_resource"
137 #define XML_FAILRES_ATTR_RESID "resource_id"
138 #define XML_FAILRES_ATTR_REASON "reason"
139 #define XML_FAILRES_ATTR_RESSTATUS "resource_status"
140 #define XML_ATTR_RESULT "result"
141 #define XML_ATTR_SECTION "section"
142 #define XML_CIB_TAG_DOMAIN "domain"
143 #define XML_CIB_TAG_CONSTRAINT "constraint"
144 #define XML_RSC_ATTR_STATE "clone-state"
145 #define XML_RSC_ATTR_PRIORITY "priority"
146 #define XML_OP_ATTR_DEPENDENT "dependent-on"
147 #define XML_LRM_TAG_AGENTS "lrm_agents"
148 #define XML_LRM_TAG_AGENT "lrm_agent"
149 #define XML_LRM_TAG_ATTRIBUTES "attributes"
150 #define XML_CIB_ATTR_HEALTH "health"
151 #define XML_CIB_ATTR_WEIGHT "weight"
152 #define XML_CIB_ATTR_CLEAR "clear_on"
153 #define XML_CIB_ATTR_STONITH "stonith"
154 #define XML_CIB_ATTR_STANDBY "standby"
155 #define XML_RULE_ATTR_SCORE_MANGLED "score-attribute-mangled"
156 #define XML_RULE_ATTR_RESULT "result"
157 #define XML_NODE_ATTR_STATE "state"
158 #define XML_ATTR_LRM_PROBE "lrm-is-probe"
159 #define XML_ATTR_TE_ALLOWFAIL "op_allow_fail"
160 #define VALUE(x) crm_element_value(x, XML_NVPAIR_ATTR_VALUE)
161 #define action_wrapper_s pe_action_wrapper_s
162 #define add_cib_op_callback(cib, id, flag, data, fn) do { \
163  cib->cmds->register_callback(cib, id, 120, flag, data, #fn, fn); \
164  } while(0)
165 #define cib_default_options = cib_none
166 #define crm_remote_baremetal 0x0004
167 #define crm_remote_container 0x0002
168 #define crm_element_value_const crm_element_value
169 #define crm_element_value_const_int crm_element_value_int
170 #define n_object_classes 3
171 #define no_quorum_policy_e pe_quorum_policy
172 #define node_s pe_node_s
173 #define node_shared_s pe_node_shared_s
174 #define pe_action_failure_is_fatal 0x00020
175 #define pe_rsc_munging 0x00000800ULL
176 #define pe_rsc_try_reload 0x00001000ULL
177 #define pe_rsc_shutdown 0x00020000ULL
178 #define pe_rsc_migrating 0x00400000ULL
179 #define pe_rsc_unexpectedly_running 0x02000000ULL
180 #define pe_rsc_have_unfencing 0x80000000ULL
181 #define resource_s pe_resource_s
182 #define ticket_s pe_ticket_s
183 
184 #define node_score_infinity 1000000
185 
186 /* Clone terminology definitions */
187 
188 // These can no longer be used in a switch together
189 #define pe_master pe_clone
190 
191 static inline enum pe_obj_types
192 get_resource_type(const char *name)
193 {
194  if (safe_str_eq(name, XML_CIB_TAG_RESOURCE)) {
195  return pe_native;
196 
197  } else if (safe_str_eq(name, XML_CIB_TAG_GROUP)) {
198  return pe_group;
199 
200  } else if (safe_str_eq(name, XML_CIB_TAG_INCARNATION)
201  || safe_str_eq(name, XML_CIB_TAG_MASTER)) {
202  return pe_clone;
203 
204  } else if (safe_str_eq(name, XML_CIB_TAG_CONTAINER)) {
205  return pe_container;
206  }
207 
208  return pe_unknown;
209 }
210 
211 static inline const char *
212 get_resource_typename(enum pe_obj_types type)
213 {
214  switch (type) {
215  case pe_native:
216  return XML_CIB_TAG_RESOURCE;
217  case pe_group:
218  return XML_CIB_TAG_GROUP;
219  case pe_clone:
221  case pe_container:
222  return XML_CIB_TAG_CONTAINER;
223  case pe_unknown:
224  return "unknown";
225  }
226  return "<unknown>";
227 }
228 
229 #ifdef __cplusplus
230 }
231 #endif
232 
233 #endif
#define XML_CIB_TAG_CONTAINER
Definition: msg_xml.h:178
#define XML_CIB_TAG_RESOURCE
Definition: msg_xml.h:174
#define XML_CIB_TAG_INCARNATION
Definition: msg_xml.h:176
#define XML_CIB_TAG_MASTER
Definition: msg_xml.h:177
#define XML_CIB_TAG_GROUP
Definition: msg_xml.h:175
Data types for cluster status.
#define safe_str_eq(a, b)
Definition: util.h:59
pe_obj_types
Definition: pe_types.h:34
enum crm_ais_msg_types type
Definition: internal.h:85