mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
ctdb-daemon: Stop inactive/disabled nodes from reporting available IPs
This can be done now that NoIPHostOnAllDisabled is gone and will allow the public IP address failover logic to be simplified. In the test code, still filter available IP addresses by node state. This code can't currently read information about available IP addresses but that will change in future Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
fda0591083
commit
709ef6b7cc
@ -299,6 +299,7 @@ static void ctdb_vnn_unassign_iface(struct ctdb_context *ctdb,
|
||||
static bool ctdb_vnn_available(struct ctdb_context *ctdb,
|
||||
struct ctdb_vnn *vnn)
|
||||
{
|
||||
uint32_t flags;
|
||||
struct vnn_interface *i;
|
||||
|
||||
/* Nodes that are not RUNNING can not host IPs */
|
||||
@ -306,6 +307,11 @@ static bool ctdb_vnn_available(struct ctdb_context *ctdb,
|
||||
return false;
|
||||
}
|
||||
|
||||
flags = ctdb->nodes[ctdb->pnn]->flags;
|
||||
if ((flags & (NODE_FLAGS_INACTIVE|NODE_FLAGS_DISABLED)) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (vnn->delete_pending) {
|
||||
return false;
|
||||
}
|
||||
|
@ -160,6 +160,7 @@ static void ctdb_test_init(TALLOC_CTX *mem_ctx,
|
||||
uint32_t noiptakeover;
|
||||
ctdb_sock_addr sa_zero = { .ip = { 0 } };
|
||||
enum ipalloc_algorithm algorithm;
|
||||
uint32_t n;
|
||||
|
||||
/* Avoid that const */
|
||||
ns = talloc_strdup(mem_ctx, nodestates);
|
||||
@ -169,7 +170,7 @@ static void ctdb_test_init(TALLOC_CTX *mem_ctx,
|
||||
nodemap->num = 0;
|
||||
tok = strtok(ns, ",");
|
||||
while (tok != NULL) {
|
||||
uint32_t n = nodemap->num;
|
||||
n = nodemap->num;
|
||||
nodemap->node = talloc_realloc(nodemap, nodemap->node,
|
||||
struct ctdb_node_and_flags, n+1);
|
||||
nodemap->node[n].pnn = n;
|
||||
@ -212,6 +213,14 @@ static void ctdb_test_init(TALLOC_CTX *mem_ctx,
|
||||
read_ips_for_multiple_nodes,
|
||||
&known, &avail);
|
||||
|
||||
/* Drop available IPs for INACTIVE/DISABLED nodes */
|
||||
for (n = 0; n < nodemap->num; n++) {
|
||||
uint32_t flags = nodemap->node[n].flags;
|
||||
if ((flags & (NODE_FLAGS_INACTIVE|NODE_FLAGS_DISABLED)) != 0) {
|
||||
avail[n].num = 0;
|
||||
}
|
||||
}
|
||||
|
||||
ipalloc_set_public_ips(*ipalloc_state, known, avail);
|
||||
|
||||
ipalloc_set_node_flags(*ipalloc_state, nodemap);
|
||||
|
@ -2630,7 +2630,9 @@ static void control_get_public_ips(TALLOC_CTX *mem_ctx,
|
||||
* no available IPs. Don't worry about interface
|
||||
* states here - we're not faking down to that level.
|
||||
*/
|
||||
if (ctdb->runstate != CTDB_RUNSTATE_RUNNING) {
|
||||
uint32_t flags = ctdb->node_map->node[header->destnode].flags;
|
||||
if (ctdb->runstate != CTDB_RUNSTATE_RUNNING ||
|
||||
((flags & (NODE_FLAGS_INACTIVE|NODE_FLAGS_DISABLED)) != 0)) {
|
||||
/* No available IPs: return dummy empty struct */
|
||||
ips = talloc_zero(mem_ctx, struct ctdb_public_ip_list);;
|
||||
if (ips == NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user