ctdb-config: Switch tunable DisableIPFailover to a config option
authorMartin Schwenke <martin@meltin.net>
Tue, 21 Aug 2018 03:41:22 +0000 (13:41 +1000)
committerAmitay Isaacs <amitay@samba.org>
Fri, 24 Aug 2018 08:59:21 +0000 (10:59 +0200)
Use the "failover:disabled" option instead.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/common/tunable.c
ctdb/doc/ctdb-tunables.7.xml
ctdb/doc/ctdb.1.xml
ctdb/doc/ctdb.conf.5.xml
ctdb/server/ctdb_config.c
ctdb/server/ctdb_config.h
ctdb/server/ctdb_recoverd.c
ctdb/server/ctdb_takeover.c
ctdb/tests/tool/ctdb.listvars.001.sh
ctdb/wscript

index e936798..f516d8c 100644 (file)
@@ -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) },
index db3dd20..71cb0e3 100644 (file)
@@ -177,23 +177,6 @@ MonitorInterval=20
       </para>
     </refsect2>
 
-    <refsect2>
-      <title>DisableIPFailover</title>
-      <para>Default: 0</para>
-      <para>
-       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.
-      </para>
-      <para>
-       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.
-      </para>
-    </refsect2>
-
     <refsect2>
       <title>ElectionTimeout</title>
       <para>Default: 3</para>
index da699ff..355547a 100644 (file)
@@ -800,7 +800,6 @@ DatabaseMaxDead         = 5
 RerecoveryTimeout       = 10
 EnableBans              = 1
 NoIPFailback            = 0
-DisableIPFailover       = 0
 VerboseMemoryNames      = 0
 RecdPingTimeout         = 60
 RecdFailCount           = 10
index 316ac7f..01c09bf 100644 (file)
     </variablelist>
   </refsect1>
 
+  <refsect1>
+    <title>
+      FAILOVER CONFIGURATION
+    </title>
+
+    <para>
+      Options in this section affect CTDB failover. They are
+      valid within the <emphasis>failover</emphasis> section of file,
+      indicated by <literal>[failover]</literal>.
+    </para>
+
+    <variablelist>
+
+      <varlistentry>
+       <term>disabled = true|false</term>
+       <listitem>
+         <para>
+           If set to <literal>true</literal> then public IP failover
+           is disabled.
+         </para>
+         <para>
+           Default: <literal>false</literal>
+         </para>
+       </listitem>
+      </varlistentry>
+
+    </variablelist>
+  </refsect1>
+
   <refsect1>
     <title>
       LEGACY CONFIGURATION
index f00c326..750b909 100644 (file)
@@ -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);
index 65c6547..f2f7597 100644 (file)
@@ -38,6 +38,9 @@ struct ctdb_config {
        /* Event */
        const char *event_debug_script;
 
+       /* Failover */
+       bool failover_disabled;
+
        /* Legacy */
        bool realtime_scheduling;
        bool recmaster_capability;
index 6d72316..3e85186 100644 (file)
@@ -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;
        }
index a7638cf..76a6352 100644 (file)
@@ -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;
        }
 
index 95b6c31..a304942 100755 (executable)
@@ -32,7 +32,6 @@ DatabaseMaxDead            = 5
 RerecoveryTimeout          = 10
 EnableBans                 = 1
 NoIPFailback               = 0
-DisableIPFailover          = 0
 VerboseMemoryNames         = 0
 RecdPingTimeout            = 60
 RecdFailCount              = 10
index 1d7a31b..323da8c 100644 (file)
@@ -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''' +