Rev 337: merge from ronnie in http://samba.org/~tridge/ctdb ------------------------------------------------------------
revno: 337
revision-id: tridge@samba.org-20070524001002-l15u156fi8sdv574
parent: tridge@samba.org-20070523101509-vbrbhal0ufirofal
parent: sahlberg@ronnie-20070523220845-u9ji91tnmc92k9gq
committer: Andrew Tridgell 
branch nick: tridge
timestamp: Thu 2007-05-24 10:10:02 +1000
message:
  merge from ronnie
modified:
  tools/ctdb_control.c           ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1
    ------------------------------------------------------------
    revno: 326.1.5
    merged: sahlberg@ronnie-20070523220845-u9ji91tnmc92k9gq
    parent: sahlberg@ronnie-20070523213304-u3vgumzloo0w1gpn
    parent: tridge@samba.org-20070523100637-sr7fh7uhl7s143rk
    committer: Ronnie Sahlberg 
    branch nick: ctdb
    timestamp: Thu 2007-05-24 08:08:45 +1000
    message:
      add a new command for ctdb_control to trigger a recovery
    ------------------------------------------------------------
    revno: 326.1.4
    merged: sahlberg@ronnie-20070523213304-u3vgumzloo0w1gpn
    parent: sahlberg@ronnie-20070520232434-xxhlg6zdpx5kkvjp
    parent: tridge@samba.org-20070523045041-a6v1tls6f3m01bqx
    committer: Ronnie Sahlberg 
    branch nick: ctdb
    timestamp: Thu 2007-05-24 07:33:04 +1000
    message:
      merge from tridge
=== modified file 'tools/ctdb_control.c'
--- a/tools/ctdb_control.c	2007-05-23 10:06:37 +0000
+++ b/tools/ctdb_control.c	2007-05-23 22:08:45 +0000
@@ -61,6 +61,7 @@
 		"  getpid                        get the pid of a ctdb daemon\\n"
 		"  dumpmemory                dump memory map to log\\n"
 		"  shutdown                      shutdown a remote ctdb\\n"
+		"  recovery                      trigger a recovery\\n"
 		"  freeze                    freeze a node\\n"
 		"  thaw                      thaw a node\\n"
 	);
@@ -374,6 +375,28 @@
 }
 
 /*
+  trigger a recovery
+ */
+static int control_recovery(struct ctdb_context *ctdb, int argc, const char **argv)
+{
+	int ret;
+
+
+	ret = ctdb_ctrl_freeze(ctdb, timeval_current_ofs(timelimit, 0), CTDB_CURRENT_NODE);
+	if (ret != 0) {
+		printf("Unable to freeze node\\n");
+		return ret;
+	}
+	ret = ctdb_ctrl_setrecmode(ctdb, timeval_current_ofs(timelimit, 0), CTDB_CURRENT_NODE, CTDB_RECOVERY_ACTIVE);
+	if (ret != 0) {
+		printf("Unable to set recovery mode\\n");
+		return ret;
+	}
+
+	return 0;
+}
+
+/*
   display recovery mode of a remote node
  */
 static int control_getrecmode(struct ctdb_context *ctdb, int argc, const char **argv)
@@ -1056,6 +1079,7 @@
 		{ "dumpmemory", control_dumpmemory },
 		{ "getpid", control_getpid },
 		{ "shutdown", control_shutdown },
+		{ "recovery", control_recovery },
 		{ "freeze", control_freeze },
 		{ "thaw", control_thaw },
 	};

