verify that the nodes we try to ban/unban are operational and print an ctdb-1.0.60
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 14 Oct 2008 14:23:57 +0000 (01:23 +1100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Tue, 14 Oct 2008 14:23:57 +0000 (01:23 +1100)
error to the user othervise.

tools/ctdb.c

index 1f537d9ac2e27259402f451be1b5504961967a50..5055c2693e95c433c59d22c980b5196e640f003a 100644 (file)
@@ -1196,6 +1196,13 @@ static int control_ban(struct ctdb_context *ctdb, int argc, const char **argv)
                usage();
        }
 
+       /* verify we can access the node */
+       ret = ctdb_ctrl_getpnn(ctdb, TIMELIMIT(), options.pnn);
+       if (ret == -1) {
+               DEBUG(DEBUG_ERR,("Can not ban node. Node is not operational.\n"));
+               return -1;
+       }
+
        ban_time = strtoul(argv[0], NULL, 0);
 
        b.pnn = options.pnn;
@@ -1222,6 +1229,13 @@ static int control_unban(struct ctdb_context *ctdb, int argc, const char **argv)
        int ret;
        TDB_DATA data;
 
+       /* verify we can access the node */
+       ret = ctdb_ctrl_getpnn(ctdb, TIMELIMIT(), options.pnn);
+       if (ret == -1) {
+               DEBUG(DEBUG_ERR,("Can not unban node. Node is not operational.\n"));
+               return -1;
+       }
+
        data.dptr = (uint8_t *)&options.pnn;
        data.dsize = sizeof(uint32_t);