[SCM] CTDB repository - branch 1.0.112 updated - ctdb-1.0.111-88-gce73013

Ronnie Sahlberg sahlberg at samba.org
Mon May 24 00:06:45 MDT 2010


The branch, 1.0.112 has been updated
       via  ce7301315fcb7a6878eb4cea444c2772c13c2cb0 (commit)
       via  718061488d5636100e3159e8a5f7bf0baf089d5a (commit)
       via  7dc8fbc23be7a79e6164f1bee6c0aa4597b8e937 (commit)
       via  9d17f95e277628e98af2b04de0cf4f3ea2dbee0b (commit)
      from  1095be7fe3c0f8ab810f44d4fe8f22d6fbad5720 (commit)

http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=1.0.112


- Log -----------------------------------------------------------------
commit ce7301315fcb7a6878eb4cea444c2772c13c2cb0
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Mon May 24 15:20:39 2010 +1000

    new version 1.0.112-22
    
    +* Mon May 24 2010 : Version 1.0.112-22
    + - Fix bug in 62.cnfs to allow exports that are quoted.
    + - Add monitoring og Quorum for the 62.cnfs script
    + - Allow restoredb to restore a backup to to a different database

commit 718061488d5636100e3159e8a5f7bf0baf089d5a
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu May 20 11:26:37 2010 +1000

    Enhance the "ctdb restoredb" command so you can restore a backup into a different database.

commit 7dc8fbc23be7a79e6164f1bee6c0aa4597b8e937
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Mon May 24 12:33:47 2010 +1000

    Add monitoring of quorum and make the node UNHEALTHY when quarum is lost

commit 9d17f95e277628e98af2b04de0cf4f3ea2dbee0b
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Mon May 24 09:51:52 2010 +1000

    in 62.cnfs, lines in /etc/exports can have hte exports quoted,
    so strip off any initial " on the exports line

-----------------------------------------------------------------------

Summary of changes:
 config/events.d/62.cnfs    |   29 ++++++++++++++++++++++++++++-
 packaging/RPM/ctdb.spec.in |    6 +++++-
 tools/ctdb.c               |   16 +++++++++++-----
 3 files changed, 44 insertions(+), 7 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/events.d/62.cnfs b/config/events.d/62.cnfs
index 2e01d8a..2577675 100755
--- a/config/events.d/62.cnfs
+++ b/config/events.d/62.cnfs
@@ -7,8 +7,9 @@ loadconfig
 
 STATEDIR=$CTDB_BASE/state/gpfs
 
+
 # filesystems needed by nfs
-NFS_FSS=`cat /etc/exports | egrep -v "^#" | sed -e "s/[ \t]*[^ \t]*$//"`
+NFS_FSS=`cat /etc/exports | egrep -v "^#" | sed -e "s/[ \t]*[^ \t]*$//" -e "s/\"//g"`
 
 
 
@@ -22,6 +23,12 @@ check_if_healthy() {
                 exit 0
         }
 
+        [ -f "$STATEDIR/gpfsnoquorum" ] && {
+                logger No GPFS quorum. Node is UNHEALTHY
+                $CTDB_BASE/events.d/62.cnfs unhealthy "No GPFS quorum. Nodfe is UNHEALTHY."
+		exit 0
+	}
+
         logger All required GPFS resources are available. CNFS part is healthy.
         $CTDB_BASE/events.d/62.cnfs healthy
 }
@@ -81,11 +88,31 @@ case "$1" in
     # It checks that all required NFS filesystems are mounted 
     # and flags the node healthy if so.
     gpfsstartup)
+	# assume we always have quorum when starting
+	# we are only interested in the case when we explicitely
+	# lost quorum in an otherwise happy cluster
+        mkdir -p $STATEDIR
+        rm -f "$STATEDIR/gpfsnoquorum"
         logger "GPFS is is started."
         check_if_healthy
         ;;
 
 
+    gpfsquorumreached)
+        mkdir -p $STATEDIR
+        rm -f "$STATEDIR/gpfsnoquorum"
+        logger "GPFS quorum has been reached."
+        check_if_healthy
+        ;;
+
+    gpfsquorumloss)
+        mkdir -p $STATEDIR
+        touch "$STATEDIR/gpfsnoquorum"
+        logger "GPFS quorum has been lost."
+        $CTDB_BASE/events.d/62.cnfs unhealthy "GPFS quorum was lost! Marking node as UNHEALTHY."
+        ;;
+
+
 
 
 
diff --git a/packaging/RPM/ctdb.spec.in b/packaging/RPM/ctdb.spec.in
index d147a3f..42179e5 100644
--- a/packaging/RPM/ctdb.spec.in
+++ b/packaging/RPM/ctdb.spec.in
@@ -5,7 +5,7 @@ Vendor: Samba Team
 Packager: Samba Team <samba at samba.org>
 Name: ctdb
 Version: 1.0.112
-Release: 21
+Release: 22
 Epoch: 0
 License: GNU GPL version 3
 Group: System Environment/Daemons
@@ -125,6 +125,10 @@ rm -rf $RPM_BUILD_ROOT
 %{_docdir}/ctdb/tests/bin/ctdb_transaction
 
 %changelog
+* Mon May 24 2010 : Version 1.0.112-22
+ - Fix bug in 62.cnfs to allow exports that are quoted.
+ - Add monitoring og Quorum for the 62.cnfs script
+ - Allow restoredb to restore a backup to to a different database
 * Fri May 21 2010 : Version 1.0.112-21
  - Fix a bug where we would fail to remove the natgw configuration
    and would leave a ip address for natgw still remaining on loopback.
diff --git a/tools/ctdb.c b/tools/ctdb.c
index 0976366..2939f88 100644
--- a/tools/ctdb.c
+++ b/tools/ctdb.c
@@ -3346,8 +3346,9 @@ static int control_restoredb(struct ctdb_context *ctdb, int argc, const char **a
 	uint32_t generation;
 	struct tm *tm;
 	char tbuf[100];
+	char *dbname;
 
-	if (argc != 1) {
+	if (argc < 1 || argc > 2) {
 		DEBUG(DEBUG_ERR,("Invalid arguments\n"));
 		return -1;
 	}
@@ -3366,6 +3367,11 @@ static int control_restoredb(struct ctdb_context *ctdb, int argc, const char **a
 		return -1;
 	}
 
+	dbname = dbhdr.name;
+	if (argc == 2) {
+		dbname = argv[1];
+	}
+
 	outdata.dsize = dbhdr.size;
 	outdata.dptr = talloc_size(tmp_ctx, outdata.dsize);
 	if (outdata.dptr == NULL) {
@@ -3380,12 +3386,12 @@ static int control_restoredb(struct ctdb_context *ctdb, int argc, const char **a
 	tm = localtime(&dbhdr.timestamp);
 	strftime(tbuf,sizeof(tbuf)-1,"%Y/%m/%d %H:%M:%S", tm);
 	printf("Restoring database '%s' from backup @ %s\n",
-		dbhdr.name, tbuf);
+		dbname, tbuf);
 
 
-	ctdb_db = ctdb_attach(ctdb, dbhdr.name, dbhdr.persistent, 0);
+	ctdb_db = ctdb_attach(ctdb, dbname, dbhdr.persistent, 0);
 	if (ctdb_db == NULL) {
-		DEBUG(DEBUG_ERR,("Unable to attach to database '%s'\n", dbhdr.name));
+		DEBUG(DEBUG_ERR,("Unable to attach to database '%s'\n", dbname));
 		talloc_free(tmp_ctx);
 		return -1;
 	}
@@ -4057,7 +4063,7 @@ static const struct {
 	{ "delip",           control_delip,		false,	false, "delete an ip address from a node", "<ip>"},
 	{ "eventscript",     control_eventscript,	true,	false, "run the eventscript with the given parameters on a node", "<arguments>"},
 	{ "backupdb",        control_backupdb,          false,	false, "backup the database into a file.", "<database> <file>"},
-	{ "restoredb",        control_restoredb,        false,	false, "restore the database from a file.", "<file>"},
+	{ "restoredb",        control_restoredb,        false,	false, "restore the database from a file.", "<file> [dbname]"},
 	{ "dumpdbbackup",    control_dumpdbbackup,      false,	true,  "dump database backup from a file.", "<file>"},
 	{ "wipedb",           control_wipedb,        false,	false, "wipe the contents of a database.", "<dbname>"},
 	{ "recmaster",        control_recmaster,        false,	false, "show the pnn for the recovery master."},


-- 
CTDB repository


More information about the samba-cvs mailing list