LibCTDB : update the ctdb tool to use libctdb to read the recovery mode
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 23 Aug 2011 06:35:08 +0000 (16:35 +1000)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 23 Aug 2011 06:35:08 +0000 (16:35 +1000)
tools/ctdb.c

index dc4a158b13fb5e352cd605937a95d63ebcb54075..f435a216238029b4e50d2333693522f11882b88b 100644 (file)
@@ -737,10 +737,9 @@ static int control_status(struct ctdb_context *ctdb, int argc, const char **argv
                printf("hash:%d lmaster:%d\n", i, vnnmap->map[i]);
        }
 
-       ret = ctdb_ctrl_getrecmode(ctdb, ctdb, TIMELIMIT(), options.pnn, &recmode);
-       if (ret != 0) {
+       if (!ctdb_getrecmode(ctdb_connection, options.pnn, &recmode)) {
                DEBUG(DEBUG_ERR, ("Unable to get recmode from node %u\n", options.pnn));
-               return ret;
+               return -1;
        }
        printf("Recovery mode:%s (%d)\n",recmode==CTDB_RECOVERY_NORMAL?"NORMAL":"RECOVERY",recmode);
 
@@ -2545,8 +2544,7 @@ static uint32_t get_generation(struct ctdb_context *ctdb)
                }
 
                /* get recovery mode */
-               ret = ctdb_ctrl_getrecmode(ctdb, ctdb, TIMELIMIT(), recmaster, &recmode);
-               if (ret != 0) {
+               if (!ctdb_getrecmode(ctdb_connection, recmaster, &recmode)) {
                        DEBUG(DEBUG_ERR, ("Unable to get recmode from node %u\n", options.pnn));
                        exit(10);
                }