1 /*
2 * Copyright 2004-2023 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
26 /**
27 * \file
28 * \brief A dumping ground
29 * \ingroup core
30 */
31
32 #ifndef PCMK_ALLOW_DEPRECATED
33 /*!
34 * \brief Allow use of deprecated Pacemaker APIs
35 *
36 * By default, external code using Pacemaker headers is allowed to use
37 * deprecated Pacemaker APIs. If PCMK_ALLOW_DEPRECATED is defined to 0 before
38 * including any Pacemaker headers, deprecated APIs will be unusable. It is
39 * strongly recommended to leave this unchanged for production and release
40 * builds, to avoid breakage when users upgrade to new Pacemaker releases that
41 * deprecate more APIs. This should be defined to 0 only for development and
42 * testing builds when desiring to check for usage of currently deprecated APIs.
43 */
44 #define PCMK_ALLOW_DEPRECATED 1
45 #endif
46
47 /*!
48 * The CRM feature set assists with compatibility in mixed-version clusters.
49 * The major version number increases when nodes with different versions
50 * would not work (rolling upgrades are not allowed). The minor version
51 * number increases when mixed-version clusters are allowed only during
52 * rolling upgrades (a node with the oldest feature set will be elected DC). The
53 * minor-minor version number is ignored, but allows resource agents to detect
54 * cluster support for various features.
55 *
56 * The feature set also affects the processing of old saved CIBs (such as for
57 * many scheduler regression tests).
58 *
59 * Particular feature points currently tested by Pacemaker code:
60 *
61 * >2.1: Operation updates include timing data
62 * >=3.0.5: XML v2 digests are created
63 * >=3.0.8: Peers do not need acks for cancellations
64 * >=3.0.9: DC will send its own shutdown request to all peers
65 * XML v2 patchsets are created by default
66 * >=3.0.13: Fail counts include operation name and interval
67 * >=3.2.0: DC supports PCMK_EXEC_INVALID and PCMK_EXEC_NOT_CONNECTED
68 * >=3.19.0: DC supports PCMK__CIB_REQUEST_COMMIT_TRANSACT
69 */
70 # define CRM_FEATURE_SET "3.19.0"
71
72 /* Pacemaker's CPG protocols use fixed-width binary fields for the sender and
73 * recipient of a CPG message. This imposes an arbitrary limit on cluster node
74 * names.
75 */
76 //! \brief Maximum length of a Corosync cluster node name (in bytes)
77 #define MAX_NAME 256
78
79 # define CRM_META "CRM_meta"
80
81 extern char *crm_system_name;
82
83 // How we represent "infinite" scores
84 # define CRM_SCORE_INFINITY 1000000
85 # define CRM_INFINITY_S "INFINITY"
86 # define CRM_PLUS_INFINITY_S "+" CRM_INFINITY_S
87 # define CRM_MINUS_INFINITY_S "-" CRM_INFINITY_S
88
89 /* @COMPAT API < 2.0.0 Deprecated "infinity" aliases
90 *
91 * INFINITY might be defined elsewhere (e.g. math.h), so undefine it first.
92 * This, of course, complicates any attempt to use the other definition in any
93 * code that includes this header.
94 */
95 # undef INFINITY
96 # define INFINITY_S "INFINITY"
97 # define MINUS_INFINITY_S "-INFINITY"
98 # define INFINITY 1000000
99
100 /* Sub-systems */
101 # define CRM_SYSTEM_DC "dc"
102 #define CRM_SYSTEM_DCIB "dcib" // Primary instance of CIB manager
103 # define CRM_SYSTEM_CIB "cib"
104 # define CRM_SYSTEM_CRMD "crmd"
105 # define CRM_SYSTEM_LRMD "lrmd"
106 # define CRM_SYSTEM_PENGINE "pengine"
107 # define CRM_SYSTEM_TENGINE "tengine"
108 # define CRM_SYSTEM_STONITHD "stonithd"
109 # define CRM_SYSTEM_MCP "pacemakerd"
110
111 // Names of internally generated node attributes
112 // @TODO Replace these with PCMK_NODE_ATTR_*
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 PCMK_ACTION_DO_SHUTDOWN
144 # define CRM_OP_REGISTER "register"
145 # define CRM_OP_IPC_FWD "ipc_fwd"
146 # define CRM_OP_INVOKE_LRM "lrm_invoke"
147 # define CRM_OP_LRM_REFRESH "lrm_refresh" //!< Deprecated since 1.1.10
148 # define CRM_OP_LRM_DELETE PCMK_ACTION_LRM_DELETE
149 # define CRM_OP_LRM_FAIL "lrm_fail"
150 # define CRM_OP_PROBED "probe_complete"
151 # define CRM_OP_REPROBE "probe_again"
152 # define CRM_OP_CLEAR_FAILCOUNT PCMK_ACTION_CLEAR_FAILCOUNT
153 # define CRM_OP_REMOTE_STATE "remote_state"
154 # define CRM_OP_RM_NODE_CACHE "rm_node_cache"
155 # define CRM_OP_MAINTENANCE_NODES PCMK_ACTION_MAINTENANCE_NODES
156
157 /* Possible cluster membership states */
158 # define CRMD_JOINSTATE_DOWN "down"
159 # define CRMD_JOINSTATE_PENDING "pending"
160 # define CRMD_JOINSTATE_MEMBER "member"
161 # define CRMD_JOINSTATE_NACK "banned"
162
163 # include <crm/common/actions.h>
164 # include <crm/common/cib.h>
165 # include <crm/common/logging.h>
166 # include <crm/common/util.h>
167
168 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
169 #include <crm/crm_compat.h>
170 #endif
171
172 #ifdef __cplusplus
173 }
174 #endif
175
176 #endif