Rev 225: added attach command in ctdb_control in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Mon Apr 30 13:54:07 GMT 2007


------------------------------------------------------------
revno: 225
revision-id: tridge at samba.org-20070430135406-5f2krpfqjekpa2n3
parent: tridge at samba.org-20070430133140-79ydyjc7o4pq21k9
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Mon 2007-04-30 15:54:06 +0200
message:
  added attach command in ctdb_control
renamed:
  direct/ctdbd.sh => tests/ctdbd.sh ctdbd.sh-20070411085038-phusiewluwzyqjpc-2
modified:
  tests/run_tests.sh             run_tests.sh-20070428085745-ec2w6vybjf07vtvg-1
  tools/ctdb_control.c           ctdb_control.c-20070426122705-9ehj1l5lu2gn9kuj-1
  tests/ctdbd.sh                 ctdbd.sh-20070411085038-phusiewluwzyqjpc-2
=== renamed file 'direct/ctdbd.sh' => 'tests/ctdbd.sh'
--- a/direct/ctdbd.sh	2007-04-29 20:42:23 +0000
+++ b/tests/ctdbd.sh	2007-04-30 13:54:06 +0000
@@ -23,8 +23,12 @@
 
 echo "Testing map calls"
 bin/ctdb_control getvnnmap 0 || exit 1
+
+echo "Attaching to some databases"
+bin/ctdb_control attach test1.tdb || exit 1
+bin/ctdb_control attach test2.tdb || exit 1
+
+echo "Testing getdbmap"
 bin/ctdb_control getdbmap 0 || exit 1
 
 killall -q ctdbd
-
-

=== modified file 'tests/run_tests.sh'
--- a/tests/run_tests.sh	2007-04-29 20:42:23 +0000
+++ b/tests/run_tests.sh	2007-04-30 13:54:06 +0000
@@ -3,7 +3,7 @@
 tests/fetch.sh 4 || exit 1
 tests/bench.sh 4 || exit 1
 tests/test.sh || exit 1
-direct/ctdbd.sh || exit 1
+tests/ctdbd.sh || exit 1
 
 echo "All OK"
 exit 0

=== modified file 'tools/ctdb_control.c'
--- a/tools/ctdb_control.c	2007-04-28 17:13:36 +0000
+++ b/tools/ctdb_control.c	2007-04-30 13:54:06 +0000
@@ -436,6 +436,28 @@
 	return 0;
 }
 
+
+/*
+  attach to a database
+ */
+static int control_attach(struct ctdb_context *ctdb, int argc, const char **argv)
+{
+	const char *db_name;
+	struct ctdb_db_context *ctdb_db;
+	if (argc < 1) {
+		usage();
+	}
+	db_name = argv[0];
+
+	ctdb_db = ctdb_attach(ctdb, db_name);
+	if (ctdb_db == NULL) {
+		DEBUG(0,("Unable to attach to database '%s'\n", db_name));
+		return -1;
+	}
+
+	return 0;
+}
+
 /*
   main program
 */
@@ -508,6 +530,8 @@
 		ret = control_debug(ctdb, extra_argc-1, extra_argv+1);
 	} else if (strcmp(control, "debuglevel") == 0) {
 		ret = control_debuglevel(ctdb, extra_argc-1, extra_argv+1);
+	} else if (strcmp(control, "attach") == 0) {
+		ret = control_attach(ctdb, extra_argc-1, extra_argv+1);
 	} else {
 		printf("Unknown control '%s'\n", control);
 		exit(1);



More information about the samba-cvs mailing list