Add a new tunable : DisableIPFailover that when set to non 0
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 9 Nov 2010 04:19:06 +0000 (15:19 +1100)
committerMichael Adam <obnox@samba.org>
Fri, 6 Jun 2014 13:00:35 +0000 (15:00 +0200)
will stopp any ip reallocations at all from happening.
(cherry picked from commit d8d37493478a26c5f1809a5f3df89ffd6e149281)

Conflicts:

server/ctdb_tunables.c

include/ctdb_private.h
server/ctdb_daemon.c
server/ctdb_recover.c
server/ctdb_recoverd.c
server/ctdb_takeover.c
server/ctdb_tunables.c
server/ctdbd.c

index b52066015d53afe5ed285b9a3ce9657ea71a5aac..74a1e3a94eac28215a7802bec38896eab8298db8 100644 (file)
@@ -113,6 +113,7 @@ struct ctdb_tunable {
        uint32_t deterministic_public_ips;
        uint32_t reclock_ping_period;
        uint32_t no_ip_failback;
+       uint32_t disable_ip_failover;
        uint32_t verbose_memory_names;
        uint32_t recd_ping_timeout;
        uint32_t recd_ping_failcount;
@@ -442,7 +443,6 @@ struct ctdb_context {
        uint32_t recovery_master;
        struct ctdb_call_state *pending_calls;
        struct ctdb_client_ip *client_ip_list;
-       bool do_checkpublicip;
        struct trbt_tree *server_ids;   
        const char *event_script_dir;
        const char *notification_script;
@@ -1712,4 +1712,6 @@ void ctdb_local_remove_from_delete_queue(struct ctdb_db_context *ctdb_db,
 
 struct ctdb_ltdb_header *ctdb_header_from_record_handle(struct ctdb_record_handle *h);
 
+int ctdb_deferred_drop_all_ips(struct ctdb_context *ctdb);
+
 #endif
index 37a756b07ce0f509dc403cceb67c60c37f4d17ef..a3caa5a9c1d660383af87416c329c5e3ac643e37 100644 (file)
@@ -828,7 +828,9 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork, bool use_syslog)
        }
 
        /* release any IPs we hold from previous runs of the daemon */
-       ctdb_release_all_ips(ctdb);
+       if (ctdb->tunable.disable_ip_failover == 0) {
+               ctdb_release_all_ips(ctdb);
+       }
 
        /* start the transport going */
        ctdb_start_transport(ctdb);
index ed6fe414ab4fe51dcf8e867ceff1f09f1be92190..8ec935d014d985bba8948b412140834ae8bd3c9f 100644 (file)
@@ -586,6 +586,22 @@ ctdb_drop_all_ips_event(struct event_context *ev, struct timed_event *te,
        ctdb_release_all_ips(ctdb);
 }
 
+/*
+ * Set up an event to drop all public ips if we remain in recovery for too
+ * long
+ */
+int ctdb_deferred_drop_all_ips(struct ctdb_context *ctdb)
+{
+       if (ctdb->release_ips_ctx != NULL) {
+               talloc_free(ctdb->release_ips_ctx);
+       }
+       ctdb->release_ips_ctx = talloc_new(ctdb);
+       CTDB_NO_MEMORY(ctdb, ctdb->release_ips_ctx);
+
+       event_add_timed(ctdb->ev, ctdb->release_ips_ctx, timeval_current_ofs(ctdb->tunable.recovery_drop_all_ips, 0), ctdb_drop_all_ips_event, ctdb);
+       return 0;
+}
+
 /*
   set the recovery mode
  */
@@ -606,11 +622,9 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb,
                talloc_free(ctdb->release_ips_ctx);
                ctdb->release_ips_ctx = NULL;
        } else {
-               talloc_free(ctdb->release_ips_ctx);
-               ctdb->release_ips_ctx = talloc_new(ctdb);
-               CTDB_NO_MEMORY(ctdb, ctdb->release_ips_ctx);
-
-               event_add_timed(ctdb->ev, ctdb->release_ips_ctx, timeval_current_ofs(ctdb->tunable.recovery_drop_all_ips, 0), ctdb_drop_all_ips_event, ctdb);
+               if (ctdb_deferred_drop_all_ips(ctdb) != 0) {
+                       DEBUG(DEBUG_ERR,("Failed to set up deferred drop all ips\n"));
+               }
        }
 
        if (recmode != ctdb->recovery_mode) {
index 042625875bad21e11cc4f98c81c0b9038acd4ff5..5f3ea9e4a45a2b12d72c457f12bab3624108dead 100644 (file)
@@ -3099,7 +3099,7 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
        /* verify that we have all ip addresses we should have and we dont
         * have addresses we shouldnt have.
         */ 
-       if (ctdb->do_checkpublicip) {
+       if (ctdb->tunable.disable_ip_failover != 0) {
                if (rec->ip_check_disable_ctx == NULL) {
                        if (verify_local_ip_allocation(ctdb, rec, pnn) != 0) {
                                DEBUG(DEBUG_ERR, (__location__ " Public IPs were inconsistent.\n"));
index a96463a652093772bb9bfa101bc646369de407ba..5533f0cf65ec8d8e6f97833c59cb4e20e47a967f 100644 (file)
@@ -1233,6 +1233,13 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map *nodemap)
        struct ctdb_client_control_state *state;
        TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
 
+       /*
+        * ip failover is completely disabled, just send out the 
+        * ipreallocated event.
+        */
+       if (ctdb->tunable.disable_ip_failover != 0) {
+               goto ipreallocated;
+       }
 
        ZERO_STRUCT(ip);
 
@@ -1535,6 +1542,7 @@ finished:
                return -1;
        }
 
+ipreallocated:
        /* tell all nodes to update natwg */
        /* send the flags update natgw on all connected nodes */
        data.dptr  = discard_const("ipreallocated");
index 11e1f8166e777082e54045f260d65ad95f90dc45..3099f6141c584e501fa4b4a3901f6d9efd6ae141 100644 (file)
@@ -49,6 +49,7 @@ static const struct {
        { "DeterministicIPs",     1,  offsetof(struct ctdb_tunable, deterministic_public_ips), false },
        { "ReclockPingPeriod",   60,  offsetof(struct ctdb_tunable,  reclock_ping_period), false },
        { "NoIPFailback",         0,  offsetof(struct ctdb_tunable, no_ip_failback), false },
+       { "DisableIPFailover",    0,  offsetof(struct ctdb_tunable, disable_ip_failover), false },
        { "VerboseMemoryNames",   0,  offsetof(struct ctdb_tunable, verbose_memory_names), false },
        { "RecdPingTimeout",     60,  offsetof(struct ctdb_tunable, recd_ping_timeout), false },
        { "RecdFailCount",       10,  offsetof(struct ctdb_tunable, recd_ping_failcount), false },
index 12e754e1bac6e1e5775bc760143a9eb15d1ad184..1d5a457eb1572e6b49f0645519ab2cd330905323 100644 (file)
@@ -203,6 +203,7 @@ int main(int argc, const char *argv[])
 
        ctdb_tunables_set_defaults(ctdb);
 
+       ctdb->tunable.disable_ip_failover = options.no_publicipcheck;
 
        ret = ctdb_set_recovery_lock_file(ctdb, options.recovery_lock_file);
        if (ret == -1) {
@@ -319,8 +320,6 @@ int main(int argc, const char *argv[])
 
        ctdb->valgrinding = options.valgrinding;
 
-       ctdb->do_checkpublicip = !options.no_publicipcheck;
-
        if (options.max_persistent_check_errors < 0) {
                ctdb->max_persistent_check_errors = 0xFFFFFFFFFFFFFFFFLL;
        } else {