pacemaker  2.1.9-49aab99839
Scalable High-Availability cluster resource manager
options_internal.h
Go to the documentation of this file.
1 /*
2  * Copyright 2006-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__OPTIONS_INTERNAL__H
11 #define PCMK__OPTIONS_INTERNAL__H
12 
13 #ifndef PCMK__CONFIG_H
14 #define PCMK__CONFIG_H
15 #include <config.h> // _Noreturn
16 #endif
17 
18 #include <glib.h> // GHashTable
19 #include <stdbool.h> // bool
20 
21 #include <crm/common/util.h> // pcmk_parse_interval_spec()
22 
23 _Noreturn void pcmk__cli_help(char cmd);
24 
25 
26 /*
27  * Environment variable option handling
28  */
29 
30 const char *pcmk__env_option(const char *option);
31 void pcmk__set_env_option(const char *option, const char *value, bool compat);
32 bool pcmk__env_option_enabled(const char *daemon, const char *option);
33 
34 
35 /*
36  * Cluster option handling
37  */
38 
46 
52  pcmk__opt_based = (1U << 0),
53 
59  pcmk__opt_controld = (1U << 1),
60 
66  pcmk__opt_schedulerd = (1U << 2),
67 
68  pcmk__opt_advanced = (1U << 3),
69  pcmk__opt_generated = (1U << 4),
70  pcmk__opt_deprecated = (1U << 5),
71  pcmk__opt_fencing = (1U << 6),
72  pcmk__opt_primitive = (1U << 7),
73 };
74 
75 typedef struct pcmk__cluster_option_s {
76  const char *name;
77  const char *alt_name;
78  const char *type;
79  const char *values;
80  const char *default_value;
81 
82  bool (*is_valid)(const char *);
83 
84  uint32_t flags;
85 
86  const char *description_short;
87  const char *description_long;
88 
90 
91 const char *pcmk__cluster_option(GHashTable *options, const char *name);
92 
94  const char *desc_short, const char *desc_long,
95  uint32_t filter, bool all);
96 int pcmk__output_fencing_params(pcmk__output_t *out, const char *name,
97  const char *desc_short, const char *desc_long,
98  bool all);
99 int pcmk__output_primitive_meta(pcmk__output_t *out, const char *name,
100  const char *desc_short, const char *desc_long,
101  bool all);
102 
103 int pcmk__daemon_metadata(pcmk__output_t *out, const char *name,
104  const char *short_desc, const char *long_desc,
105  enum pcmk__opt_flags filter);
106 
107 void pcmk__validate_cluster_options(GHashTable *options);
108 
109 bool pcmk__valid_interval_spec(const char *value);
110 bool pcmk__valid_boolean(const char *value);
111 bool pcmk__valid_int(const char *value);
112 bool pcmk__valid_positive_int(const char *value);
113 bool pcmk__valid_no_quorum_policy(const char *value);
114 bool pcmk__valid_percentage(const char *value);
115 bool pcmk__valid_placement_strategy(const char *value);
116 
117 // from watchdog.c
121 bool pcmk__valid_stonith_watchdog_timeout(const char *value);
122 
123 // Constants for environment variable names
124 #define PCMK__ENV_AUTHKEY_LOCATION "authkey_location"
125 #define PCMK__ENV_BLACKBOX "blackbox"
126 #define PCMK__ENV_CALLGRIND_ENABLED "callgrind_enabled"
127 #define PCMK__ENV_CLUSTER_TYPE "cluster_type"
128 #define PCMK__ENV_DEBUG "debug"
129 #define PCMK__ENV_DH_MAX_BITS "dh_max_bits"
130 #define PCMK__ENV_DH_MIN_BITS "dh_min_bits"
131 #define PCMK__ENV_FAIL_FAST "fail_fast"
132 #define PCMK__ENV_IPC_BUFFER "ipc_buffer"
133 #define PCMK__ENV_IPC_TYPE "ipc_type"
134 #define PCMK__ENV_LOGFACILITY "logfacility"
135 #define PCMK__ENV_LOGFILE "logfile"
136 #define PCMK__ENV_LOGFILE_MODE "logfile_mode"
137 #define PCMK__ENV_LOGPRIORITY "logpriority"
138 #define PCMK__ENV_NODE_ACTION_LIMIT "node_action_limit"
139 #define PCMK__ENV_NODE_START_STATE "node_start_state"
140 #define PCMK__ENV_PANIC_ACTION "panic_action"
141 #define PCMK__ENV_REMOTE_ADDRESS "remote_address"
142 #define PCMK__ENV_REMOTE_SCHEMA_DIRECTORY "remote_schema_directory"
143 #define PCMK__ENV_REMOTE_PID1 "remote_pid1"
144 #define PCMK__ENV_REMOTE_PORT "remote_port"
145 #define PCMK__ENV_RESPAWNED "respawned"
146 #define PCMK__ENV_SCHEMA_DIRECTORY "schema_directory"
147 #define PCMK__ENV_SERVICE "service"
148 #define PCMK__ENV_STDERR "stderr"
149 #define PCMK__ENV_TLS_PRIORITIES "tls_priorities"
150 #define PCMK__ENV_TRACE_BLACKBOX "trace_blackbox"
151 #define PCMK__ENV_TRACE_FILES "trace_files"
152 #define PCMK__ENV_TRACE_FORMATS "trace_formats"
153 #define PCMK__ENV_TRACE_FUNCTIONS "trace_functions"
154 #define PCMK__ENV_TRACE_TAGS "trace_tags"
155 #define PCMK__ENV_VALGRIND_ENABLED "valgrind_enabled"
156 
157 // @COMPAT Drop at 3.0.0; default is plenty
158 #define PCMK__ENV_CIB_TIMEOUT "cib_timeout"
159 
160 // @COMPAT Drop at 3.0.0; likely last used in 1.1.24
161 #define PCMK__ENV_MCP "mcp"
162 
163 // @COMPAT Drop at 3.0.0; added unused in 1.1.9
164 #define PCMK__ENV_QUORUM_TYPE "quorum_type"
165 
166 /* @COMPAT Drop at 3.0.0; added to debug shutdown issues when Pacemaker is
167  * managed by systemd, but no longer useful.
168  */
169 #define PCMK__ENV_SHUTDOWN_DELAY "shutdown_delay"
170 
171 // @COMPAT Deprecated since 2.1.0
172 #define PCMK__OPT_REMOVE_AFTER_STOP "remove-after-stop"
173 
174 // Constants for meta-attribute names
175 #define PCMK__META_CLONE "clone"
176 #define PCMK__META_CONTAINER "container"
177 #define PCMK__META_DIGESTS_ALL "digests-all"
178 #define PCMK__META_DIGESTS_SECURE "digests-secure"
179 #define PCMK__META_INTERNAL_RSC "internal_rsc"
180 #define PCMK__META_MIGRATE_SOURCE "migrate_source"
181 #define PCMK__META_MIGRATE_TARGET "migrate_target"
182 #define PCMK__META_ON_NODE "on_node"
183 #define PCMK__META_ON_NODE_UUID "on_node_uuid"
184 #define PCMK__META_OP_NO_WAIT "op_no_wait"
185 #define PCMK__META_OP_TARGET_RC "op_target_rc"
186 #define PCMK__META_PHYSICAL_HOST "physical-host"
187 #define PCMK__META_STONITH_ACTION "stonith_action"
188 
189 /* @TODO Plug these in. Currently, they're never set. These are op attrs for use
190  * with https://projects.clusterlabs.org/T382.
191  */
192 #define PCMK__META_CLEAR_FAILURE_OP "clear_failure_op"
193 #define PCMK__META_CLEAR_FAILURE_INTERVAL "clear_failure_interval"
194 
195 // @COMPAT Deprecated meta-attribute since 2.1.0
196 #define PCMK__META_CAN_FAIL "can_fail"
197 
198 // @COMPAT Deprecated alias for PCMK__META_PROMOTED_MAX since 2.0.0
199 #define PCMK__META_PROMOTED_MAX_LEGACY "master-max"
200 
201 // @COMPAT Deprecated alias for PCMK__META_PROMOTED_NODE_MAX since 2.0.0
202 #define PCMK__META_PROMOTED_NODE_MAX_LEGACY "master-node-max"
203 
204 // @COMPAT Deprecated meta-attribute since 2.0.0
205 #define PCMK__META_RESTART_TYPE "restart-type"
206 
207 // @COMPAT Deprecated meta-attribute since 2.0.0
208 #define PCMK__META_ROLE_AFTER_FAILURE "role_after_failure"
209 
210 // Constants for enumerated values
211 #define PCMK__VALUE_ATTRD "attrd"
212 #define PCMK__VALUE_BOLD "bold"
213 #define PCMK__VALUE_BROADCAST "broadcast"
214 #define PCMK__VALUE_CIB "cib"
215 #define PCMK__VALUE_CIB_DIFF_NOTIFY "cib_diff_notify"
216 #define PCMK__VALUE_CIB_NOTIFY "cib_notify"
217 #define PCMK__VALUE_CIB_POST_NOTIFY "cib_post_notify"
218 #define PCMK__VALUE_CIB_PRE_NOTIFY "cib_pre_notify"
219 #define PCMK__VALUE_CIB_UPDATE_CONFIRMATION "cib_update_confirmation"
220 #define PCMK__VALUE_CLUSTER "cluster"
221 #define PCMK__VALUE_CRMD "crmd"
222 #define PCMK__VALUE_EN "en"
223 #define PCMK__VALUE_EPOCH "epoch"
224 #define PCMK__VALUE_HEALTH_RED "health_red"
225 #define PCMK__VALUE_HEALTH_YELLOW "health_yellow"
226 #define PCMK__VALUE_INIT "init"
227 #define PCMK__VALUE_LOCAL "local"
228 #define PCMK__VALUE_LRMD "lrmd"
229 #define PCMK__VALUE_MAINT "maint"
230 #define PCMK__VALUE_OUTPUT "output"
231 #define PCMK__VALUE_PASSWORD "password"
232 #define PCMK__VALUE_PING "ping"
233 #define PCMK__VALUE_PRIMITIVE "primitive"
234 #define PCMK__VALUE_REFRESH "refresh"
235 #define PCMK__VALUE_REQUEST "request"
236 #define PCMK__VALUE_RESPONSE "response"
237 #define PCMK__VALUE_RSC_FAILED "rsc-failed"
238 #define PCMK__VALUE_RSC_FAILURE_IGNORED "rsc-failure-ignored"
239 #define PCMK__VALUE_RSC_MANAGED "rsc-managed"
240 #define PCMK__VALUE_RSC_MULTIPLE "rsc-multiple"
241 #define PCMK__VALUE_RSC_OK "rsc-ok"
242 #define PCMK__VALUE_RUNNING "running"
243 #define PCMK__VALUE_SHUTDOWN_COMPLETE "shutdown_complete"
244 #define PCMK__VALUE_SHUTTING_DOWN "shutting_down"
245 #define PCMK__VALUE_ST_ASYNC_TIMEOUT_VALUE "st-async-timeout-value"
246 #define PCMK__VALUE_ST_NOTIFY "st_notify"
247 #define PCMK__VALUE_ST_NOTIFY_DISCONNECT "st_notify_disconnect"
248 #define PCMK__VALUE_ST_NOTIFY_FENCE "st_notify_fence"
249 #define PCMK__VALUE_ST_NOTIFY_HISTORY "st_notify_history"
250 #define PCMK__VALUE_ST_NOTIFY_HISTORY_SYNCED "st_notify_history_synced"
251 #define PCMK__VALUE_STARTING_DAEMONS "starting_daemons"
252 #define PCMK__VALUE_STONITH_NG "stonith-ng"
253 #define PCMK__VALUE_WAIT_FOR_PING "wait_for_ping"
254 #define PCMK__VALUE_WARNING "warning"
255 
256 /* @COMPAT Deprecated since 2.1.7 (used with PCMK__XA_ORDERING attribute of
257  * resource sets)
258  */
259 #define PCMK__VALUE_GROUP "group"
260 
261 // @COMPAT Drop when daemon metadata commands are dropped
262 #define PCMK__VALUE_TIME "time"
263 
264 #endif // PCMK__OPTIONS_INTERNAL__H
Common fencing resource parameter.
bool pcmk__valid_placement_strategy(const char *value)
Definition: options.c:1335
int pcmk__daemon_metadata(pcmk__output_t *out, const char *name, const char *short_desc, const char *long_desc, enum pcmk__opt_flags filter)
Definition: options.c:1524
const char * name
Definition: cib.c:26
long pcmk__auto_stonith_watchdog_timeout(void)
Definition: watchdog.c:277
In CIB manager metadata.
Option is deprecated.
bool(* is_valid)(const char *)
bool pcmk__valid_int(const char *value)
Definition: options.c:1255
bool pcmk__valid_no_quorum_policy(const char *value)
Definition: options.c:1295
void pcmk__validate_cluster_options(GHashTable *options)
Definition: options.c:1565
const char * pcmk__cluster_option(GHashTable *options, const char *name)
Definition: options.c:1419
#define _Noreturn
Definition: config.h:667
const char * pcmk__env_option(const char *option)
Definition: options.c:1094
struct pcmk__cluster_option_s pcmk__cluster_option_t
bool pcmk__valid_positive_int(const char *value)
Definition: options.c:1275
pcmk__opt_flags
void pcmk__set_env_option(const char *option, const char *value, bool compat)
Set or unset a Pacemaker environment variable option.
Definition: options.c:1144
Advanced use only.
Primitive resource meta-attribute.
bool pcmk__valid_interval_spec(const char *value)
Definition: options.c:1225
Utility functions.
int pcmk__output_primitive_meta(pcmk__output_t *out, const char *name, const char *desc_short, const char *desc_long, bool all)
Definition: options.c:1475
In scheduler metadata.
_Noreturn void pcmk__cli_help(char cmd)
Definition: options.c:26
bool pcmk__valid_stonith_watchdog_timeout(const char *value)
Definition: watchdog.c:285
No additional information.
long pcmk__get_sbd_watchdog_timeout(void)
Definition: watchdog.c:243
int pcmk__output_cluster_options(pcmk__output_t *out, const char *name, const char *desc_short, const char *desc_long, uint32_t filter, bool all)
Definition: options.c:1452
bool pcmk__valid_boolean(const char *value)
Definition: options.c:1239
bool pcmk__get_sbd_sync_resource_startup(void)
Definition: watchdog.c:254
int pcmk__output_fencing_params(pcmk__output_t *out, const char *name, const char *desc_short, const char *desc_long, bool all)
Definition: options.c:1502
This structure contains everything that makes up a single output formatter.
const char * description_short
uint32_t flags
Group of enum pcmk__opt_flags
bool pcmk__valid_percentage(const char *value)
Definition: options.c:1317
In controller metadata.
Generated by Pacemaker.
bool pcmk__env_option_enabled(const char *daemon, const char *option)
Definition: options.c:1201
const char * description_long