From 929634126a334e380f16c080b59d062873b4e5f9 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Tue, 21 Aug 2018 13:41:22 +1000 Subject: [PATCH] ctdb-config: Switch tunable DisableIPFailover to a config option Use the "failover:disabled" option instead. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589 Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- ctdb/common/tunable.c | 2 +- ctdb/doc/ctdb-tunables.7.xml | 17 ---------------- ctdb/doc/ctdb.1.xml | 1 - ctdb/doc/ctdb.conf.5.xml | 29 ++++++++++++++++++++++++++++ ctdb/server/ctdb_config.c | 10 ++++++++++ ctdb/server/ctdb_config.h | 3 +++ ctdb/server/ctdb_recoverd.c | 6 ++++-- ctdb/server/ctdb_takeover.c | 10 ++++++---- ctdb/tests/tool/ctdb.listvars.001.sh | 1 - ctdb/wscript | 1 + 10 files changed, 54 insertions(+), 26 deletions(-) diff --git a/ctdb/common/tunable.c b/ctdb/common/tunable.c index e9367980753..f516d8c5374 100644 --- a/ctdb/common/tunable.c +++ b/ctdb/common/tunable.c @@ -83,7 +83,7 @@ static struct { offsetof(struct ctdb_tunable_list, reclock_ping_period) }, { "NoIPFailback", 0, false, offsetof(struct ctdb_tunable_list, no_ip_failback) }, - { "DisableIPFailover", 0, false, + { "DisableIPFailover", 0, true, offsetof(struct ctdb_tunable_list, disable_ip_failover) }, { "VerboseMemoryNames", 0, false, offsetof(struct ctdb_tunable_list, verbose_memory_names) }, diff --git a/ctdb/doc/ctdb-tunables.7.xml b/ctdb/doc/ctdb-tunables.7.xml index db3dd209760..71cb0e31142 100644 --- a/ctdb/doc/ctdb-tunables.7.xml +++ b/ctdb/doc/ctdb-tunables.7.xml @@ -177,23 +177,6 @@ MonitorInterval=20 - - DisableIPFailover - Default: 0 - - When set to non-zero, ctdb will not perform failover or - failback. Even if a node fails while holding public IPs, ctdb - will not recover the IPs or assign them to another node. - - - When this tunable is enabled, ctdb will no longer attempt - to recover the cluster by failing IP addresses over to other - nodes. This leads to a service outage until the administrator - has manually performed IP failover to replacement nodes using the - 'ctdb moveip' command. - - - ElectionTimeout Default: 3 diff --git a/ctdb/doc/ctdb.1.xml b/ctdb/doc/ctdb.1.xml index da699ff89f0..355547af41e 100644 --- a/ctdb/doc/ctdb.1.xml +++ b/ctdb/doc/ctdb.1.xml @@ -800,7 +800,6 @@ DatabaseMaxDead = 5 RerecoveryTimeout = 10 EnableBans = 1 NoIPFailback = 0 -DisableIPFailover = 0 VerboseMemoryNames = 0 RecdPingTimeout = 60 RecdFailCount = 10 diff --git a/ctdb/doc/ctdb.conf.5.xml b/ctdb/doc/ctdb.conf.5.xml index 316ac7f469d..01c09bf53be 100644 --- a/ctdb/doc/ctdb.conf.5.xml +++ b/ctdb/doc/ctdb.conf.5.xml @@ -391,6 +391,35 @@ + + + FAILOVER CONFIGURATION + + + + Options in this section affect CTDB failover. They are + valid within the failover section of file, + indicated by [failover]. + + + + + + disabled = true|false + + + If set to true then public IP failover + is disabled. + + + Default: false + + + + + + + LEGACY CONFIGURATION diff --git a/ctdb/server/ctdb_config.c b/ctdb/server/ctdb_config.c index f00c3268085..750b909cd3d 100644 --- a/ctdb/server/ctdb_config.c +++ b/ctdb/server/ctdb_config.c @@ -28,6 +28,7 @@ #include "cluster/cluster_conf.h" #include "database/database_conf.h" #include "event/event_conf.h" +#include "failover/failover_conf.h" #include "legacy_conf.h" #include "ctdb_config.h" @@ -86,6 +87,14 @@ static void setup_config_pointers(struct conf_context *conf) EVENT_CONF_DEBUG_SCRIPT, &ctdb_config.event_debug_script); + /* + * Failover + */ + conf_assign_boolean_pointer(conf, + FAILOVER_CONF_SECTION, + FAILOVER_CONF_DISABLED, + &ctdb_config.failover_disabled); + /* * Legacy */ @@ -132,6 +141,7 @@ int ctdbd_config_load(TALLOC_CTX *mem_ctx, cluster_conf_init(conf); database_conf_init(conf); event_conf_init(conf); + failover_conf_init(conf); legacy_conf_init(conf); setup_config_pointers(conf); diff --git a/ctdb/server/ctdb_config.h b/ctdb/server/ctdb_config.h index 65c6547258d..f2f75972661 100644 --- a/ctdb/server/ctdb_config.h +++ b/ctdb/server/ctdb_config.h @@ -38,6 +38,9 @@ struct ctdb_config { /* Event */ const char *event_debug_script; + /* Failover */ + bool failover_disabled; + /* Legacy */ bool realtime_scheduling; bool recmaster_capability; diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c index 6d72316e4de..3e85186f35a 100644 --- a/ctdb/server/ctdb_recoverd.c +++ b/ctdb/server/ctdb_recoverd.c @@ -42,6 +42,8 @@ #include "common/common.h" #include "common/logging.h" +#include "server/ctdb_config.h" + #include "ctdb_cluster_mutex.h" /* List of SRVID requests that need to be processed */ @@ -1149,7 +1151,7 @@ static int ctdb_takeover(struct ctdb_recoverd *rec, } } - if (rec->ctdb->tunable.disable_ip_failover != 0) { + if (ctdb_config.failover_disabled) { ret = setenv("CTDB_DISABLE_IP_FAILOVER", "1", 1); if (ret != 0) { D_ERR("Failed to set CTDB_DISABLE_IP_FAILOVER variable\n"); @@ -2333,7 +2335,7 @@ static int verify_local_ip_allocation(struct ctdb_context *ctdb, } /* Return early if disabled... */ - if (ctdb->tunable.disable_ip_failover != 0 || + if (ctdb_config.failover_disabled || ctdb_op_is_disabled(rec->takeover_run)) { return 0; } diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c index a7638cfd677..76a6352863a 100644 --- a/ctdb/server/ctdb_takeover.c +++ b/ctdb/server/ctdb_takeover.c @@ -45,6 +45,8 @@ #include "common/common.h" #include "common/logging.h" +#include "server/ctdb_config.h" + #include "server/ipalloc.h" #define TAKEOVER_TIMEOUT() timeval_current_ofs(ctdb->tunable.takeover_timeout,0) @@ -752,7 +754,7 @@ int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb, return 0; } - if (ctdb->tunable.disable_ip_failover == 0 && ctdb->do_checkpublicip) { + if (ctdb_config.failover_disabled == 0 && ctdb->do_checkpublicip) { have_ip = ctdb_sys_have_ip(&pip->addr); } best_iface = ctdb_vnn_best_iface(ctdb, vnn); @@ -890,7 +892,7 @@ static void release_ip_callback(struct ctdb_context *ctdb, int status, ctdb_ban_self(ctdb); } - if (ctdb->tunable.disable_ip_failover == 0 && ctdb->do_checkpublicip) { + if (ctdb_config.failover_disabled == 0 && ctdb->do_checkpublicip) { if (ctdb_sys_have_ip(state->addr)) { DEBUG(DEBUG_ERR, ("IP %s still hosted during release IP callback, failing\n", @@ -954,7 +956,7 @@ int32_t ctdb_control_release_ip(struct ctdb_context *ctdb, * local node. Redundant releases need to update the PNN but * are otherwise ignored. */ - if (ctdb->tunable.disable_ip_failover == 0 && ctdb->do_checkpublicip) { + if (ctdb_config.failover_disabled == 0 && ctdb->do_checkpublicip) { if (!ctdb_sys_have_ip(&pip->addr)) { DEBUG(DEBUG_DEBUG,("Redundant release of IP %s/%u on interface %s (ip not held)\n", ctdb_addr_to_str(&pip->addr), @@ -1590,7 +1592,7 @@ void ctdb_release_all_ips(struct ctdb_context *ctdb) struct ctdb_vnn *vnn, *next; int count = 0; - if (ctdb->tunable.disable_ip_failover == 1) { + if (ctdb_config.failover_disabled == 1) { return; } diff --git a/ctdb/tests/tool/ctdb.listvars.001.sh b/ctdb/tests/tool/ctdb.listvars.001.sh index 95b6c3133f9..a304942af43 100755 --- a/ctdb/tests/tool/ctdb.listvars.001.sh +++ b/ctdb/tests/tool/ctdb.listvars.001.sh @@ -32,7 +32,6 @@ DatabaseMaxDead = 5 RerecoveryTimeout = 10 EnableBans = 1 NoIPFailback = 0 -DisableIPFailover = 0 VerboseMemoryNames = 0 RecdPingTimeout = 60 RecdFailCount = 10 diff --git a/ctdb/wscript b/ctdb/wscript index 1d7a31b39fa..323da8cf12a 100644 --- a/ctdb/wscript +++ b/ctdb/wscript @@ -577,6 +577,7 @@ def build(bld): ctdb-cluster-conf ctdb-database-conf ctdb-event-conf + ctdb-failover-conf ctdb-legacy-conf ctdb-event-protocol talloc tevent tdb-wrap tdb talloc_report''' + -- 2.47.2