summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2012-04-04 14:42:56 +1000
committerAmitay Isaacs <amitay@gmail.com>2012-04-13 15:38:11 +1000
commitb3d098ced7c1f334e3fcdc61f9a47f15149681c5 (patch)
treefc5f5b356549b0a6a06a3fd922bf3ff7ce87f512
parent202791cf7258ca7946989112c5ed6fffbd10be7a (diff)
downloadsamba-b3d098ced7c1f334e3fcdc61f9a47f15149681c5.tar.gz
samba-b3d098ced7c1f334e3fcdc61f9a47f15149681c5.tar.xz
samba-b3d098ced7c1f334e3fcdc61f9a47f15149681c5.zip
ctdbd: Fix spurious warnings when running with --nopublicipcheck
Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 67b909a0718d6cfce82ffce0830da3a6ff1f6c4b)
-rw-r--r--ctdb/server/ctdb_takeover.c49
1 files changed, 35 insertions, 14 deletions
diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c
index 4aaebbfe8c..43201a3832 100644
--- a/ctdb/server/ctdb_takeover.c
+++ b/ctdb/server/ctdb_takeover.c
@@ -350,6 +350,8 @@ static void ctdb_do_takeip_callback(struct ctdb_context *ctdb, int status,
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);
@@ -357,6 +359,8 @@ static void ctdb_do_takeip_callback(struct ctdb_context *ctdb, int status,
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));
@@ -460,6 +464,8 @@ static void ctdb_do_updateip_callback(struct ctdb_context *ctdb, int status,
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);
@@ -467,6 +473,8 @@ static void ctdb_do_updateip_callback(struct ctdb_context *ctdb, int status,
return;
}
+ }
+
/* the control succeeded */
ctdb_request_control_reply(ctdb, state->c, NULL, 0, NULL);
talloc_free(state);
@@ -591,7 +599,9 @@ int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb,
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"
@@ -608,6 +618,7 @@ int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb,
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",
@@ -798,19 +809,27 @@ int32_t ctdb_control_release_ip(struct ctdb_context *ctdb,
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;
}
@@ -1059,7 +1078,9 @@ int ctdb_set_public_addresses(struct ctdb_context *ctdb, const char *alist)
}
- ctdb_start_monitoring_interfaces(ctdb);
+ if (ctdb->do_checkpublicip) {
+ ctdb_start_monitoring_interfaces(ctdb);
+ }
talloc_free(lines);
return 0;