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 e93679807537f0eadcd8a0000666b52d88643cec..f516d8c537424ce77bb8d2d4f703f934e2a02782 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 db3dd209760d4ca38faebed62fa5d0f35efecfa8..71cb0e31142f76f91a99b4c9db11d500b298c303 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 da699ff89f061d6cdc3ecd2a433cfff37bcd598b..355547af41e88d6a04937756fa85aa103d70321b 100644 (file)
@@ -800,7 +800,6 @@ DatabaseMaxDead         = 5
 RerecoveryTimeout       = 10
 EnableBans              = 1
 NoIPFailback            = 0
-DisableIPFailover       = 0
 VerboseMemoryNames      = 0
 RecdPingTimeout         = 60
 RecdFailCount           = 10
index 316ac7f469d38a47d8c89bee82042f00ca9c8561..01c09bf53bea7b79cfa4a27cfce44aae1509f7a5 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 f00c3268085a025b2fc7f5eb8ea09dc75c1abe43..750b909cd3df5b21c3a1f19dcad51348235cb437 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 65c6547258dba3d7126a388e3953581ac0eb5e4e..f2f75972661c6e4ac70c9e6ca1d23e8234281894 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 6d72316e4de9829bd82f9fa0263650edaf68742e..3e85186f35aa020dba85453eae7d3463ba9efad8 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 a7638cfd677bebd93d010ba5930d28a3d659190b..76a6352863aa11f8acd0da0eb9516520e9250f75 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 95b6c3133f9526319339a8e1430acf8e2d3e2dc2..a304942af4371035f5adadd366385abd3f90ce09 100755 (executable)
@@ -32,7 +32,6 @@ DatabaseMaxDead            = 5
 RerecoveryTimeout          = 10
 EnableBans                 = 1
 NoIPFailback               = 0
-DisableIPFailover          = 0
 VerboseMemoryNames         = 0
 RecdPingTimeout            = 60
 RecdFailCount              = 10
index 1d7a31b39fa4df1d948cc6bb90fff83092334974..323da8cf12a3c2b9913ee72c9246433d9e49b2d6 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''' +