summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2011-12-06 19:50:40 +1100
committerMartin Schwenke <martin@meltin.net>2012-02-06 16:00:23 +1100
commitbfab62dd410f163cca313c0271a00980afbbc391 (patch)
tree5b21c1099b159ed1e80b39921dc2e2a3eb215bf7
parente3b85bba3fe2a6ff1e4aa258a4ba1f6b17facc9f (diff)
downloadsamba-bfab62dd410f163cca313c0271a00980afbbc391.tar.gz
samba-bfab62dd410f163cca313c0271a00980afbbc391.tar.xz
samba-bfab62dd410f163cca313c0271a00980afbbc391.zip
ctdb tool - Fix parse_nodestring() related issues
An old, buggy version of this code was merged. This fixes it. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit bc4d5d5f0048487776f9f5d9f04a0af2e5d45aac)
-rw-r--r--ctdb/tools/ctdb.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c
index 40abb5c810..0e309552f4 100644
--- a/ctdb/tools/ctdb.c
+++ b/ctdb/tools/ctdb.c
@@ -119,6 +119,7 @@ static const char *pretty_print_flags(uint32_t flags)
*/
static bool parse_nodestring(struct ctdb_context *ctdb,
const char * nodestring,
+ uint32_t current_pnn,
bool dd_ok,
uint32_t **nodes,
uint32_t *pnn_mode)
@@ -201,8 +202,9 @@ static bool parse_nodestring(struct ctdb_context *ctdb,
/* default - no nodes specified */
*nodes = talloc_array(ctdb, uint32_t, 1);
CTDB_NOMEM_ABORT(*nodes);
+ *pnn_mode = CTDB_CURRENT_NODE;
- if (!ctdb_getpnn(ctdb_connection, CTDB_CURRENT_NODE,
+ if (!ctdb_getpnn(ctdb_connection, current_pnn,
&((*nodes)[0]))) {
return false;
}
@@ -847,8 +849,8 @@ static int control_nodestatus(struct ctdb_context *ctdb, int argc, const char **
usage();
}
- if (!parse_nodestring(ctdb, argc == 1 ? argv[0] : NULL, false,
- &nodes, &pnn_mode)) {
+ if (!parse_nodestring(ctdb, argc == 1 ? argv[0] : NULL,
+ options.pnn, true, &nodes, &pnn_mode)) {
return -1;
}
@@ -864,11 +866,13 @@ static int control_nodestatus(struct ctdb_context *ctdb, int argc, const char **
return -1;
}
- if (!ctdb_getnodemap(ctdb_connection, CTDB_CURRENT_NODE, &nodemap)) {
- DEBUG(DEBUG_ERR, ("Unable to get nodemap from local node\n"));
+ if (!ctdb_getnodemap(ctdb_connection, options.pnn, &nodemap)) {
+ DEBUG(DEBUG_ERR, ("Unable to get nodemap from node %u\n", options.pnn));
return -1;
}
+ ret = 0;
+
for (i = 0; i < talloc_array_length(nodes); i++) {
if (options.machinereadable) {
ret |= control_status_1_machine(mypnn,
@@ -5479,7 +5483,7 @@ int main(int argc, const char *argv[])
}
/* setup the node number(s) to contact */
- if (!parse_nodestring(ctdb, nodestring, true,
+ if (!parse_nodestring(ctdb, nodestring, CTDB_CURRENT_NODE, false,
&options.nodes, &options.pnn)) {
usage();
}