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

tools/ctdb: Fix arguments/semantics of rebalance node

There's no reason why specifying a node should be compulsory.  This is
a cluster-wide operation because it is implemented by the recovery
master so multiple nodes should not be specified using -n.  However,
the command should be able to specify multiple nodes so let it have
its own nodestring argument.

This change should be backward compatible with the old requirement of
specifying a single node via -n.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 0846c00597adb66bba8c9dbf63443d0c2f91a7d1)
This commit is contained in:
Martin Schwenke 2013-09-06 13:20:26 +10:00 committed by Amitay Isaacs
parent c484361076
commit 5f0d85d4db

View File

@ -1773,16 +1773,30 @@ static int rebalance_node(struct ctdb_context *ctdb, uint32_t pnn)
*/
static int control_rebalancenode(struct ctdb_context *ctdb, int argc, const char **argv)
{
switch (options.pnn) {
case CTDB_BROADCAST_ALL:
case CTDB_CURRENT_NODE:
DEBUG(DEBUG_ERR,("You must specify a node number with -n <pnn> for the node to rebalance\n"));
uint32_t *nodes;
uint32_t pnn_mode;
int i, ret;
assert_single_node_only();
if (argc > 1) {
usage();
}
/* Determine the nodes where IPs need to be reloaded */
if (!parse_nodestring(ctdb, argc == 1 ? argv[0] : NULL,
options.pnn, true, &nodes, &pnn_mode)) {
return -1;
}
return rebalance_node(ctdb, options.pnn);
}
for (i = 0; i < talloc_array_length(nodes); i++) {
if (!rebalance_node(ctdb, nodes[i])) {
ret = -1;
}
}
return ret;
}
static int rebalance_ip(struct ctdb_context *ctdb, ctdb_sock_addr *addr)
{