[SCM] Samba Shared Repository - branch master updated
Anoop C S
anoopcs at samba.org
Tue Oct 8 06:43:01 UTC 2024
The branch, master has been updated
via 9a2249c9902 ctdb-server: Use find_public_ip_vnn() in a couple of extra places
via 2167261b0e5 ctdb-server: Clean up find_public_ip_vnn()
via d268c605c18 ctdb-daemon: Ensure CTDB_BASE is set, don't fetch it
via b6151faf458 ctdb-daemon: Use path_etcdir_append() to construct some paths
via 3b613a085b8 ctdb-daemon: Replace remaining uses of CTDB_NO_MEMORY() in this file
via 01cc3f0784a ctdb-daemon: Clean up error handling and debug
via 3429ba764c1 ctdb-daemon: Use ctdb_vnn_address_string() in old-style debugging
via c17e629a8ae ctdb-daemon: Add ctdb_vnn_address_string() and use in trivial places
via 766e6d35c48 ctdb-daemon: Store public address string in VNN
via ef3d9c227f8 ctdb-daemon: Fix a comment
via 7b4447b4d39 ctdb-daemon: Drop unused arguments
via 46f6b50f7a5 ctdb-daemon: Improve error handling when releasing all IPs
from d1cb6dca721 ctdb-tcp: Modernise a DEBUG
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 9a2249c99020c62fdf6679e394a5faaa50818a1f
Author: Martin Schwenke <mschwenke at ddn.com>
Date: Thu Aug 29 18:38:58 2024 +1000
ctdb-server: Use find_public_ip_vnn() in a couple of extra places
Reorder code to use early returns, modernise debug.
Best reviewed with "git show -w".
Signed-off-by: Martin Schwenke <mschwenke at ddn.com>
Reviewed-by: Anoop C S <anoopcs at samba.org>
Autobuild-User(master): Anoop C S <anoopcs at samba.org>
Autobuild-Date(master): Tue Oct 8 06:42:04 UTC 2024 on atb-devel-224
commit 2167261b0e536fa04bcc05a3f3ecea9aa6b18a05
Author: Martin Schwenke <mschwenke at ddn.com>
Date: Thu Aug 29 18:27:54 2024 +1000
ctdb-server: Clean up find_public_ip_vnn()
Fix the comment (NULL versus -1), apply some README.Coding.
Signed-off-by: Martin Schwenke <mschwenke at ddn.com>
Reviewed-by: Anoop C S <anoopcs at samba.org>
commit d268c605c188a20dfb978e3fc9b8b6c10af35a4f
Author: Martin Schwenke <mschwenke at ddn.com>
Date: Fri Aug 9 10:53:46 2024 +1000
ctdb-daemon: Ensure CTDB_BASE is set, don't fetch it
Uses of CTDB_BASE in the subsequent code are now handled by the path
module, so there is no point getting the value of CTDB_BASE. Instead,
check that the attempt to set it worked, noting that:
[...] if overwrite is zero, then the value of name is not
changed (and setenv() returns a success status).
Signed-off-by: Martin Schwenke <mschwenke at ddn.com>
Reviewed-by: Anoop C S <anoopcs at samba.org>
commit b6151faf4589a355aadac1839ab6a98a5b3f335e
Author: Martin Schwenke <mschwenke at ddn.com>
Date: Tue Aug 6 13:49:01 2024 +1000
ctdb-daemon: Use path_etcdir_append() to construct some paths
No need to use CTDB_BASE directly.
Signed-off-by: Martin Schwenke <mschwenke at ddn.com>
Reviewed-by: Anoop C S <anoopcs at samba.org>
commit 3b613a085b8c79ab50388249c9128ab60dc082b5
Author: Martin Schwenke <mschwenke at ddn.com>
Date: Fri Jul 26 11:38:07 2024 +1000
ctdb-daemon: Replace remaining uses of CTDB_NO_MEMORY() in this file
Signed-off-by: Martin Schwenke <mschwenke at ddn.com>
Reviewed-by: Anoop C S <anoopcs at samba.org>
commit 01cc3f0784a361daeb80560319e93ebc2432350d
Author: Martin Schwenke <mschwenke at ddn.com>
Date: Fri Jul 26 11:29:43 2024 +1000
ctdb-daemon: Clean up error handling and debug
Add some missing error handling and error messages.
Remove a use of CTDB_NO_MEMORY(), which then renders the caller's use
of ctdb_errstr() pointless, so remove that too.
Signed-off-by: Martin Schwenke <mschwenke at ddn.com>
Reviewed-by: Anoop C S <anoopcs at samba.org>
commit 3429ba764c1b772d46dcdca356fd5b136ba50b68
Author: Martin Schwenke <mschwenke at ddn.com>
Date: Thu Jul 25 14:50:32 2024 +1000
ctdb-daemon: Use ctdb_vnn_address_string() in old-style debugging
Modernise the debug macros along the way.
These are done separately because they will require a little more
patience to review.
Signed-off-by: Martin Schwenke <mschwenke at ddn.com>
Reviewed-by: Anoop C S <anoopcs at samba.org>
commit c17e629a8ae12562af319bdd31fc1d3e323a604f
Author: Martin Schwenke <mschwenke at ddn.com>
Date: Thu Jul 25 14:47:06 2024 +1000
ctdb-daemon: Add ctdb_vnn_address_string() and use in trivial places
Define a static function to return the string. This clearly doesn't
need a ctdb_ prefix, but it matches ctdb_vnn_iface_string(), so
doesn't look out of place.
Use it in the places where review is trivial.
Signed-off-by: Martin Schwenke <mschwenke at ddn.com>
Reviewed-by: Anoop C S <anoopcs at samba.org>
commit 766e6d35c48408f0e105c5745b5ad8dcb06256d0
Author: Martin Schwenke <mschwenke at ddn.com>
Date: Thu Jul 25 14:40:18 2024 +1000
ctdb-daemon: Store public address string in VNN
These are currently converted to strings constantly in log messages
and other places. This clutters the code and probably has a minor
performance impact.
Add a new string field to the VNN structure. Populate it when a
public address is added and the VNN structure is allocated. This is
consistent with how node addresses are handled.
Don't use it yet, or this commit becomes huge.
A short-term goal is that each VNN public address will be converted to
a string only once. A longer-term goal is to reduce use of
ctdb_addr_to_str().
Signed-off-by: Martin Schwenke <mschwenke at ddn.com>
Reviewed-by: Anoop C S <anoopcs at samba.org>
commit ef3d9c227f89532909aca74f11d09fdb96af3377
Author: Martin Schwenke <mschwenke at ddn.com>
Date: Thu Jul 25 13:41:35 2024 +1000
ctdb-daemon: Fix a comment
The word "no" was accidentally dropped in commit
1e47a1b3f6ab1e2ad9d86dfb28c3e086c99a97e5.
Signed-off-by: Martin Schwenke <mschwenke at ddn.com>
Reviewed-by: Anoop C S <anoopcs at samba.org>
commit 7b4447b4d3950f1769b5daafb445c9654889a91c
Author: Martin Schwenke <mschwenke at ddn.com>
Date: Tue Jun 18 15:54:26 2024 +1000
ctdb-daemon: Drop unused arguments
Unused since commit a10545ab6bd8a1b9ca87b0fdba8381cb8af0e284.
Signed-off-by: Martin Schwenke <mschwenke at ddn.com>
Reviewed-by: Anoop C S <anoopcs at samba.org>
commit 46f6b50f7a56942dcf444b0a7083ff0e5b4c2697
Author: Martin Schwenke <mschwenke at ddn.com>
Date: Tue Jun 18 15:38:18 2024 +1000
ctdb-daemon: Improve error handling when releasing all IPs
Currently, event failures are completely ignored in favour of checking
if the IP is on an interface. This misses the case where event
scripts up to and including 10.interface succeed, but something later
fails. When that occurs, count is incremented, so the failure is
counted as a success in the summary that is logged.
Fail when releaseip fails even though 10.interface succeeded in
releasing the IP. This may result in the IP address coming back, but
that's a different problem.
Underlying this is a design question about when releaseip is
successful. Should releaseip be a distinct operation, with subsequent
reconfigurations considered separately?
Update logging to clearly identify each of the 3 possible errors.
Signed-off-by: Martin Schwenke <mschwenke at ddn.com>
Reviewed-by: Anoop C S <anoopcs at samba.org>
-----------------------------------------------------------------------
Summary of changes:
ctdb/include/ctdb_private.h | 2 +-
ctdb/server/ctdb_daemon.c | 2 +-
ctdb/server/ctdb_server.c | 34 +++-
ctdb/server/ctdb_takeover.c | 394 +++++++++++++++++++++++---------------------
ctdb/server/ctdbd.c | 19 +--
5 files changed, 244 insertions(+), 207 deletions(-)
Changeset truncated at 500 lines:
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index b36eaa08a08..6bf8141be6d 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -893,7 +893,7 @@ int32_t ctdb_control_start_ipreallocate(struct ctdb_context *ctdb,
struct ctdb_req_control_old *c,
bool *async_reply);
-int ctdb_set_public_addresses(struct ctdb_context *ctdb, bool check_addresses);
+int ctdb_set_public_addresses(struct ctdb_context *ctdb);
int32_t ctdb_control_tcp_client(struct ctdb_context *ctdb, uint32_t client_id,
TDB_DATA indata);
diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c
index 287a76c77c3..46bc324ae87 100644
--- a/ctdb/server/ctdb_daemon.c
+++ b/ctdb/server/ctdb_daemon.c
@@ -1651,7 +1651,7 @@ int ctdb_start_daemon(struct ctdb_context *ctdb,
initialise_node_flags(ctdb);
- ret = ctdb_set_public_addresses(ctdb, true);
+ ret = ctdb_set_public_addresses(ctdb);
if (ret == -1) {
D_ERR("Unable to setup public IP addresses\n");
exit(1);
diff --git a/ctdb/server/ctdb_server.c b/ctdb/server/ctdb_server.c
index a1344bae1ae..c2660fc90a4 100644
--- a/ctdb/server/ctdb_server.c
+++ b/ctdb/server/ctdb_server.c
@@ -44,7 +44,10 @@
int ctdb_set_transport(struct ctdb_context *ctdb, const char *transport)
{
ctdb->transport = talloc_strdup(ctdb, transport);
- CTDB_NO_MEMORY(ctdb, ctdb->transport);
+ if (ctdb->transport == NULL) {
+ DBG_ERR("Memory allocation error\n");
+ return -1;
+ }
return 0;
}
@@ -92,21 +95,32 @@ static int convert_node_map_to_list(struct ctdb_context *ctdb,
*nodes = talloc_zero_array(mem_ctx,
struct ctdb_node *, node_map->num);
- CTDB_NO_MEMORY(ctdb, *nodes);
+ if (*nodes == NULL) {
+ DBG_ERR("Memory allocation error\n");
+ return -1;
+ }
*num_nodes = node_map->num;
for (i = 0; i < node_map->num; i++) {
struct ctdb_node *node;
node = talloc_zero(*nodes, struct ctdb_node);
- CTDB_NO_MEMORY(ctdb, node);
+ if (node == NULL) {
+ DBG_ERR("Memory allocation error\n");
+ TALLOC_FREE(*nodes);
+ return -1;
+ }
(*nodes)[i] = node;
node->address = node_map->node[i].addr;
node->name = talloc_asprintf(node, "%s:%u",
ctdb_addr_to_str(&node->address),
ctdb_addr_to_port(&node->address));
- CTDB_NO_MEMORY(ctdb, node->name);
+ if (node->name == NULL) {
+ DBG_ERR("Memory allocation error\n");
+ TALLOC_FREE(*nodes);
+ return -1;
+ }
node->flags = node_map->node[i].flags;
if (!(node->flags & NODE_FLAGS_DELETED)) {
@@ -158,10 +172,14 @@ int ctdb_set_address(struct ctdb_context *ctdb, const char *address)
bool ok;
ctdb->address = talloc(ctdb, ctdb_sock_addr);
- CTDB_NO_MEMORY(ctdb, ctdb->address);
+ if (ctdb->address == NULL) {
+ DBG_ERR("Memory allocation error\n");
+ return -1;
+ }
ok = ctdb_parse_node_address(address, ctdb->address);
if (!ok) {
+ DBG_ERR("Failed to parse node address\n");
TALLOC_FREE(ctdb->address);
return -1;
}
@@ -169,6 +187,12 @@ int ctdb_set_address(struct ctdb_context *ctdb, const char *address)
ctdb->name = talloc_asprintf(ctdb, "%s:%u",
ctdb_addr_to_str(ctdb->address),
ctdb_addr_to_port(ctdb->address));
+ if (ctdb->name == NULL) {
+ DBG_ERR("Memory allocation error\n");
+ TALLOC_FREE(ctdb->address);
+ return -1;
+ }
+
return 0;
}
diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c
index 2176c6ab806..bb021a29ebf 100644
--- a/ctdb/server/ctdb_takeover.c
+++ b/ctdb/server/ctdb_takeover.c
@@ -44,6 +44,7 @@
#include "common/system_socket.h"
#include "common/common.h"
#include "common/logging.h"
+#include "common/path.h"
#include "conf/ctdb_config.h"
@@ -74,10 +75,11 @@ struct ctdb_vnn {
struct vnn_interface *ifaces;
ctdb_sock_addr public_address;
uint8_t public_netmask_bits;
+ const char *name;
/*
* The node number that is serving this public address - set
- * to CTDB_UNKNOWN_PNN if node is serving it
+ * to CTDB_UNKNOWN_PNN if no node is serving it
*/
uint32_t pnn;
@@ -111,6 +113,11 @@ static const char *ctdb_vnn_iface_string(const struct ctdb_vnn *vnn)
return iface_string(vnn->iface);
}
+static const char *ctdb_vnn_address_string(const struct ctdb_vnn *vnn)
+{
+ return vnn->name;
+}
+
static struct ctdb_interface *ctdb_find_iface(struct ctdb_context *ctdb,
const char *iface);
@@ -258,18 +265,16 @@ static int32_t ctdb_vnn_assign_iface(struct ctdb_context *ctdb,
struct ctdb_interface *best = NULL;
if (vnn->iface) {
- DEBUG(DEBUG_INFO, (__location__ " public address '%s' "
- "still assigned to iface '%s'\n",
- ctdb_addr_to_str(&vnn->public_address),
- ctdb_vnn_iface_string(vnn)));
+ DBG_INFO("public address '%s' still assigned to iface '%s'\n",
+ ctdb_vnn_address_string(vnn),
+ ctdb_vnn_iface_string(vnn));
return 0;
}
best = ctdb_vnn_best_iface(ctdb, vnn);
if (best == NULL) {
- DEBUG(DEBUG_ERR, (__location__ " public address '%s' "
- "cannot assign to iface any iface\n",
- ctdb_addr_to_str(&vnn->public_address)));
+ DBG_ERR("public address '%s' cannot assign to iface any iface\n",
+ ctdb_vnn_address_string(vnn));
return -1;
}
@@ -277,22 +282,21 @@ static int32_t ctdb_vnn_assign_iface(struct ctdb_context *ctdb,
best->references++;
vnn->pnn = ctdb->pnn;
- DEBUG(DEBUG_INFO, (__location__ " public address '%s' "
- "now assigned to iface '%s' refs[%d]\n",
- ctdb_addr_to_str(&vnn->public_address),
- ctdb_vnn_iface_string(vnn),
- best->references));
+ DBG_INFO("public address '%s' now assigned to iface '%s' refs[%d]\n",
+ ctdb_vnn_address_string(vnn),
+ ctdb_vnn_iface_string(vnn),
+ best->references);
return 0;
}
static void ctdb_vnn_unassign_iface(struct ctdb_context *ctdb,
struct ctdb_vnn *vnn)
{
- DEBUG(DEBUG_INFO, (__location__ " public address '%s' "
- "now unassigned (old iface '%s' refs[%d])\n",
- ctdb_addr_to_str(&vnn->public_address),
- ctdb_vnn_iface_string(vnn),
- vnn->iface?vnn->iface->references:0));
+ DBG_INFO("public address '%s' "
+ "now unassigned (old iface '%s' refs[%d])\n",
+ ctdb_vnn_address_string(vnn),
+ ctdb_vnn_iface_string(vnn),
+ vnn->iface != NULL ? vnn->iface->references : 0);
if (vnn->iface) {
vnn->iface->references--;
}
@@ -369,7 +373,7 @@ static void ctdb_control_send_arp(struct tevent_context *ev,
/* IP address might have been released between sends */
if (arp->vnn->iface == NULL) {
DBG_INFO("Cancelling ARP send for released IP %s\n",
- ctdb_addr_to_str(&arp->vnn->public_address));
+ ctdb_vnn_address_string(arp->vnn));
talloc_free(arp);
return;
}
@@ -480,9 +484,9 @@ static void ctdb_do_takeip_callback(struct ctdb_context *ctdb, int status,
if (status == -ETIMEDOUT) {
ctdb_ban_self(ctdb);
}
- DEBUG(DEBUG_ERR,(__location__ " Failed to takeover IP %s on interface %s\n",
- ctdb_addr_to_str(&state->vnn->public_address),
- ctdb_vnn_iface_string(state->vnn)));
+ DBG_ERR("Failed to takeover IP %s on interface %s\n",
+ ctdb_vnn_address_string(state->vnn),
+ ctdb_vnn_iface_string(state->vnn));
ctdb_request_control_reply(ctdb, state->c, NULL, status, NULL);
talloc_free(state);
@@ -500,7 +504,8 @@ static void ctdb_do_takeip_callback(struct ctdb_context *ctdb, int status,
}
- data.dptr = (uint8_t *)ctdb_addr_to_str(&state->vnn->public_address);
+ data.dptr = (uint8_t *)discard_const(
+ ctdb_vnn_address_string(state->vnn));
data.dsize = strlen((char *)data.dptr) + 1;
DEBUG(DEBUG_INFO,(__location__ " sending TAKE_IP for '%s'\n", data.dptr));
@@ -530,19 +535,19 @@ static int32_t ctdb_do_takeip(struct ctdb_context *ctdb,
struct ctdb_do_takeip_state *state;
if (vnn->update_in_flight) {
- DEBUG(DEBUG_NOTICE,("Takeover of IP %s/%u rejected "
- "update for this IP already in flight\n",
- ctdb_addr_to_str(&vnn->public_address),
- vnn->public_netmask_bits));
+ D_NOTICE("Takeover of IP %s/%u rejected "
+ "update for this IP already in flight\n",
+ ctdb_vnn_address_string(vnn),
+ vnn->public_netmask_bits);
return -1;
}
ret = ctdb_vnn_assign_iface(ctdb, vnn);
if (ret != 0) {
- DEBUG(DEBUG_ERR,("Takeover of IP %s/%u failed to "
- "assign a usable interface\n",
- ctdb_addr_to_str(&vnn->public_address),
- vnn->public_netmask_bits));
+ D_ERR("Takeover of IP %s/%u failed to "
+ "assign a usable interface\n",
+ ctdb_vnn_address_string(vnn),
+ vnn->public_netmask_bits);
return -1;
}
@@ -555,10 +560,10 @@ static int32_t ctdb_do_takeip(struct ctdb_context *ctdb,
vnn->update_in_flight = true;
talloc_set_destructor(state, ctdb_takeip_destructor);
- DEBUG(DEBUG_NOTICE,("Takeover of IP %s/%u on interface %s\n",
- ctdb_addr_to_str(&vnn->public_address),
- vnn->public_netmask_bits,
- ctdb_vnn_iface_string(vnn)));
+ D_NOTICE("Takeover of IP %s/%u on interface %s\n",
+ ctdb_vnn_address_string(vnn),
+ vnn->public_netmask_bits,
+ ctdb_vnn_iface_string(vnn));
ret = ctdb_event_script_callback(ctdb,
state,
@@ -567,13 +572,13 @@ static int32_t ctdb_do_takeip(struct ctdb_context *ctdb,
CTDB_EVENT_TAKE_IP,
"%s %s %u",
ctdb_vnn_iface_string(vnn),
- ctdb_addr_to_str(&vnn->public_address),
+ ctdb_vnn_address_string(vnn),
vnn->public_netmask_bits);
if (ret != 0) {
- DEBUG(DEBUG_ERR,(__location__ " Failed to takeover IP %s on interface %s\n",
- ctdb_addr_to_str(&vnn->public_address),
- ctdb_vnn_iface_string(vnn)));
+ DBG_ERR("Failed to takeover IP %s on interface %s\n",
+ ctdb_vnn_address_string(vnn),
+ ctdb_vnn_iface_string(vnn));
talloc_free(state);
return -1;
}
@@ -601,11 +606,10 @@ static void ctdb_do_updateip_callback(struct ctdb_context *ctdb, int status,
if (status == -ETIMEDOUT) {
ctdb_ban_self(ctdb);
}
- DEBUG(DEBUG_ERR,
- ("Failed update of IP %s from interface %s to %s\n",
- ctdb_addr_to_str(&state->vnn->public_address),
- iface_string(state->old),
- ctdb_vnn_iface_string(state->vnn)));
+ D_ERR("Failed update of IP %s from interface %s to %s\n",
+ ctdb_vnn_address_string(state->vnn),
+ iface_string(state->old),
+ ctdb_vnn_iface_string(state->vnn));
/*
* All we can do is reset the old interface
@@ -646,21 +650,21 @@ static int32_t ctdb_do_updateip(struct ctdb_context *ctdb,
const char *new_name;
if (vnn->update_in_flight) {
- DEBUG(DEBUG_NOTICE,("Update of IP %s/%u rejected "
- "update for this IP already in flight\n",
- ctdb_addr_to_str(&vnn->public_address),
- vnn->public_netmask_bits));
+ D_NOTICE("Update of IP %s/%u rejected "
+ "update for this IP already in flight\n",
+ ctdb_vnn_address_string(vnn),
+ vnn->public_netmask_bits);
return -1;
}
ctdb_vnn_unassign_iface(ctdb, vnn);
ret = ctdb_vnn_assign_iface(ctdb, vnn);
if (ret != 0) {
- DEBUG(DEBUG_ERR,("Update of IP %s/%u failed to "
- "assign a usable interface (old iface '%s')\n",
- ctdb_addr_to_str(&vnn->public_address),
- vnn->public_netmask_bits,
- old_name));
+ D_ERR("Update of IP %s/%u failed to "
+ "assign a usable interface (old iface '%s')\n",
+ ctdb_vnn_address_string(vnn),
+ vnn->public_netmask_bits,
+ old_name);
return -1;
}
@@ -684,12 +688,12 @@ static int32_t ctdb_do_updateip(struct ctdb_context *ctdb,
talloc_set_destructor(state, ctdb_updateip_destructor);
new_name = ctdb_vnn_iface_string(vnn);
- DEBUG(DEBUG_NOTICE,("Update of IP %s/%u from "
- "interface %s to %s\n",
- ctdb_addr_to_str(&vnn->public_address),
- vnn->public_netmask_bits,
- old_name,
- new_name));
+ D_NOTICE("Update of IP %s/%u from "
+ "interface %s to %s\n",
+ ctdb_vnn_address_string(vnn),
+ vnn->public_netmask_bits,
+ old_name,
+ new_name);
ret = ctdb_event_script_callback(ctdb,
state,
@@ -699,13 +703,13 @@ static int32_t ctdb_do_updateip(struct ctdb_context *ctdb,
"%s %s %s %u",
old_name,
new_name,
- ctdb_addr_to_str(&vnn->public_address),
+ ctdb_vnn_address_string(vnn),
vnn->public_netmask_bits);
if (ret != 0) {
- DEBUG(DEBUG_ERR,
- ("Failed update IP %s from interface %s to %s\n",
- ctdb_addr_to_str(&vnn->public_address),
- old_name, new_name));
+ D_ERR("Failed update IP %s from interface %s to %s\n",
+ ctdb_vnn_address_string(vnn),
+ old_name,
+ new_name);
talloc_free(state);
return -1;
}
@@ -715,14 +719,14 @@ static int32_t ctdb_do_updateip(struct ctdb_context *ctdb,
}
/*
- Find the vnn of the node that has a public ip address
- returns -1 if the address is not known as a public address
+ * Find vnn that has public IP addr, return NULL if not found
*/
-static struct ctdb_vnn *find_public_ip_vnn(struct ctdb_context *ctdb, ctdb_sock_addr *addr)
+static struct ctdb_vnn *find_public_ip_vnn(struct ctdb_context *ctdb,
+ ctdb_sock_addr *addr)
{
- struct ctdb_vnn *vnn;
+ struct ctdb_vnn *vnn = NULL;
- for (vnn=ctdb->vnn;vnn;vnn=vnn->next) {
+ for (vnn = ctdb->vnn; vnn != NULL; vnn = vnn->next) {
if (ctdb_same_ip(&vnn->public_address, addr)) {
return vnn;
}
@@ -768,21 +772,24 @@ int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb,
}
best_iface = ctdb_vnn_best_iface(ctdb, vnn);
if (best_iface == NULL) {
- DEBUG(DEBUG_ERR,("takeoverip of IP %s/%u failed to find"
- "a usable interface (old %s, have_ip %d)\n",
- ctdb_addr_to_str(&vnn->public_address),
- vnn->public_netmask_bits,
- ctdb_vnn_iface_string(vnn),
- have_ip));
+ D_ERR("takeoverip of IP %s/%u failed to find"
+ "a usable interface (old %s, have_ip %d)\n",
+ ctdb_vnn_address_string(vnn),
+ vnn->public_netmask_bits,
+ ctdb_vnn_iface_string(vnn),
+ have_ip);
return -1;
}
if (vnn->pnn != ctdb->pnn && have_ip && vnn->pnn != CTDB_UNKNOWN_PNN) {
- DEBUG(DEBUG_CRIT,(__location__ " takeoverip of IP %s is known to the kernel, "
- "and we have it on iface[%s], but it was assigned to node %d"
- "and we are node %d, banning ourself\n",
- ctdb_addr_to_str(&vnn->public_address),
- ctdb_vnn_iface_string(vnn), vnn->pnn, ctdb->pnn));
+ DBG_ERR("takeoverip of IP %s is known to the kernel, "
+ "and we have it on iface[%s], "
+ "but it was assigned to node %d"
+ "and we are node %d, banning ourself\n",
+ ctdb_vnn_address_string(vnn),
+ ctdb_vnn_iface_string(vnn),
+ vnn->pnn,
+ ctdb->pnn);
ctdb_ban_self(ctdb);
return -1;
}
@@ -793,10 +800,9 @@ int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb,
* situation and doing this will completely repair the
* inconsistency in the VNN.
*/
- DEBUG(DEBUG_WARNING,
- (__location__
- " Doing updateip for IP %s already on an interface\n",
- ctdb_addr_to_str(&vnn->public_address)));
+ DBG_WARNING(
+ "Doing updateip for IP %s already on an interface\n",
+ ctdb_vnn_address_string(vnn));
do_updateip = true;
}
@@ -991,10 +997,10 @@ int32_t ctdb_control_release_ip(struct ctdb_context *ctdb,
* update to be in flight at a time.
*/
if (vnn->update_in_flight) {
- DEBUG(DEBUG_NOTICE,("Release of IP %s/%u rejected "
- "update for this IP already in flight\n",
- ctdb_addr_to_str(&vnn->public_address),
- vnn->public_netmask_bits));
+ D_NOTICE("Release of IP %s/%u rejected "
+ "update for this IP already in flight\n",
+ ctdb_vnn_address_string(vnn),
+ vnn->public_netmask_bits);
return -1;
}
@@ -1051,8 +1057,7 @@ int32_t ctdb_control_release_ip(struct ctdb_context *ctdb,
static int ctdb_add_public_address(struct ctdb_context *ctdb,
ctdb_sock_addr *addr,
- unsigned mask, const char *ifaces,
- bool check_address)
+ unsigned mask, const char *ifaces)
{
struct ctdb_vnn *vnn;
char *tmp;
@@ -1073,6 +1078,14 @@ static int ctdb_add_public_address(struct ctdb_context *ctdb,
DBG_ERR("Memory allocation error\n");
return -1;
}
+
+ vnn->name = ctdb_sock_addr_to_string(vnn, addr, false);
+ if (vnn->name == NULL) {
+ DBG_ERR("Memory allocation error\n");
+ talloc_free(vnn);
+ return -1;
+ }
+
tmp = talloc_strdup(vnn, ifaces);
if (tmp == NULL) {
DBG_ERR("Memory allocation error\n");
@@ -1086,7 +1099,7 @@ static int ctdb_add_public_address(struct ctdb_context *ctdb,
if (!ctdb_sys_check_iface_exists(iface)) {
D_ERR("Unknown interface %s for public address %s\n",
iface,
- ctdb_addr_to_str(addr));
+ ctdb_vnn_address_string(vnn));
talloc_free(vnn);
return -1;
}
@@ -1096,7 +1109,7 @@ static int ctdb_add_public_address(struct ctdb_context *ctdb,
D_ERR("Failed to add interface '%s' "
"for public address %s\n",
--
Samba Shared Repository
More information about the samba-cvs
mailing list