1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

ctdb-tests: Add public IP state to fake_ctdbd

Read it via a PUBLICIPS section.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2016-12-03 17:11:25 +11:00 committed by Amitay Isaacs
parent 16abc2071b
commit b993771ab0
2 changed files with 21 additions and 1 deletions

View File

@ -40,6 +40,8 @@
#include "common/logging.h"
#include "common/tunable.h"
#include "ipalloc_read_known_ips.h"
#define CTDB_PORT 4379
@ -114,6 +116,7 @@ struct ctdbd_context {
struct ctdb_tunable_list tun_list;
int monitoring_mode;
char *reclock;
struct ctdb_public_ip_list *known_ips;
};
/*
@ -704,6 +707,19 @@ static struct database *database_find(struct database_map *map,
return NULL;
}
static bool public_ips_parse(struct ctdbd_context *ctdb,
uint32_t numnodes)
{
if (numnodes == 0) {
D_ERR("Must initialise nodemap before public IPs\n");
return false;
}
ctdb->known_ips = ipalloc_read_known_ips(ctdb, numnodes, false);
return (ctdb->known_ips != NULL);
}
/*
* CTDB context setup
*/
@ -769,6 +785,9 @@ static struct ctdbd_context *ctdbd_setup(TALLOC_CTX *mem_ctx)
status = vnnmap_parse(ctdb->vnn_map);
} else if (strcmp(line, "DBMAP") == 0) {
status = dbmap_parse(ctdb->db_map);
} else if (strcmp(line, "PUBLICIPS") == 0) {
status = public_ips_parse(ctdb,
ctdb->node_map->num_nodes);
} else if (strcmp(line, "RECLOCK") == 0) {
status = reclock_parse(ctdb);
} else {

View File

@ -808,7 +808,8 @@ def build(bld):
install_path='${CTDB_TEST_LIBEXECDIR}')
bld.SAMBA_BINARY('fake_ctdbd',
source='tests/src/fake_ctdbd.c',
source='''tests/src/fake_ctdbd.c
tests/src/ipalloc_read_known_ips.c''',
deps='''ctdb-util ctdb-protocol ctdb-system
samba-util tevent-util LIBASYNC_REQ popt''',
install_path='${CTDB_TEST_LIBEXECDIR}')