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