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 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 #include <crm/common/options.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 /**
29 * \file
30 * \brief A dumping ground
31 * \ingroup core
32 */
33
34 #ifndef PCMK_ALLOW_DEPRECATED
35 /*!
36 * \brief Allow use of deprecated Pacemaker APIs
37 *
38 * By default, external code using Pacemaker headers is allowed to use
39 * deprecated Pacemaker APIs. If PCMK_ALLOW_DEPRECATED is defined to 0 before
40 * including any Pacemaker headers, deprecated APIs will be unusable. It is
41 * strongly recommended to leave this unchanged for production and release
42 * builds, to avoid breakage when users upgrade to new Pacemaker releases that
43 * deprecate more APIs. This should be defined to 0 only for development and
44 * testing builds when desiring to check for usage of currently deprecated APIs.
45 */
46 #define PCMK_ALLOW_DEPRECATED 1
47 #endif
48
49 /*!
50 * The CRM feature set assists with compatibility in mixed-version clusters.
51 * The major version number increases when nodes with different versions
52 * would not work (rolling upgrades are not allowed). The minor version
53 * number increases when mixed-version clusters are allowed only during
54 * rolling upgrades (a node with the oldest feature set will be elected DC). The
55 * minor-minor version number is ignored, but allows resource agents to detect
56 * cluster support for various features.
57 *
58 * The feature set also affects the processing of old saved CIBs (such as for
59 * many scheduler regression tests).
60 *
61 * Particular feature points currently tested by Pacemaker code:
62 *
63 * >2.1: Operation updates include timing data
64 * >=3.0.5: XML v2 digests are created
65 * >=3.0.8: Peers do not need acks for cancellations
66 * >=3.0.9: DC will send its own shutdown request to all peers
67 * XML v2 patchsets are created by default
68 * >=3.0.13: Fail counts include operation name and interval
69 * >=3.2.0: DC supports PCMK_EXEC_INVALID and PCMK_EXEC_NOT_CONNECTED
70 * >=3.19.0: DC supports PCMK__CIB_REQUEST_COMMIT_TRANSACT
71 */
72 # define CRM_FEATURE_SET "3.19.6"
73
74 /* Pacemaker's CPG protocols use fixed-width binary fields for the sender and
75 * recipient of a CPG message. This imposes an arbitrary limit on cluster node
76 * names.
77 */
78 //! \brief Maximum length of a Corosync cluster node name (in bytes)
79 #define MAX_NAME 256
80
81 # define CRM_META "CRM_meta"
82
83 // NOTE: sbd (as of at least 1.5.2) uses this
84 extern char *crm_system_name;
85
86 /* Sub-systems */
87 # define CRM_SYSTEM_DC "dc"
88 #define CRM_SYSTEM_DCIB "dcib" // Primary instance of CIB manager
89 # define CRM_SYSTEM_CIB "cib"
90 # define CRM_SYSTEM_CRMD "crmd"
91 # define CRM_SYSTEM_LRMD "lrmd"
92 # define CRM_SYSTEM_PENGINE "pengine"
93 # define CRM_SYSTEM_TENGINE "tengine"
94 # define CRM_SYSTEM_STONITHD "stonithd"
95 # define CRM_SYSTEM_MCP "pacemakerd"
96
97 // Names of internally generated node attributes
98 // @TODO Replace these with PCMK_NODE_ATTR_*
99 # define CRM_ATTR_UNAME "#uname"
100 # define CRM_ATTR_ID "#id"
101 # define CRM_ATTR_KIND "#kind"
102 # define CRM_ATTR_ROLE "#role"
103 # define CRM_ATTR_IS_DC "#is_dc"
104 # define CRM_ATTR_CLUSTER_NAME "#cluster-name"
105 # define CRM_ATTR_SITE_NAME "#site-name"
106 # define CRM_ATTR_UNFENCED "#node-unfenced"
107 # define CRM_ATTR_DIGESTS_ALL "#digests-all"
108 # define CRM_ATTR_DIGESTS_SECURE "#digests-secure"
109 # define CRM_ATTR_PROTOCOL "#attrd-protocol"
110 # define CRM_ATTR_FEATURE_SET "#feature-set"
111
112 /* Valid operations */
113 # define CRM_OP_NOOP "noop"
114 # define CRM_OP_JOIN_ANNOUNCE "join_announce"
115 # define CRM_OP_JOIN_OFFER "join_offer"
116 # define CRM_OP_JOIN_REQUEST "join_request"
117 # define CRM_OP_JOIN_ACKNAK "join_ack_nack"
118 # define CRM_OP_JOIN_CONFIRM "join_confirm"
119 # define CRM_OP_PING "ping"
120 # define CRM_OP_NODE_INFO "node-info"
121 # define CRM_OP_THROTTLE "throttle"
122 # define CRM_OP_VOTE "vote"
123 # define CRM_OP_NOVOTE "no-vote"
124 # define CRM_OP_HELLO "hello"
125 # define CRM_OP_PECALC "pe_calc"
126 # define CRM_OP_QUIT "quit"
127 # define CRM_OP_SHUTDOWN_REQ "req_shutdown"
128 # define CRM_OP_SHUTDOWN PCMK_ACTION_DO_SHUTDOWN
129 # define CRM_OP_REGISTER "register"
130 # define CRM_OP_IPC_FWD "ipc_fwd"
131 # define CRM_OP_INVOKE_LRM "lrm_invoke"
132 # define CRM_OP_LRM_REFRESH "lrm_refresh" //!< Deprecated since 1.1.10
133 # define CRM_OP_LRM_DELETE PCMK_ACTION_LRM_DELETE
134 # define CRM_OP_LRM_FAIL "lrm_fail"
135 # define CRM_OP_PROBED "probe_complete"
136 # define CRM_OP_REPROBE "probe_again"
137 # define CRM_OP_CLEAR_FAILCOUNT PCMK_ACTION_CLEAR_FAILCOUNT
138 # define CRM_OP_REMOTE_STATE "remote_state"
139 # define CRM_OP_RM_NODE_CACHE "rm_node_cache"
140 # define CRM_OP_MAINTENANCE_NODES PCMK_ACTION_MAINTENANCE_NODES
141
142 /* Possible cluster membership states */
143 # define CRMD_JOINSTATE_DOWN "down"
144 # define CRMD_JOINSTATE_PENDING "pending"
145 # define CRMD_JOINSTATE_MEMBER "member"
146 # define CRMD_JOINSTATE_NACK "banned"
147
148 # include <crm/common/actions.h>
149 # include <crm/common/cib.h>
150 # include <crm/common/logging.h>
151 # include <crm/common/util.h>
152
153 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
154 #include <crm/crm_compat.h>
155 #endif
156
157 #ifdef __cplusplus
158 }
159 #endif
160
161 #endif