#include "lib/util/debug.h"
+#include "common/path.h"
+
#include "conf/conf.h"
#include "conf/cluster_conf.h"
CLUSTER_CONF_RECOVERY_LOCK,
NULL,
validate_recovery_lock);
+ conf_define_string(conf,
+ CLUSTER_CONF_SECTION,
+ CLUSTER_CONF_NODES_LIST,
+ NULL,
+ check_static_string_change);
conf_define_integer(conf,
CLUSTER_CONF_SECTION,
CLUSTER_CONF_LEADER_TIMEOUT,
true,
NULL);
}
+
+char *cluster_conf_nodes_list(TALLOC_CTX *mem_ctx, struct conf_context *conf)
+{
+ const char *out = NULL;
+ int ret = conf_get_string(conf,
+ CLUSTER_CONF_SECTION,
+ CLUSTER_CONF_NODES_LIST,
+ &out,
+ NULL);
+ if (ret == 0 && out != NULL) {
+ return talloc_strdup(mem_ctx, out);
+ }
+ return path_etcdir_append(mem_ctx, "nodes");
+}
#ifndef __CTDB_CLUSTER_CONF_H__
#define __CTDB_CLUSTER_CONF_H__
+#include <talloc.h>
+
#include "conf/conf.h"
#define CLUSTER_CONF_SECTION "cluster"
#define CLUSTER_CONF_NODE_ADDRESS "node address"
#define CLUSTER_CONF_CLUSTER_LOCK "cluster lock"
#define CLUSTER_CONF_RECOVERY_LOCK "recovery lock"
+#define CLUSTER_CONF_NODES_LIST "nodes list"
#define CLUSTER_CONF_LEADER_TIMEOUT "leader timeout"
#define CLUSTER_CONF_LEADER_CAPABILITY "leader capability"
void cluster_conf_init(struct conf_context *conf);
+/**
+ * @brief Return the value of the nodes list configuration parameter.
+ *
+ * This function is used to fetch the value set in the ctdb.conf (or equivalent)
+ * for 'nodes list' a value that is then used to fetch the actual nodes list
+ * of private node addresses. If a value is not present in the configuration
+ * file a backwards compatible default value will be returned.
+ *
+ * @param[in] mem_ctx TALLOC memory context
+ * @param[in] conf A configuration context
+ * @return string or NULL on memory allocation error
+ */
+char *cluster_conf_nodes_list(TALLOC_CTX *mem_ctx, struct conf_context *conf);
+
#endif /* __CTDB_CLUSTER_CONF_H__ */
CLUSTER_CONF_SECTION,
CLUSTER_CONF_RECOVERY_LOCK,
&ctdb_config.recovery_lock);
+ conf_assign_string_pointer(conf,
+ CLUSTER_CONF_SECTION,
+ CLUSTER_CONF_NODES_LIST,
+ &ctdb_config.nodes_list);
conf_assign_integer_pointer(conf,
CLUSTER_CONF_SECTION,
CLUSTER_CONF_LEADER_TIMEOUT,
const char *node_address;
const char *cluster_lock;
const char *recovery_lock;
+ const char *nodes_list;
int leader_timeout;
bool leader_capability;
# node address =
# cluster lock =
# recovery lock =
+ # nodes list =
# leader timeout = 5
# leader capability = true
[database]