pacemaker  2.1.8-3980678f03
Scalable High-Availability cluster resource manager
compatibility.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2024 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 PCMK__CRM_COMPATIBILITY__H
10 # define PCMK__CRM_COMPATIBILITY__H
11 
12 #include <crm/msg_xml_compat.h> // PCMK_XE_PROMOTABLE_LEGACY
13 #include <crm/common/xml.h>
14 #include <crm/pengine/pe_types.h> // enum pe_obj_types
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 /* This file allows external code that uses Pacemaker libraries to transition
21  * more easily from old APIs to current ones. Any code that compiled with an
22  * earlier API but not with the current API can include this file and have a
23  * good chance of compiling again.
24  *
25  * Everything here is deprecated and will be removed at the next major Pacemaker
26  * release (i.e. 3.0), so it should only be used during a transitionary period
27  * while the external code is being updated to the current API.
28  */
29 
30 /* Heartbeat-specific definitions. Support for heartbeat has been removed
31  * entirely, so any code branches relying on these should be deleted.
32  */
33 #define ACTIVESTATUS "active"
34 #define DEADSTATUS "dead"
35 #define PINGSTATUS "ping"
36 #define JOINSTATUS "join"
37 #define LEAVESTATUS "leave"
38 #define NORMALNODE "normal"
39 #define CRM_NODE_EVICTED "evicted"
40 #define CRM_LEGACY_CONFIG_DIR "/var/lib/heartbeat/crm"
41 #define HA_VARLIBHBDIR "/var/lib/heartbeat"
42 #define pcmk_cluster_heartbeat 0x0004
43 
44 /* Corosync-version-1-specific definitions */
45 
46 /* Support for corosync version 1 has been removed entirely, so any code
47  * branches relying on these should be deleted.
48  */
49 #define PCMK_SERVICE_ID 9
50 #define CRM_SERVICE PCMK_SERVICE_ID
51 #define XML_ATTR_EXPECTED_VOTES "expected-quorum-votes"
52 #define crm_class_members 1
53 #define crm_class_notify 2
54 #define crm_class_nodeid 3
55 #define crm_class_rmpeer 4
56 #define crm_class_quorum 5
57 #define pcmk_cluster_classic_ais 0x0010
58 #define pcmk_cluster_cman 0x0040
59 #define ais_fd_sync -1
60 
61 // These are always true now
62 #define CS_USES_LIBQB 1
63 #define HAVE_CMAP 1
64 #define SUPPORT_CS_QUORUM 1
65 #define SUPPORT_AIS 1
66 #define AIS_COROSYNC 1
67 
68 // These are always false now
69 #define HAVE_CONFDB 0
70 #define SUPPORT_CMAN 0
71 #define SUPPORT_PLUGIN 0
72 #define SUPPORT_STONITH_CONFIG 0
73 #define is_classic_ais_cluster() 0
74 #define is_cman_cluster() 0
75 
76 // These have newer names
77 #define is_openais_cluster() is_corosync_cluster()
78 #if SUPPORT_COROSYNC
79 #define SUPPORT_CS
80 #endif
81 
82 /* Isolation-specific definitions. Support for the resource isolation feature
83  * has been removed * entirely, so any code branches relying on these should be
84  * deleted.
85  */
86 #define XML_RSC_ATTR_ISOLATION_INSTANCE "isolation-instance"
87 #define XML_RSC_ATTR_ISOLATION_WRAPPER "isolation-wrapper"
88 #define XML_RSC_ATTR_ISOLATION_HOST "isolation-host"
89 #define XML_RSC_ATTR_ISOLATION "isolation"
90 
91 /* Schema-related definitions */
92 
93 // This has been renamed
94 #define CRM_DTD_DIRECTORY CRM_SCHEMA_DIRECTORY
95 
96 /* Exit-code-related definitions */
97 
98 #define DAEMON_RESPAWN_STOP CRM_EX_FATAL
99 #define pcmk_err_panic CRM_EX_PANIC
100 
101 // Deprecated symbols that were removed
102 #define APPNAME_LEN 256
103 #define CRM_NODE_ACTIVE CRM_NODE_MEMBER
104 #define CRM_OP_DIE "die_no_respawn"
105 #define CRM_OP_RETRIVE_CIB "retrieve_cib"
106 #define CRM_OP_HBEAT "dc_beat"
107 #define CRM_OP_ABORT "abort"
108 #define CRM_OP_DEBUG_UP "debug_inc"
109 #define CRM_OP_DEBUG_DOWN "debug_dec"
110 #define CRM_OP_EVENTCC "event_cc"
111 #define CRM_OP_TEABORT "te_abort"
112 #define CRM_OP_TEABORTED "te_abort_confirmed"
113 #define CRM_OP_TE_HALT "te_halt"
114 #define CRM_OP_TECOMPLETE "te_complete"
115 #define CRM_OP_TETIMEOUT "te_timeout"
116 #define CRM_OP_TRANSITION "transition"
117 #define CRM_OP_NODES_PROBED "probe_nodes_complete"
118 #define DOT_ALL_FSA_INPUTS 1
119 #define DOT_FSA_ACTIONS 1
120 #define F_LRMD_CANCEL_CALLID "lrmd_cancel_callid"
121 #define F_LRMD_RSC_METADATA "lrmd_rsc_metadata_res"
122 #define F_LRMD_IPC_PROXY_NODE "lrmd_ipc_proxy_node"
123 #define INSTANCE(x) crm_element_value(x, XML_CIB_ATTR_INSTANCE)
124 #define LOG_DEBUG_2 LOG_TRACE
125 #define LOG_DEBUG_3 LOG_TRACE
126 #define LOG_DEBUG_4 LOG_TRACE
127 #define LOG_DEBUG_5 LOG_TRACE
128 #define LOG_DEBUG_6 LOG_TRACE
129 #define LRMD_OP_RSC_CHK_REG "lrmd_rsc_check_register"
130 #define MAX_IPC_FAIL 5
131 #define NAME(x) crm_element_value(x, PCMK_XA_NAME)
132 #define MSG_LOG 1
133 #define PE_OBJ_T_NATIVE "native"
134 #define PE_OBJ_T_GROUP "group"
135 #define PE_OBJ_T_INCARNATION "clone"
136 #define PE_OBJ_T_MASTER "master"
137 #define SERVICE_SCRIPT "/sbin/service"
138 #define SOCKET_LEN 1024
139 #define TSTAMP(x) crm_element_value(x, PCMK_XA_CRM_TIMESTAMP)
140 #define XML_ATTR_TAGNAME F_XML_TAGNAME
141 #define XML_ATTR_FILTER_TYPE "type-filter"
142 #define XML_ATTR_FILTER_ID "id-filter"
143 #define XML_ATTR_FILTER_PRIORITY "priority-filter"
144 #define XML_ATTR_DC "is_dc"
145 #define XML_MSG_TAG "crm_message"
146 #define XML_MSG_TAG_DATA "msg_data"
147 #define XML_FAIL_TAG_RESOURCE "failed_resource"
148 #define XML_FAILRES_ATTR_RESID "resource_id"
149 #define XML_FAILRES_ATTR_REASON PCMK_XA_REASON
150 #define XML_FAILRES_ATTR_RESSTATUS "resource_status"
151 #define XML_ATTR_RESULT PCMK_XA_RESULT
152 #define XML_ATTR_SECTION "section"
153 #define XML_CIB_TAG_DOMAIN "domain"
154 #define XML_CIB_TAG_CONSTRAINT "constraint"
155 #define XML_RSC_ATTR_STATE "clone-state"
156 #define XML_RSC_ATTR_PRIORITY PCMK_META_PRIORITY
157 #define XML_OP_ATTR_DEPENDENT "dependent-on"
158 #define XML_LRM_TAG_AGENTS "lrm_agents"
159 #define XML_LRM_TAG_AGENT "lrm_agent"
160 #define XML_LRM_TAG_ATTRIBUTES "attributes"
161 #define XML_CIB_ATTR_HEALTH "health"
162 #define XML_CIB_ATTR_WEIGHT "weight"
163 #define XML_CIB_ATTR_CLEAR "clear_on"
164 #define XML_CIB_ATTR_STONITH "stonith"
165 #define XML_CIB_ATTR_STANDBY "standby"
166 #define XML_RULE_ATTR_SCORE_MANGLED "score-attribute-mangled"
167 #define XML_RULE_ATTR_RESULT PCMK_XA_RESULT
168 #define XML_NODE_ATTR_STATE "state"
169 #define XML_ATTR_LRM_PROBE "lrm-is-probe"
170 #define XML_ATTR_TE_ALLOWFAIL "op_allow_fail"
171 #define VALUE(x) crm_element_value(x, PCMK_XA_VALUE)
172 #define action_wrapper_s pe_action_wrapper_s
173 #define add_cib_op_callback(cib, id, flag, data, fn) do { \
174  cib->cmds->register_callback(cib, id, 120, flag, data, #fn, fn); \
175  } while(0)
176 #define cib_default_options = cib_none
177 #define crm_remote_baremetal 0x0004
178 #define crm_remote_container 0x0002
179 #define crm_element_value_const crm_element_value
180 #define crm_element_value_const_int crm_element_value_int
181 #define n_object_classes 3
182 #define no_quorum_policy_e pe_quorum_policy
183 #define node_s pe_node_s
184 #define node_shared_s pe_node_shared_s
185 #define pe_action_failure_is_fatal 0x00020
186 #define pe_rsc_munging 0x00000800ULL
187 #define pe_rsc_try_reload 0x00001000ULL
188 #define pe_rsc_shutdown 0x00020000ULL
189 #define pe_rsc_migrating 0x00400000ULL
190 #define pe_rsc_unexpectedly_running 0x02000000ULL
191 #define pe_rsc_have_unfencing 0x80000000ULL
192 #define resource_s pe_resource_s
193 #define ticket_s pe_ticket_s
194 
195 #define node_score_infinity 1000000
196 
197 /* Clone terminology definitions */
198 
199 // These can no longer be used in a switch together
200 #define pe_master pcmk_rsc_variant_clone
201 
202 static inline enum pe_obj_types
203 get_resource_type(const char *name)
204 {
207 
208  } else if (safe_str_eq(name, PCMK_XE_GROUP)) {
209  return pcmk_rsc_variant_group;
210 
211  } else if (safe_str_eq(name, PCMK_XE_CLONE)
213  return pcmk_rsc_variant_clone;
214 
215  } else if (safe_str_eq(name, PCMK_XE_BUNDLE)) {
217  }
218 
220 }
221 
222 static inline const char *
223 get_resource_typename(enum pe_obj_types type)
224 {
225  switch (type) {
227  return PCMK_XE_PRIMITIVE;
229  return PCMK_XE_GROUP;
231  return PCMK_XE_CLONE;
233  return PCMK_XE_BUNDLE;
235  return "unknown";
236  }
237  return "<unknown>";
238 }
239 
240 #ifdef __cplusplus
241 }
242 #endif
243 
244 #endif
const char * name
Definition: cib.c:26
#define safe_str_eq(a, b)
Definition: util_compat.h:65
#define PCMK_XE_PRIMITIVE
Definition: xml_names.h:160
Deprecated Pacemaker XML constants API.
enum crm_ais_msg_types type
Definition: cpg.c:51
#define PCMK_XE_BUNDLE
Definition: xml_names.h:72
#define PCMK_XE_PROMOTABLE_LEGACY
#define PCMK_XE_CLONE
Definition: xml_names.h:80
pe_obj_types
Definition: resources.h:34
Wrappers for and extensions to libxml2.
#define PCMK_XE_GROUP
Definition: xml_names.h:116
Data types for cluster status.