1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

add a new function to collect a list of all active nodes EXCEPT a certain node

(This used to be ctdb commit be52954d921e7d443304cf49fbd488c619a9c4ec)
This commit is contained in:
Ronnie Sahlberg 2009-10-06 10:52:31 +11:00
parent 3133dadd8f
commit 71e4259150
2 changed files with 38 additions and 0 deletions

View File

@ -2975,6 +2975,40 @@ uint32_t *list_of_active_nodes(struct ctdb_context *ctdb,
return nodes; return nodes;
} }
uint32_t *list_of_active_nodes_except_pnn(struct ctdb_context *ctdb,
struct ctdb_node_map *node_map,
TALLOC_CTX *mem_ctx,
uint32_t pnn)
{
int i, j, num_nodes;
uint32_t *nodes;
for (i=num_nodes=0;i<node_map->num;i++) {
if (node_map->nodes[i].flags & NODE_FLAGS_INACTIVE) {
continue;
}
if (node_map->nodes[i].pnn == pnn) {
continue;
}
num_nodes++;
}
nodes = talloc_array(mem_ctx, uint32_t, num_nodes);
CTDB_NO_MEMORY_FATAL(ctdb, nodes);
for (i=j=0;i<node_map->num;i++) {
if (node_map->nodes[i].flags & NODE_FLAGS_INACTIVE) {
continue;
}
if (node_map->nodes[i].pnn == pnn) {
continue;
}
nodes[j++] = node_map->nodes[i].pnn;
}
return nodes;
}
uint32_t *list_of_connected_nodes(struct ctdb_context *ctdb, uint32_t *list_of_connected_nodes(struct ctdb_context *ctdb,
struct ctdb_node_map *node_map, struct ctdb_node_map *node_map,
TALLOC_CTX *mem_ctx, TALLOC_CTX *mem_ctx,

View File

@ -581,6 +581,10 @@ uint32_t *list_of_vnnmap_nodes(struct ctdb_context *ctdb,
struct ctdb_vnn_map *vnn_map, struct ctdb_vnn_map *vnn_map,
TALLOC_CTX *mem_ctx, TALLOC_CTX *mem_ctx,
bool include_self); bool include_self);
uint32_t *list_of_active_nodes_except_pnn(struct ctdb_context *ctdb,
struct ctdb_node_map *node_map,
TALLOC_CTX *mem_ctx,
uint32_t pnn);
int ctdb_read_pnn_lock(int fd, int32_t pnn); int ctdb_read_pnn_lock(int fd, int32_t pnn);