MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / cluster_option

Function cluster_option

lib/common/utils.c:195–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193}
194
195const char *
196cluster_option(GHashTable * options, gboolean(*validate) (const char *),
197 const char *name, const char *old_name, const char *def_value)
198{
199 const char *value = NULL;
200
201 CRM_ASSERT(name != NULL);
202
203 if (options != NULL) {
204 value = g_hash_table_lookup(options, name);
205 }
206
207 if (value == NULL && old_name && options != NULL) {
208 value = g_hash_table_lookup(options, old_name);
209 if (value != NULL) {
210 crm_config_warn("Using deprecated name '%s' for"
211 " cluster option '%s'", old_name, name);
212 g_hash_table_insert(options, strdup(name), strdup(value));
213 value = g_hash_table_lookup(options, old_name);
214 }
215 }
216
217 if (value == NULL) {
218 crm_trace("Using default value '%s' for cluster option '%s'", def_value, name);
219
220 if (options == NULL) {
221 return def_value;
222 }
223
224 g_hash_table_insert(options, strdup(name), strdup(def_value));
225 value = g_hash_table_lookup(options, name);
226 }
227
228 if (validate && validate(value) == FALSE) {
229 crm_config_err("Value '%s' for cluster option '%s' is invalid."
230 " Defaulting to %s", value, name, def_value);
231 g_hash_table_replace(options, strdup(name), strdup(def_value));
232 value = g_hash_table_lookup(options, name);
233 }
234
235 return value;
236}
237
238const char *
239get_cluster_pref(GHashTable * options, pe_cluster_option * option_list, int len, const char *name)

Callers 2

get_cluster_prefFunction · 0.85
verify_all_optionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected