Rev 371: call the event script on recovery too in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Tue May 29 02:55:25 GMT 2007


------------------------------------------------------------
revno: 371
revision-id: tridge at samba.org-20070529025524-2xj1fw64ggc9iw9u
parent: tridge at samba.org-20070529024925-0rcoxtaqxwzinus1
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Tue 2007-05-29 12:55:24 +1000
message:
  call the event script on recovery too
modified:
  common/ctdb_recover.c          ctdb_recover.c-20070503002147-admmfgt1oj6gexfo-1
  include/ctdb_private.h         ctdb_private.h-20061117234101-o3qt14umlg9en8z0-13
  takeover/ctdb_takeover.c       ctdb_takeover.c-20070525071636-a5n1ihghjtppy08r-2
  takeover/system.c              system.c-20070525071636-a5n1ihghjtppy08r-3
=== modified file 'common/ctdb_recover.c'
--- a/common/ctdb_recover.c	2007-05-25 07:04:13 +0000
+++ b/common/ctdb_recover.c	2007-05-29 02:55:24 +0000
@@ -447,6 +447,7 @@
 		return -1;
 	}
 	ctdb->recovery_mode = recmode;
+	ctdb_event_script(ctdb, "recovered");
 	return 0;
 }
 

=== modified file 'include/ctdb_private.h'
--- a/include/ctdb_private.h	2007-05-29 02:49:25 +0000
+++ b/include/ctdb_private.h	2007-05-29 02:55:24 +0000
@@ -945,6 +945,6 @@
 int32_t ctdb_control_startup(struct ctdb_context *ctdb, uint32_t vnn);
 
 void ctdb_takeover_client_destructor_hook(struct ctdb_client *client);
-
+int ctdb_event_script(struct ctdb_context *ctdb, const char *fmt, ...);
 
 #endif

=== modified file 'takeover/ctdb_takeover.c'
--- a/takeover/ctdb_takeover.c	2007-05-29 02:49:25 +0000
+++ b/takeover/ctdb_takeover.c	2007-05-29 02:55:24 +0000
@@ -93,26 +93,6 @@
 
 
 /*
-  run the event script
- */
-static int ctdb_event_script(struct ctdb_context *ctdb, const char *fmt, ...)
-{
-	va_list ap;
-	char *cmdstr;
-	int ret;
-
-	va_start(ap, fmt);
-	cmdstr = talloc_vasprintf(ctdb, fmt, ap);
-	va_end(ap);
-	CTDB_NO_MEMORY(ctdb, cmdstr);
-
-	ret = system(cmdstr);
-	talloc_free(cmdstr);
-
-	return ret;
-}
-
-/*
   take over an ip address
  */
 int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb, TDB_DATA indata)

=== modified file 'takeover/system.c'
--- a/takeover/system.c	2007-05-29 02:49:25 +0000
+++ b/takeover/system.c	2007-05-29 02:55:24 +0000
@@ -257,3 +257,28 @@
 	return ret == 0;
 }
 
+/*
+  run the event script
+ */
+int ctdb_event_script(struct ctdb_context *ctdb, const char *fmt, ...)
+{
+	va_list ap;
+	char *options, *cmdstr;
+	int ret;
+
+	va_start(ap, fmt);
+	options  = talloc_vasprintf(ctdb, fmt, ap);
+	va_end(ap);
+	CTDB_NO_MEMORY(ctdb, options);
+
+	cmdstr = talloc_asprintf(ctdb, "%s %s", ctdb->takeover.event_script, options);
+	CTDB_NO_MEMORY(ctdb, cmdstr);
+
+	ret = system(cmdstr);
+
+	talloc_free(cmdstr);
+	talloc_free(options);
+
+	return ret;
+}
+



More information about the samba-cvs mailing list