summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2011-12-12 17:19:00 +1100
committerMartin Schwenke <martin@meltin.net>2012-02-06 16:00:23 +1100
commit7a04587e88a7ca68bad968a88f9d3b08498fe3f0 (patch)
tree5f341ddb02f5acafbbebd16865c790d7af6ef404
parented8a8ee966ee84a45832492be56cfb36f611037e (diff)
downloadsamba-7a04587e88a7ca68bad968a88f9d3b08498fe3f0.tar.gz
samba-7a04587e88a7ca68bad968a88f9d3b08498fe3f0.tar.xz
samba-7a04587e88a7ca68bad968a88f9d3b08498fe3f0.zip
ctdb tool - convert control_status() over to use just libctdb()
Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit abe9985e503d998cf597933a594b445de8d3cec6)
-rw-r--r--ctdb/tools/ctdb.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c
index 0e309552f4..0f909d53a0 100644
--- a/ctdb/tools/ctdb.c
+++ b/ctdb/tools/ctdb.c
@@ -770,21 +770,18 @@ static int control_status_1_human(int mypnn, struct ctdb_node_and_flags *node)
*/
static int control_status(struct ctdb_context *ctdb, int argc, const char **argv)
{
- int i, ret;
+ int i;
struct ctdb_vnn_map *vnnmap=NULL;
struct ctdb_node_map *nodemap=NULL;
- uint32_t recmode, recmaster;
- int mypnn;
+ uint32_t recmode, recmaster, mypnn;
- mypnn = ctdb_ctrl_getpnn(ctdb, TIMELIMIT(), options.pnn);
- if (mypnn == -1) {
+ if (!ctdb_getpnn(ctdb_connection, options.pnn, &mypnn)) {
return -1;
}
- ret = ctdb_ctrl_getnodemap(ctdb, TIMELIMIT(), options.pnn, ctdb, &nodemap);
- if (ret != 0) {
+ if (!ctdb_getnodemap(ctdb_connection, options.pnn, &nodemap)) {
DEBUG(DEBUG_ERR, ("Unable to get nodemap from node %u\n", options.pnn));
- return ret;
+ return -1;
}
if (options.machinereadable) {
@@ -808,10 +805,9 @@ static int control_status(struct ctdb_context *ctdb, int argc, const char **argv
(void) control_status_1_human(mypnn, &nodemap->nodes[i]);
}
- ret = ctdb_ctrl_getvnnmap(ctdb, TIMELIMIT(), options.pnn, ctdb, &vnnmap);
- if (ret != 0) {
+ if (!ctdb_getvnnmap(ctdb_connection, options.pnn, &vnnmap)) {
DEBUG(DEBUG_ERR, ("Unable to get vnnmap from node %u\n", options.pnn));
- return ret;
+ return -1;
}
if (vnnmap->generation == INVALID_GENERATION) {
printf("Generation:INVALID\n");
@@ -822,6 +818,7 @@ static int control_status(struct ctdb_context *ctdb, int argc, const char **argv
for(i=0;i<vnnmap->size;i++){
printf("hash:%d lmaster:%d\n", i, vnnmap->map[i]);
}
+ ctdb_free_vnnmap(vnnmap);
if (!ctdb_getrecmode(ctdb_connection, options.pnn, &recmode)) {
DEBUG(DEBUG_ERR, ("Unable to get recmode from node %u\n", options.pnn));