Merge remote branch 'amitay/tevent-sync'
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 25 Apr 2012 22:09:23 +0000 (08:09 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Wed, 25 Apr 2012 22:09:23 +0000 (08:09 +1000)
(This used to be ctdb commit 17ff3f240b0d72c72ed28d70fb9aeb3b20c80670)

1  2 
ctdb/server/ctdb_recoverd.c
ctdb/server/ctdb_takeover.c

index c0792178685580a1635eeaf985cd4b472867be92,2db24f9dbd7006ed8034deb1049595b65b297be1..359fe797496a48926529b438b08b9e796f5aa189
@@@ -18,7 -18,6 +18,6 @@@
  */
  
  #include "includes.h"
- #include "lib/tevent/tevent.h"
  #include "system/filesys.h"
  #include "system/time.h"
  #include "system/network.h"
@@@ -2775,13 -2774,13 +2774,13 @@@ static int verify_local_ip_allocation(s
                                                ctdb_addr_to_str(&ips->ips[j].addr)));
                                need_takeover_run = true;
                        } else if (ips->ips[j].pnn == pnn) {
 -                              if (!ctdb_sys_have_ip(&ips->ips[j].addr)) {
 +                              if (ctdb->do_checkpublicip && !ctdb_sys_have_ip(&ips->ips[j].addr)) {
                                        DEBUG(DEBUG_CRIT,("Public address '%s' is missing and we should serve this ip\n",
                                                ctdb_addr_to_str(&ips->ips[j].addr)));
                                        need_takeover_run = true;
                                }
                        } else {
 -                              if (ctdb_sys_have_ip(&ips->ips[j].addr)) {
 +                              if (ctdb->do_checkpublicip && ctdb_sys_have_ip(&ips->ips[j].addr)) {
                                        DEBUG(DEBUG_CRIT,("We are still serving a public address '%s' that we should not be serving.\n", 
                                                ctdb_addr_to_str(&ips->ips[j].addr)));
                                        need_takeover_run = true;
index 43201a3832506ca37817ddac0daf7f3137b9ad76,72884d72e922f1c94a46b7312d449eae1eb51d8c..c0acdcce9176bb380b1fae0fb5ca2e507cb5de3d
@@@ -19,7 -19,6 +19,6 @@@
     along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
  #include "includes.h"
- #include "lib/tevent/tevent.h"
  #include "lib/tdb/include/tdb.h"
  #include "lib/util/dlinklist.h"
  #include "system/network.h"
@@@ -350,8 -349,6 +349,8 @@@ static void ctdb_do_takeip_callback(str
                return;
        }
  
 +      if (ctdb->do_checkpublicip) {
 +
        ret = ctdb_announce_vnn_iface(ctdb, state->vnn);
        if (ret != 0) {
                ctdb_request_control_reply(ctdb, state->c, NULL, -1, NULL);
                return;
        }
  
 +      }
 +
        data.dptr  = (uint8_t *)ctdb_addr_to_str(&state->vnn->public_address);
        data.dsize = strlen((char *)data.dptr) + 1;
        DEBUG(DEBUG_INFO,(__location__ " sending TAKE_IP for '%s'\n", data.dptr));
@@@ -387,7 -382,7 +386,7 @@@ static int32_t ctdb_do_takeip(struct ct
        ret = ctdb_vnn_assign_iface(ctdb, vnn);
        if (ret != 0) {
                DEBUG(DEBUG_ERR,("Takeover of IP %s/%u failed to "
 -                               "assin a usable interface\n",
 +                               "assign a usable interface\n",
                                 ctdb_addr_to_str(&vnn->public_address),
                                 vnn->public_netmask_bits));
                return -1;
@@@ -464,8 -459,6 +463,8 @@@ static void ctdb_do_updateip_callback(s
                return;
        }
  
 +      if (ctdb->do_checkpublicip) {
 +
        ret = ctdb_announce_vnn_iface(ctdb, state->vnn);
        if (ret != 0) {
                ctdb_request_control_reply(ctdb, state->c, NULL, -1, NULL);
                return;
        }
  
 +      }
 +
        /* the control succeeded */
        ctdb_request_control_reply(ctdb, state->c, NULL, 0, NULL);
        talloc_free(state);
@@@ -599,9 -590,7 +598,9 @@@ int32_t ctdb_control_takeover_ip(struc
                return 0;
        }
  
 -      have_ip = ctdb_sys_have_ip(&pip->addr);
 +      if (ctdb->do_checkpublicip) {
 +              have_ip = ctdb_sys_have_ip(&pip->addr);
 +      }
        best_iface = ctdb_vnn_best_iface(ctdb, vnn);
        if (best_iface == NULL) {
                DEBUG(DEBUG_ERR,("takeoverip of IP %s/%u failed to find"
                have_ip = false;
        }
  
 +
        if (vnn->iface == NULL && have_ip) {
                DEBUG(DEBUG_CRIT,(__location__ " takeoverip of IP %s is known to the kernel, "
                                  "but we have no interface assigned, has someone manually configured it? Ignore for now.\n",
@@@ -809,27 -797,19 +808,27 @@@ int32_t ctdb_control_release_ip(struct 
        talloc_free(vnn->takeover_ctx);
        vnn->takeover_ctx = NULL;
  
 -      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),
 -                      vnn->public_netmask_bits, 
 -                      ctdb_vnn_iface_string(vnn)));
 -              ctdb_vnn_unassign_iface(ctdb, vnn);
 -              return 0;
 -      }
 +      if (ctdb->do_checkpublicip) {
  
 -      if (vnn->iface == NULL) {
 -              DEBUG(DEBUG_ERR,(__location__ " release_ip of IP %s is known to the kernel, "
 -                               "but we have no interface assigned, has someone manually configured it? Ignore for now.\n",
 -                               ctdb_addr_to_str(&vnn->public_address)));
 +              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),
 +                              vnn->public_netmask_bits,
 +                              ctdb_vnn_iface_string(vnn)));
 +                      ctdb_vnn_unassign_iface(ctdb, vnn);
 +                      return 0;
 +              }
 +
 +              if (vnn->iface == NULL) {
 +                      DEBUG(DEBUG_ERR,(__location__ " release_ip of IP %s is known to the kernel, "
 +                                       "but we have no interface assigned, has someone manually configured it? Ignore for now.\n",
 +                                       ctdb_addr_to_str(&vnn->public_address)));
 +                      return 0;
 +              }
 +
 +      } else if (vnn->iface == NULL) {
 +              DEBUG(DEBUG_ERR, ("No interface found for IP %s.\n",
 +                                   ctdb_addr_to_str(&vnn->public_address)));
                return 0;
        }
  
@@@ -1078,9 -1058,7 +1077,9 @@@ int ctdb_set_public_addresses(struct ct
        }
  
  
 -      ctdb_start_monitoring_interfaces(ctdb);
 +      if (ctdb->do_checkpublicip) {
 +              ctdb_start_monitoring_interfaces(ctdb);
 +      }
  
        talloc_free(lines);
        return 0;