pacemaker  2.1.6-802a72226b
Scalable High-Availability cluster resource manager
options_internal.h
Go to the documentation of this file.
1 /*
2  * Copyright 2006-2022 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 _Noreturn void pcmk__cli_help(char cmd);
22 
23 
24 /*
25  * Environment variable option handling
26  */
27 
28 const char *pcmk__env_option(const char *option);
29 void pcmk__set_env_option(const char *option, const char *value);
30 bool pcmk__env_option_enabled(const char *daemon, const char *option);
31 
32 
33 /*
34  * Cluster option handling
35  */
36 
37 typedef struct pcmk__cluster_option_s {
38  const char *name;
39  const char *alt_name;
40  const char *type;
41  const char *values;
42  const char *default_value;
43 
44  bool (*is_valid)(const char *);
45 
46  const char *description_short;
47  const char *description_long;
48 
50 
51 const char *pcmk__cluster_option(GHashTable *options,
52  const pcmk__cluster_option_t *option_list,
53  int len, const char *name);
54 
55 gchar *pcmk__format_option_metadata(const char *name, const char *desc_short,
56  const char *desc_long,
57  pcmk__cluster_option_t *option_list,
58  int len);
59 
60 void pcmk__validate_cluster_options(GHashTable *options,
61  pcmk__cluster_option_t *option_list,
62  int len);
63 
64 bool pcmk__valid_interval_spec(const char *value);
65 bool pcmk__valid_boolean(const char *value);
66 bool pcmk__valid_number(const char *value);
67 bool pcmk__valid_positive_number(const char *value);
68 bool pcmk__valid_quorum(const char *value);
69 bool pcmk__valid_script(const char *value);
70 bool pcmk__valid_percentage(const char *value);
71 
72 // from watchdog.c
73 long pcmk__get_sbd_timeout(void);
76 bool pcmk__valid_sbd_timeout(const char *value);
77 
78 // Constants for environment variable names
79 #define PCMK__ENV_BLACKBOX "blackbox"
80 #define PCMK__ENV_CLUSTER_TYPE "cluster_type"
81 #define PCMK__ENV_DEBUG "debug"
82 #define PCMK__ENV_LOGFACILITY "logfacility"
83 #define PCMK__ENV_LOGFILE "logfile"
84 #define PCMK__ENV_LOGPRIORITY "logpriority"
85 #define PCMK__ENV_MCP "mcp"
86 #define PCMK__ENV_NODE_START_STATE "node_start_state"
87 #define PCMK__ENV_PHYSICAL_HOST "physical_host"
88 #define PCMK__ENV_QUORUM_TYPE "quorum_type"
89 #define PCMK__ENV_SHUTDOWN_DELAY "shutdown_delay"
90 #define PCMK__ENV_STDERR "stderr"
91 
92 // Constants for cluster option names
93 #define PCMK__OPT_NODE_HEALTH_BASE "node-health-base"
94 #define PCMK__OPT_NODE_HEALTH_GREEN "node-health-green"
95 #define PCMK__OPT_NODE_HEALTH_RED "node-health-red"
96 #define PCMK__OPT_NODE_HEALTH_STRATEGY "node-health-strategy"
97 #define PCMK__OPT_NODE_HEALTH_YELLOW "node-health-yellow"
98 
99 // Constants for meta-attribute names
100 #define PCMK__META_ALLOW_UNHEALTHY_NODES "allow-unhealthy-nodes"
101 
102 // Constants for enumerated values for various options
103 #define PCMK__VALUE_CLUSTER "cluster"
104 #define PCMK__VALUE_CUSTOM "custom"
105 #define PCMK__VALUE_FENCING "fencing"
106 #define PCMK__VALUE_GREEN "green"
107 #define PCMK__VALUE_LOCAL "local"
108 #define PCMK__VALUE_MIGRATE_ON_RED "migrate-on-red"
109 #define PCMK__VALUE_NONE "none"
110 #define PCMK__VALUE_NOTHING "nothing"
111 #define PCMK__VALUE_ONLY_GREEN "only-green"
112 #define PCMK__VALUE_PROGRESSIVE "progressive"
113 #define PCMK__VALUE_QUORUM "quorum"
114 #define PCMK__VALUE_RED "red"
115 #define PCMK__VALUE_UNFENCING "unfencing"
116 #define PCMK__VALUE_YELLOW "yellow"
117 
118 #endif // PCMK__OPTIONS_INTERNAL__H
bool pcmk__valid_script(const char *value)
Definition: options.c:211
const char * name
Definition: cib.c:24
bool pcmk__valid_sbd_timeout(const char *value)
Definition: watchdog.c:278
bool(* is_valid)(const char *)
void pcmk__set_env_option(const char *option, const char *value)
Set or unset a Pacemaker environment variable option.
Definition: options.c:101
#define _Noreturn
Definition: config.h:652
const char * pcmk__env_option(const char *option)
Definition: options.c:58
struct pcmk__cluster_option_s pcmk__cluster_option_t
bool pcmk__valid_positive_number(const char *value)
Definition: options.c:196
bool pcmk__valid_quorum(const char *value)
Definition: options.c:205
bool pcmk__valid_interval_spec(const char *value)
Definition: options.c:167
int daemon(int nochdir, int noclose)
long pcmk__auto_watchdog_timeout(void)
Definition: watchdog.c:270
gchar * pcmk__format_option_metadata(const char *name, const char *desc_short, const char *desc_long, pcmk__cluster_option_t *option_list, int len)
Definition: options.c:413
const char * pcmk__cluster_option(GHashTable *options, const pcmk__cluster_option_t *option_list, int len, const char *name)
Definition: options.c:337
_Noreturn void pcmk__cli_help(char cmd)
Definition: options.c:25
bool pcmk__valid_boolean(const char *value)
Definition: options.c:174
bool pcmk__get_sbd_sync_resource_startup(void)
Definition: watchdog.c:247
bool pcmk__valid_number(const char *value)
Definition: options.c:182
const char * description_short
void pcmk__validate_cluster_options(GHashTable *options, pcmk__cluster_option_t *option_list, int len)
Definition: options.c:488
bool pcmk__valid_percentage(const char *value)
Definition: options.c:238
long pcmk__get_sbd_timeout(void)
Definition: watchdog.c:236
bool pcmk__env_option_enabled(const char *daemon, const char *option)
Definition: options.c:152
const char * description_long