summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-09-14 14:49:42 +0200
committerRonnie Sahlberg <ronniesahlberg@gmail.com>2010-10-21 11:10:15 +1100
commitbe7545e83a2fdaae50496bc2dd916f4845e4f3c4 (patch)
tree168a8a314e519b88d54d6936f927f0a00a0aecca
parent19bc2e40ca1252629f86ea9603a03651021835ad (diff)
downloadsamba-be7545e83a2fdaae50496bc2dd916f4845e4f3c4.tar.gz
samba-be7545e83a2fdaae50496bc2dd916f4845e4f3c4.tar.xz
samba-be7545e83a2fdaae50496bc2dd916f4845e4f3c4.zip
tools/ctdb: add 'persistent' flag to "ctdb attach"
metze (This used to be ctdb commit 7a5790de22e8370b2812414aa1adef8201e8b269)
-rw-r--r--ctdb/tools/ctdb.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c
index d8f8ea029b..61a6c97cba 100644
--- a/ctdb/tools/ctdb.c
+++ b/ctdb/tools/ctdb.c
@@ -3761,13 +3761,23 @@ static int control_attach(struct ctdb_context *ctdb, int argc, const char **argv
{
const char *db_name;
struct ctdb_db_context *ctdb_db;
+ bool persistent = false;
if (argc < 1) {
usage();
}
db_name = argv[0];
+ if (argc > 2) {
+ usage();
+ }
+ if (argc == 2) {
+ if (strcmp(argv[1], "persistent") != 0) {
+ usage();
+ }
+ persistent = true;
+ }
- ctdb_db = ctdb_attach(ctdb, db_name, false, 0);
+ ctdb_db = ctdb_attach(ctdb, db_name, persistent, 0);
if (ctdb_db == NULL) {
DEBUG(DEBUG_ERR,("Unable to attach to database '%s'\n", db_name));
return -1;
@@ -4756,7 +4766,7 @@ static const struct {
{ "getdebug", control_getdebug, true, false, "get debug level" },
{ "getlog", control_getlog, true, false, "get the log data from the in memory ringbuffer", "<level>" },
{ "clearlog", control_clearlog, true, false, "clear the log data from the in memory ringbuffer" },
- { "attach", control_attach, true, false, "attach to a database", "<dbname>" },
+ { "attach", control_attach, true, false, "attach to a database", "<dbname> [persistent]" },
{ "dumpmemory", control_dumpmemory, true, false, "dump memory map to stdout" },
{ "rddumpmemory", control_rddumpmemory, true, false, "dump memory map from the recovery daemon to stdout" },
{ "getpid", control_getpid, true, false, "get ctdbd process ID" },