mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
ctdb-daemon: Rename struct ctdb_public_ip_list to public_ip_list
A private structure need not have ctdb_ prefix. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
parent
afc5d8a442
commit
2b76e58032
@ -1228,8 +1228,8 @@ int ctdb_set_single_public_ip(struct ctdb_context *ctdb,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ctdb_public_ip_list {
|
struct public_ip_list {
|
||||||
struct ctdb_public_ip_list *next;
|
struct public_ip_list *next;
|
||||||
uint32_t pnn;
|
uint32_t pnn;
|
||||||
ctdb_sock_addr addr;
|
ctdb_sock_addr addr;
|
||||||
};
|
};
|
||||||
@ -1237,9 +1237,8 @@ struct ctdb_public_ip_list {
|
|||||||
/* Given a physical node, return the number of
|
/* Given a physical node, return the number of
|
||||||
public addresses that is currently assigned to this node.
|
public addresses that is currently assigned to this node.
|
||||||
*/
|
*/
|
||||||
static int node_ip_coverage(struct ctdb_context *ctdb,
|
static int node_ip_coverage(struct ctdb_context *ctdb, int32_t pnn,
|
||||||
int32_t pnn,
|
struct public_ip_list *ips)
|
||||||
struct ctdb_public_ip_list *ips)
|
|
||||||
{
|
{
|
||||||
int num=0;
|
int num=0;
|
||||||
|
|
||||||
@ -1257,7 +1256,7 @@ static int node_ip_coverage(struct ctdb_context *ctdb,
|
|||||||
*/
|
*/
|
||||||
static bool can_node_host_ip(struct ctdb_context *ctdb, int32_t pnn,
|
static bool can_node_host_ip(struct ctdb_context *ctdb, int32_t pnn,
|
||||||
struct ctdb_ipflags ipflags,
|
struct ctdb_ipflags ipflags,
|
||||||
struct ctdb_public_ip_list *ip)
|
struct public_ip_list *ip)
|
||||||
{
|
{
|
||||||
struct ctdb_all_public_ips *public_ips;
|
struct ctdb_all_public_ips *public_ips;
|
||||||
int i;
|
int i;
|
||||||
@ -1284,7 +1283,7 @@ static bool can_node_host_ip(struct ctdb_context *ctdb, int32_t pnn,
|
|||||||
|
|
||||||
static bool can_node_takeover_ip(struct ctdb_context *ctdb, int32_t pnn,
|
static bool can_node_takeover_ip(struct ctdb_context *ctdb, int32_t pnn,
|
||||||
struct ctdb_ipflags ipflags,
|
struct ctdb_ipflags ipflags,
|
||||||
struct ctdb_public_ip_list *ip)
|
struct public_ip_list *ip)
|
||||||
{
|
{
|
||||||
if (ipflags.noiptakeover) {
|
if (ipflags.noiptakeover) {
|
||||||
return false;
|
return false;
|
||||||
@ -1299,8 +1298,8 @@ static bool can_node_takeover_ip(struct ctdb_context *ctdb, int32_t pnn,
|
|||||||
*/
|
*/
|
||||||
static int find_takeover_node(struct ctdb_context *ctdb,
|
static int find_takeover_node(struct ctdb_context *ctdb,
|
||||||
struct ctdb_ipflags *ipflags,
|
struct ctdb_ipflags *ipflags,
|
||||||
struct ctdb_public_ip_list *ip,
|
struct public_ip_list *ip,
|
||||||
struct ctdb_public_ip_list *all_ips)
|
struct public_ip_list *all_ips)
|
||||||
{
|
{
|
||||||
int pnn, min=0, num;
|
int pnn, min=0, num;
|
||||||
int i, numnodes;
|
int i, numnodes;
|
||||||
@ -1366,8 +1365,8 @@ static uint32_t *ip_key(ctdb_sock_addr *ip)
|
|||||||
|
|
||||||
static void *add_ip_callback(void *parm, void *data)
|
static void *add_ip_callback(void *parm, void *data)
|
||||||
{
|
{
|
||||||
struct ctdb_public_ip_list *this_ip = parm;
|
struct public_ip_list *this_ip = parm;
|
||||||
struct ctdb_public_ip_list *prev_ip = data;
|
struct public_ip_list *prev_ip = data;
|
||||||
|
|
||||||
if (prev_ip == NULL) {
|
if (prev_ip == NULL) {
|
||||||
return parm;
|
return parm;
|
||||||
@ -1381,19 +1380,19 @@ static void *add_ip_callback(void *parm, void *data)
|
|||||||
|
|
||||||
static int getips_count_callback(void *param, void *data)
|
static int getips_count_callback(void *param, void *data)
|
||||||
{
|
{
|
||||||
struct ctdb_public_ip_list **ip_list = (struct ctdb_public_ip_list **)param;
|
struct public_ip_list **ip_list = (struct public_ip_list **)param;
|
||||||
struct ctdb_public_ip_list *new_ip = (struct ctdb_public_ip_list *)data;
|
struct public_ip_list *new_ip = (struct public_ip_list *)data;
|
||||||
|
|
||||||
new_ip->next = *ip_list;
|
new_ip->next = *ip_list;
|
||||||
*ip_list = new_ip;
|
*ip_list = new_ip;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ctdb_public_ip_list *
|
static struct public_ip_list *
|
||||||
create_merged_ip_list(struct ctdb_context *ctdb)
|
create_merged_ip_list(struct ctdb_context *ctdb)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
struct ctdb_public_ip_list *ip_list;
|
struct public_ip_list *ip_list;
|
||||||
struct ctdb_all_public_ips *public_ips;
|
struct ctdb_all_public_ips *public_ips;
|
||||||
|
|
||||||
if (ctdb->ip_tree != NULL) {
|
if (ctdb->ip_tree != NULL) {
|
||||||
@ -1415,9 +1414,9 @@ create_merged_ip_list(struct ctdb_context *ctdb)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (j=0;j<public_ips->num;j++) {
|
for (j=0;j<public_ips->num;j++) {
|
||||||
struct ctdb_public_ip_list *tmp_ip;
|
struct public_ip_list *tmp_ip;
|
||||||
|
|
||||||
tmp_ip = talloc_zero(ctdb->ip_tree, struct ctdb_public_ip_list);
|
tmp_ip = talloc_zero(ctdb->ip_tree, struct public_ip_list);
|
||||||
CTDB_NO_MEMORY_NULL(ctdb, tmp_ip);
|
CTDB_NO_MEMORY_NULL(ctdb, tmp_ip);
|
||||||
/* Do not use information about IP addresses hosted
|
/* Do not use information about IP addresses hosted
|
||||||
* on other nodes, it may not be accurate */
|
* on other nodes, it may not be accurate */
|
||||||
@ -1486,10 +1485,10 @@ static uint32_t ip_distance(ctdb_sock_addr *ip1, ctdb_sock_addr *ip2)
|
|||||||
used in the main part of the algorithm.
|
used in the main part of the algorithm.
|
||||||
*/
|
*/
|
||||||
static uint32_t ip_distance_2_sum(ctdb_sock_addr *ip,
|
static uint32_t ip_distance_2_sum(ctdb_sock_addr *ip,
|
||||||
struct ctdb_public_ip_list *ips,
|
struct public_ip_list *ips,
|
||||||
int pnn)
|
int pnn)
|
||||||
{
|
{
|
||||||
struct ctdb_public_ip_list *t;
|
struct public_ip_list *t;
|
||||||
uint32_t d;
|
uint32_t d;
|
||||||
|
|
||||||
uint32_t sum = 0;
|
uint32_t sum = 0;
|
||||||
@ -1522,9 +1521,9 @@ static uint32_t ip_distance_2_sum(ctdb_sock_addr *ip,
|
|||||||
/* Return the LCP2 imbalance metric for addresses currently assigned
|
/* Return the LCP2 imbalance metric for addresses currently assigned
|
||||||
to the given node.
|
to the given node.
|
||||||
*/
|
*/
|
||||||
static uint32_t lcp2_imbalance(struct ctdb_public_ip_list * all_ips, int pnn)
|
static uint32_t lcp2_imbalance(struct public_ip_list * all_ips, int pnn)
|
||||||
{
|
{
|
||||||
struct ctdb_public_ip_list *t;
|
struct public_ip_list *t;
|
||||||
|
|
||||||
uint32_t imbalance = 0;
|
uint32_t imbalance = 0;
|
||||||
|
|
||||||
@ -1546,9 +1545,9 @@ static uint32_t lcp2_imbalance(struct ctdb_public_ip_list * all_ips, int pnn)
|
|||||||
*/
|
*/
|
||||||
static void basic_allocate_unassigned(struct ctdb_context *ctdb,
|
static void basic_allocate_unassigned(struct ctdb_context *ctdb,
|
||||||
struct ctdb_ipflags *ipflags,
|
struct ctdb_ipflags *ipflags,
|
||||||
struct ctdb_public_ip_list *all_ips)
|
struct public_ip_list *all_ips)
|
||||||
{
|
{
|
||||||
struct ctdb_public_ip_list *tmp_ip;
|
struct public_ip_list *tmp_ip;
|
||||||
|
|
||||||
/* loop over all ip's and find a physical node to cover for
|
/* loop over all ip's and find a physical node to cover for
|
||||||
each unassigned ip.
|
each unassigned ip.
|
||||||
@ -1567,12 +1566,12 @@ static void basic_allocate_unassigned(struct ctdb_context *ctdb,
|
|||||||
*/
|
*/
|
||||||
static void basic_failback(struct ctdb_context *ctdb,
|
static void basic_failback(struct ctdb_context *ctdb,
|
||||||
struct ctdb_ipflags *ipflags,
|
struct ctdb_ipflags *ipflags,
|
||||||
struct ctdb_public_ip_list *all_ips,
|
struct public_ip_list *all_ips,
|
||||||
int num_ips)
|
int num_ips)
|
||||||
{
|
{
|
||||||
int i, numnodes;
|
int i, numnodes;
|
||||||
int maxnode, maxnum, minnode, minnum, num, retries;
|
int maxnode, maxnum, minnode, minnum, num, retries;
|
||||||
struct ctdb_public_ip_list *tmp_ip;
|
struct public_ip_list *tmp_ip;
|
||||||
|
|
||||||
numnodes = talloc_array_length(ipflags);
|
numnodes = talloc_array_length(ipflags);
|
||||||
retries = 0;
|
retries = 0;
|
||||||
@ -1638,7 +1637,7 @@ try_again:
|
|||||||
*/
|
*/
|
||||||
if ( (maxnum > minnum+1)
|
if ( (maxnum > minnum+1)
|
||||||
&& (retries < (num_ips + 5)) ){
|
&& (retries < (num_ips + 5)) ){
|
||||||
struct ctdb_public_ip_list *tmp;
|
struct public_ip_list *tmp;
|
||||||
|
|
||||||
/* Reassign one of maxnode's VNNs */
|
/* Reassign one of maxnode's VNNs */
|
||||||
for (tmp=all_ips;tmp;tmp=tmp->next) {
|
for (tmp=all_ips;tmp;tmp=tmp->next) {
|
||||||
@ -1654,13 +1653,13 @@ try_again:
|
|||||||
|
|
||||||
static void lcp2_init(struct ctdb_context *tmp_ctx,
|
static void lcp2_init(struct ctdb_context *tmp_ctx,
|
||||||
struct ctdb_ipflags *ipflags,
|
struct ctdb_ipflags *ipflags,
|
||||||
struct ctdb_public_ip_list *all_ips,
|
struct public_ip_list *all_ips,
|
||||||
uint32_t *force_rebalance_nodes,
|
uint32_t *force_rebalance_nodes,
|
||||||
uint32_t **lcp2_imbalances,
|
uint32_t **lcp2_imbalances,
|
||||||
bool **rebalance_candidates)
|
bool **rebalance_candidates)
|
||||||
{
|
{
|
||||||
int i, numnodes;
|
int i, numnodes;
|
||||||
struct ctdb_public_ip_list *tmp_ip;
|
struct public_ip_list *tmp_ip;
|
||||||
|
|
||||||
numnodes = talloc_array_length(ipflags);
|
numnodes = talloc_array_length(ipflags);
|
||||||
|
|
||||||
@ -1712,15 +1711,15 @@ static void lcp2_init(struct ctdb_context *tmp_ctx,
|
|||||||
*/
|
*/
|
||||||
static void lcp2_allocate_unassigned(struct ctdb_context *ctdb,
|
static void lcp2_allocate_unassigned(struct ctdb_context *ctdb,
|
||||||
struct ctdb_ipflags *ipflags,
|
struct ctdb_ipflags *ipflags,
|
||||||
struct ctdb_public_ip_list *all_ips,
|
struct public_ip_list *all_ips,
|
||||||
uint32_t *lcp2_imbalances)
|
uint32_t *lcp2_imbalances)
|
||||||
{
|
{
|
||||||
struct ctdb_public_ip_list *tmp_ip;
|
struct public_ip_list *tmp_ip;
|
||||||
int dstnode, numnodes;
|
int dstnode, numnodes;
|
||||||
|
|
||||||
int minnode;
|
int minnode;
|
||||||
uint32_t mindsum, dstdsum, dstimbl, minimbl;
|
uint32_t mindsum, dstdsum, dstimbl, minimbl;
|
||||||
struct ctdb_public_ip_list *minip;
|
struct public_ip_list *minip;
|
||||||
|
|
||||||
bool should_loop = true;
|
bool should_loop = true;
|
||||||
bool have_unassigned = true;
|
bool have_unassigned = true;
|
||||||
@ -1810,7 +1809,7 @@ static void lcp2_allocate_unassigned(struct ctdb_context *ctdb,
|
|||||||
*/
|
*/
|
||||||
static bool lcp2_failback_candidate(struct ctdb_context *ctdb,
|
static bool lcp2_failback_candidate(struct ctdb_context *ctdb,
|
||||||
struct ctdb_ipflags *ipflags,
|
struct ctdb_ipflags *ipflags,
|
||||||
struct ctdb_public_ip_list *all_ips,
|
struct public_ip_list *all_ips,
|
||||||
int srcnode,
|
int srcnode,
|
||||||
uint32_t *lcp2_imbalances,
|
uint32_t *lcp2_imbalances,
|
||||||
bool *rebalance_candidates)
|
bool *rebalance_candidates)
|
||||||
@ -1818,8 +1817,8 @@ static bool lcp2_failback_candidate(struct ctdb_context *ctdb,
|
|||||||
int dstnode, mindstnode, numnodes;
|
int dstnode, mindstnode, numnodes;
|
||||||
uint32_t srcimbl, srcdsum, dstimbl, dstdsum;
|
uint32_t srcimbl, srcdsum, dstimbl, dstdsum;
|
||||||
uint32_t minsrcimbl, mindstimbl;
|
uint32_t minsrcimbl, mindstimbl;
|
||||||
struct ctdb_public_ip_list *minip;
|
struct public_ip_list *minip;
|
||||||
struct ctdb_public_ip_list *tmp_ip;
|
struct public_ip_list *tmp_ip;
|
||||||
|
|
||||||
/* Find an IP and destination node that best reduces imbalance. */
|
/* Find an IP and destination node that best reduces imbalance. */
|
||||||
srcimbl = 0;
|
srcimbl = 0;
|
||||||
@ -1927,7 +1926,7 @@ static int lcp2_cmp_imbalance_pnn(const void * a, const void * b)
|
|||||||
*/
|
*/
|
||||||
static void lcp2_failback(struct ctdb_context *ctdb,
|
static void lcp2_failback(struct ctdb_context *ctdb,
|
||||||
struct ctdb_ipflags *ipflags,
|
struct ctdb_ipflags *ipflags,
|
||||||
struct ctdb_public_ip_list *all_ips,
|
struct public_ip_list *all_ips,
|
||||||
uint32_t *lcp2_imbalances,
|
uint32_t *lcp2_imbalances,
|
||||||
bool *rebalance_candidates)
|
bool *rebalance_candidates)
|
||||||
{
|
{
|
||||||
@ -1981,9 +1980,9 @@ try_again:
|
|||||||
|
|
||||||
static void unassign_unsuitable_ips(struct ctdb_context *ctdb,
|
static void unassign_unsuitable_ips(struct ctdb_context *ctdb,
|
||||||
struct ctdb_ipflags *ipflags,
|
struct ctdb_ipflags *ipflags,
|
||||||
struct ctdb_public_ip_list *all_ips)
|
struct public_ip_list *all_ips)
|
||||||
{
|
{
|
||||||
struct ctdb_public_ip_list *tmp_ip;
|
struct public_ip_list *tmp_ip;
|
||||||
|
|
||||||
/* verify that the assigned nodes can serve that public ip
|
/* verify that the assigned nodes can serve that public ip
|
||||||
and set it to -1 if not
|
and set it to -1 if not
|
||||||
@ -2005,9 +2004,9 @@ static void unassign_unsuitable_ips(struct ctdb_context *ctdb,
|
|||||||
|
|
||||||
static void ip_alloc_deterministic_ips(struct ctdb_context *ctdb,
|
static void ip_alloc_deterministic_ips(struct ctdb_context *ctdb,
|
||||||
struct ctdb_ipflags *ipflags,
|
struct ctdb_ipflags *ipflags,
|
||||||
struct ctdb_public_ip_list *all_ips)
|
struct public_ip_list *all_ips)
|
||||||
{
|
{
|
||||||
struct ctdb_public_ip_list *tmp_ip;
|
struct public_ip_list *tmp_ip;
|
||||||
int i, numnodes;
|
int i, numnodes;
|
||||||
|
|
||||||
numnodes = talloc_array_length(ipflags);
|
numnodes = talloc_array_length(ipflags);
|
||||||
@ -2039,10 +2038,10 @@ static void ip_alloc_deterministic_ips(struct ctdb_context *ctdb,
|
|||||||
|
|
||||||
static void ip_alloc_nondeterministic_ips(struct ctdb_context *ctdb,
|
static void ip_alloc_nondeterministic_ips(struct ctdb_context *ctdb,
|
||||||
struct ctdb_ipflags *ipflags,
|
struct ctdb_ipflags *ipflags,
|
||||||
struct ctdb_public_ip_list *all_ips)
|
struct public_ip_list *all_ips)
|
||||||
{
|
{
|
||||||
/* This should be pushed down into basic_failback. */
|
/* This should be pushed down into basic_failback. */
|
||||||
struct ctdb_public_ip_list *tmp_ip;
|
struct public_ip_list *tmp_ip;
|
||||||
int num_ips = 0;
|
int num_ips = 0;
|
||||||
for (tmp_ip=all_ips;tmp_ip;tmp_ip=tmp_ip->next) {
|
for (tmp_ip=all_ips;tmp_ip;tmp_ip=tmp_ip->next) {
|
||||||
num_ips++;
|
num_ips++;
|
||||||
@ -2065,7 +2064,7 @@ static void ip_alloc_nondeterministic_ips(struct ctdb_context *ctdb,
|
|||||||
|
|
||||||
static void ip_alloc_lcp2(struct ctdb_context *ctdb,
|
static void ip_alloc_lcp2(struct ctdb_context *ctdb,
|
||||||
struct ctdb_ipflags *ipflags,
|
struct ctdb_ipflags *ipflags,
|
||||||
struct ctdb_public_ip_list *all_ips,
|
struct public_ip_list *all_ips,
|
||||||
uint32_t *force_rebalance_nodes)
|
uint32_t *force_rebalance_nodes)
|
||||||
{
|
{
|
||||||
uint32_t *lcp2_imbalances;
|
uint32_t *lcp2_imbalances;
|
||||||
@ -2128,7 +2127,7 @@ static bool all_nodes_are_disabled(struct ctdb_node_map_old *nodemap)
|
|||||||
/* The calculation part of the IP allocation algorithm. */
|
/* The calculation part of the IP allocation algorithm. */
|
||||||
static void ctdb_takeover_run_core(struct ctdb_context *ctdb,
|
static void ctdb_takeover_run_core(struct ctdb_context *ctdb,
|
||||||
struct ctdb_ipflags *ipflags,
|
struct ctdb_ipflags *ipflags,
|
||||||
struct ctdb_public_ip_list **all_ips_p,
|
struct public_ip_list **all_ips_p,
|
||||||
uint32_t *force_rebalance_nodes)
|
uint32_t *force_rebalance_nodes)
|
||||||
{
|
{
|
||||||
/* since nodes only know about those public addresses that
|
/* since nodes only know about those public addresses that
|
||||||
@ -2579,7 +2578,7 @@ int ctdb_takeover_run(struct ctdb_context *ctdb, struct ctdb_node_map_old *nodem
|
|||||||
int i, j, ret;
|
int i, j, ret;
|
||||||
struct ctdb_public_ip ip;
|
struct ctdb_public_ip ip;
|
||||||
uint32_t *nodes;
|
uint32_t *nodes;
|
||||||
struct ctdb_public_ip_list *all_ips, *tmp_ip;
|
struct public_ip_list *all_ips, *tmp_ip;
|
||||||
TDB_DATA data;
|
TDB_DATA data;
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
struct client_async_data *async_data;
|
struct client_async_data *async_data;
|
||||||
@ -4229,7 +4228,7 @@ int verify_remote_ip_allocation(struct ctdb_context *ctdb,
|
|||||||
struct ctdb_all_public_ips *ips,
|
struct ctdb_all_public_ips *ips,
|
||||||
uint32_t pnn)
|
uint32_t pnn)
|
||||||
{
|
{
|
||||||
struct ctdb_public_ip_list *tmp_ip;
|
struct public_ip_list *tmp_ip;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (ctdb->ip_tree == NULL) {
|
if (ctdb->ip_tree == NULL) {
|
||||||
@ -4268,7 +4267,7 @@ int verify_remote_ip_allocation(struct ctdb_context *ctdb,
|
|||||||
|
|
||||||
int update_ip_assignment_tree(struct ctdb_context *ctdb, struct ctdb_public_ip *ip)
|
int update_ip_assignment_tree(struct ctdb_context *ctdb, struct ctdb_public_ip *ip)
|
||||||
{
|
{
|
||||||
struct ctdb_public_ip_list *tmp_ip;
|
struct public_ip_list *tmp_ip;
|
||||||
|
|
||||||
/* IP tree is never built if DisableIPFailover is set */
|
/* IP tree is never built if DisableIPFailover is set */
|
||||||
if (ctdb->tunable.disable_ip_failover != 0) {
|
if (ctdb->tunable.disable_ip_failover != 0) {
|
||||||
|
@ -26,16 +26,16 @@
|
|||||||
/* Format of each line is "IP pnn" - the separator has to be at least
|
/* Format of each line is "IP pnn" - the separator has to be at least
|
||||||
* 1 space (not a tab or whatever - a space!).
|
* 1 space (not a tab or whatever - a space!).
|
||||||
*/
|
*/
|
||||||
static struct ctdb_public_ip_list *
|
static struct public_ip_list *
|
||||||
read_ctdb_public_ip_list(TALLOC_CTX *ctx)
|
read_ctdb_public_ip_list(TALLOC_CTX *ctx)
|
||||||
{
|
{
|
||||||
char line[1024];
|
char line[1024];
|
||||||
ctdb_sock_addr addr;
|
ctdb_sock_addr addr;
|
||||||
char *t;
|
char *t;
|
||||||
int pnn;
|
int pnn;
|
||||||
struct ctdb_public_ip_list *last = NULL;
|
struct public_ip_list *last = NULL;
|
||||||
|
|
||||||
struct ctdb_public_ip_list *ret = NULL;
|
struct public_ip_list *ret = NULL;
|
||||||
|
|
||||||
while (fgets(line, sizeof(line), stdin) != NULL) {
|
while (fgets(line, sizeof(line), stdin) != NULL) {
|
||||||
|
|
||||||
@ -55,9 +55,9 @@ read_ctdb_public_ip_list(TALLOC_CTX *ctx)
|
|||||||
|
|
||||||
if (parse_ip(line, NULL, 0, &addr)) {
|
if (parse_ip(line, NULL, 0, &addr)) {
|
||||||
if (last == NULL) {
|
if (last == NULL) {
|
||||||
last = talloc(ctx, struct ctdb_public_ip_list);
|
last = talloc(ctx, struct public_ip_list);
|
||||||
} else {
|
} else {
|
||||||
last->next = talloc(ctx, struct ctdb_public_ip_list);
|
last->next = talloc(ctx, struct public_ip_list);
|
||||||
last = last->next;
|
last = last->next;
|
||||||
}
|
}
|
||||||
last->next = NULL;
|
last->next = NULL;
|
||||||
@ -74,7 +74,7 @@ read_ctdb_public_ip_list(TALLOC_CTX *ctx)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_ctdb_public_ip_list(struct ctdb_public_ip_list * ips)
|
static void print_ctdb_public_ip_list(struct public_ip_list * ips)
|
||||||
{
|
{
|
||||||
while (ips) {
|
while (ips) {
|
||||||
printf("%s %d\n", ctdb_addr_to_str(&(ips->addr)), ips->pnn);
|
printf("%s %d\n", ctdb_addr_to_str(&(ips->addr)), ips->pnn);
|
||||||
@ -86,7 +86,7 @@ static void print_ctdb_public_ip_list(struct ctdb_public_ip_list * ips)
|
|||||||
* them back out. */
|
* them back out. */
|
||||||
static void ctdb_test_read_ctdb_public_ip_list(void)
|
static void ctdb_test_read_ctdb_public_ip_list(void)
|
||||||
{
|
{
|
||||||
struct ctdb_public_ip_list *l;
|
struct public_ip_list *l;
|
||||||
|
|
||||||
TALLOC_CTX *tmp_ctx = talloc_new(NULL);
|
TALLOC_CTX *tmp_ctx = talloc_new(NULL);
|
||||||
|
|
||||||
@ -102,17 +102,17 @@ static void ctdb_test_read_ctdb_public_ip_list(void)
|
|||||||
static bool
|
static bool
|
||||||
read_ctdb_public_ip_info(TALLOC_CTX *ctx,
|
read_ctdb_public_ip_info(TALLOC_CTX *ctx,
|
||||||
int numnodes,
|
int numnodes,
|
||||||
struct ctdb_public_ip_list ** all_ips,
|
struct public_ip_list ** all_ips,
|
||||||
struct ctdb_all_public_ips *** avail)
|
struct ctdb_all_public_ips *** avail)
|
||||||
{
|
{
|
||||||
char line[1024];
|
char line[1024];
|
||||||
ctdb_sock_addr addr;
|
ctdb_sock_addr addr;
|
||||||
char *t, *tok;
|
char *t, *tok;
|
||||||
struct ctdb_public_ip_list * ta;
|
struct public_ip_list * ta;
|
||||||
int pnn, numips, curr, n, i;
|
int pnn, numips, curr, n, i;
|
||||||
struct ctdb_all_public_ips * a;
|
struct ctdb_all_public_ips * a;
|
||||||
|
|
||||||
struct ctdb_public_ip_list *last = NULL;
|
struct public_ip_list *last = NULL;
|
||||||
|
|
||||||
*avail = talloc_array_size(ctx, sizeof(struct ctdb_all_public_ips *), CTDB_TEST_MAX_NODES);
|
*avail = talloc_array_size(ctx, sizeof(struct ctdb_all_public_ips *), CTDB_TEST_MAX_NODES);
|
||||||
memset(*avail, 0,
|
memset(*avail, 0,
|
||||||
@ -159,9 +159,9 @@ read_ctdb_public_ip_info(TALLOC_CTX *ctx,
|
|||||||
|
|
||||||
/* Add address + pnn to all_ips */
|
/* Add address + pnn to all_ips */
|
||||||
if (last == NULL) {
|
if (last == NULL) {
|
||||||
last = talloc(ctx, struct ctdb_public_ip_list);
|
last = talloc(ctx, struct public_ip_list);
|
||||||
} else {
|
} else {
|
||||||
last->next = talloc(ctx, struct ctdb_public_ip_list);
|
last->next = talloc(ctx, struct public_ip_list);
|
||||||
last = last->next;
|
last = last->next;
|
||||||
}
|
}
|
||||||
last->next = NULL;
|
last->next = NULL;
|
||||||
@ -233,7 +233,7 @@ static void print_ctdb_available_ips(int numnodes,
|
|||||||
static void ctdb_test_read_ctdb_public_ip_info(const char nodestates[])
|
static void ctdb_test_read_ctdb_public_ip_info(const char nodestates[])
|
||||||
{
|
{
|
||||||
int numnodes;
|
int numnodes;
|
||||||
struct ctdb_public_ip_list *l;
|
struct public_ip_list *l;
|
||||||
struct ctdb_all_public_ips **avail;
|
struct ctdb_all_public_ips **avail;
|
||||||
char *tok, *ns;
|
char *tok, *ns;
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ static void ctdb_test_read_ctdb_public_ip_info(const char nodestates[])
|
|||||||
/* Read 2 IPs from stdin, calculate the IP distance and print it. */
|
/* Read 2 IPs from stdin, calculate the IP distance and print it. */
|
||||||
static void ctdb_test_ip_distance(void)
|
static void ctdb_test_ip_distance(void)
|
||||||
{
|
{
|
||||||
struct ctdb_public_ip_list *l;
|
struct public_ip_list *l;
|
||||||
uint32_t distance;
|
uint32_t distance;
|
||||||
|
|
||||||
TALLOC_CTX *tmp_ctx = talloc_new(NULL);
|
TALLOC_CTX *tmp_ctx = talloc_new(NULL);
|
||||||
@ -284,8 +284,8 @@ static void ctdb_test_ip_distance(void)
|
|||||||
* the given node. The given IP must one of the ones in the list. */
|
* the given node. The given IP must one of the ones in the list. */
|
||||||
static void ctdb_test_ip_distance_2_sum(const char ip[], int pnn)
|
static void ctdb_test_ip_distance_2_sum(const char ip[], int pnn)
|
||||||
{
|
{
|
||||||
struct ctdb_public_ip_list *l;
|
struct public_ip_list *l;
|
||||||
struct ctdb_public_ip_list *t;
|
struct public_ip_list *t;
|
||||||
ctdb_sock_addr addr;
|
ctdb_sock_addr addr;
|
||||||
uint32_t distance;
|
uint32_t distance;
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ static void ctdb_test_ip_distance_2_sum(const char ip[], int pnn)
|
|||||||
* IP distances between the first and the rest, and print it. */
|
* IP distances between the first and the rest, and print it. */
|
||||||
static void ctdb_test_lcp2_imbalance(int pnn)
|
static void ctdb_test_lcp2_imbalance(int pnn)
|
||||||
{
|
{
|
||||||
struct ctdb_public_ip_list *l;
|
struct public_ip_list *l;
|
||||||
uint32_t imbalance;
|
uint32_t imbalance;
|
||||||
|
|
||||||
TALLOC_CTX *tmp_ctx = talloc_new(NULL);
|
TALLOC_CTX *tmp_ctx = talloc_new(NULL);
|
||||||
@ -408,7 +408,7 @@ static enum ctdb_runstate *get_runstate(TALLOC_CTX *tmp_ctx,
|
|||||||
*/
|
*/
|
||||||
static void ctdb_test_init(const char nodestates[],
|
static void ctdb_test_init(const char nodestates[],
|
||||||
struct ctdb_context **ctdb,
|
struct ctdb_context **ctdb,
|
||||||
struct ctdb_public_ip_list **all_ips,
|
struct public_ip_list **all_ips,
|
||||||
struct ctdb_ipflags **ipflags,
|
struct ctdb_ipflags **ipflags,
|
||||||
bool read_ips_for_multiple_nodes)
|
bool read_ips_for_multiple_nodes)
|
||||||
{
|
{
|
||||||
@ -505,7 +505,7 @@ static void ctdb_test_init(const char nodestates[],
|
|||||||
static void ctdb_test_lcp2_allocate_unassigned(const char nodestates[])
|
static void ctdb_test_lcp2_allocate_unassigned(const char nodestates[])
|
||||||
{
|
{
|
||||||
struct ctdb_context *ctdb;
|
struct ctdb_context *ctdb;
|
||||||
struct ctdb_public_ip_list *all_ips;
|
struct public_ip_list *all_ips;
|
||||||
struct ctdb_ipflags *ipflags;
|
struct ctdb_ipflags *ipflags;
|
||||||
|
|
||||||
uint32_t *lcp2_imbalances;
|
uint32_t *lcp2_imbalances;
|
||||||
@ -528,7 +528,7 @@ static void ctdb_test_lcp2_allocate_unassigned(const char nodestates[])
|
|||||||
static void ctdb_test_lcp2_failback(const char nodestates[])
|
static void ctdb_test_lcp2_failback(const char nodestates[])
|
||||||
{
|
{
|
||||||
struct ctdb_context *ctdb;
|
struct ctdb_context *ctdb;
|
||||||
struct ctdb_public_ip_list *all_ips;
|
struct public_ip_list *all_ips;
|
||||||
struct ctdb_ipflags *ipflags;
|
struct ctdb_ipflags *ipflags;
|
||||||
|
|
||||||
uint32_t *lcp2_imbalances;
|
uint32_t *lcp2_imbalances;
|
||||||
@ -551,7 +551,7 @@ static void ctdb_test_lcp2_failback(const char nodestates[])
|
|||||||
static void ctdb_test_lcp2_failback_loop(const char nodestates[])
|
static void ctdb_test_lcp2_failback_loop(const char nodestates[])
|
||||||
{
|
{
|
||||||
struct ctdb_context *ctdb;
|
struct ctdb_context *ctdb;
|
||||||
struct ctdb_public_ip_list *all_ips;
|
struct public_ip_list *all_ips;
|
||||||
struct ctdb_ipflags *ipflags;
|
struct ctdb_ipflags *ipflags;
|
||||||
|
|
||||||
uint32_t *lcp2_imbalances;
|
uint32_t *lcp2_imbalances;
|
||||||
@ -577,7 +577,7 @@ static void ctdb_test_ctdb_takeover_run_core(const char nodestates[],
|
|||||||
bool read_ips_for_multiple_nodes)
|
bool read_ips_for_multiple_nodes)
|
||||||
{
|
{
|
||||||
struct ctdb_context *ctdb;
|
struct ctdb_context *ctdb;
|
||||||
struct ctdb_public_ip_list *all_ips;
|
struct public_ip_list *all_ips;
|
||||||
struct ctdb_ipflags *ipflags;
|
struct ctdb_ipflags *ipflags;
|
||||||
|
|
||||||
ctdb_test_init(nodestates, &ctdb, &all_ips, &ipflags,
|
ctdb_test_init(nodestates, &ctdb, &all_ips, &ipflags,
|
||||||
|
Loading…
Reference in New Issue
Block a user