Skip to contentSkip to conversation

LVM2 ./configure.in daemons/clvmd/Makefile.in ...

PATCH [email protected] 2 participants 2 messages Mar 18, 2010

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mornfall at sourceware.org 2010-03-18 09:19:33

Modified files:

	.              : configure.in 
	daemons/clvmd  : Makefile.in clvmd-comms.h clvmd.c 
	lib/misc       : configure.h.in 
	test           : Makefile.in test-utils.sh 

Added files:
daemons/clvmd : clvmd-singlenode.c

Log message:
Add infrastructure for running the functional testsuite with locking_type set to 3, using a local (singlenode) clvmd.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/configure.in.diff?cvsroot=lvm2&r1=1.131&r2=1.132
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-singlenode.c.diff?cvsroot=lvm2&r1=NONE&r2=1.1
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/Makefile.in.diff?cvsroot=lvm2&r1=1.36&r2=1.37
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-comms.h.diff?cvsroot=lvm2&r1=1.10&r2=1.11
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd.c.diff?cvsroot=lvm2&r1=1.63&r2=1.64
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/misc/configure.h.in.diff?cvsroot=lvm2&r1=1.16&r2=1.17
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/Makefile.in.diff?cvsroot=lvm2&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/test/test-utils.sh.diff?cvsroot=lvm2&r1=1.22&r2=1.23

configure.in +1 -0
@@ -340,6 +340,7 @@
                            * cman,gulm             (RHEL4 or equivalent)
                            * cman                  (RHEL5 or equivalent)
                            * cman,corosync,openais (or selection of them)
+                           * singlenode            (localhost only)
                            * all                   (autodetect)
                            * none                  (disable build)
                           [TYPE=none] ],

/cvs/lvm2/LVM2/daemons/clvmd/clvmd-singlenode.c,v --> standard output revision 1.1

- renamed from daemons/clvmd/clvmd-singlenode.c +252 -0

252 lines not on this page · raw message

daemons/clvmd/Makefile.in +4 -0
@@ -71,6 +71,10 @@
 	DEFS += -DUSE_COROSYNC
 endif
 
+ifneq (,$(findstring singlenode,, "@CLVMD@,"))
+	SOURCES += clvmd-singlenode.c
+	DEFS += -DUSE_SINGLENODE
+endif
 
 TARGETS = \
 	clvmd
daemons/clvmd/clvmd-comms.h +7 -0
@@ -110,5 +110,12 @@
 struct cluster_ops *init_corosync_cluster(void);
 #endif
 
+#ifdef USE_SINGLENODE
+#  define SINGLENODE_CSID_LEN (sizeof(int))
+#  define MAX_CLUSTER_MEMBER_NAME_LEN       64
+#  define SINGLENODE_MAX_CLUSTER_MESSAGE          65535
+#  define MAX_CSID_LEN sizeof(int)
+struct cluster_ops *init_singlenode_cluster(void);
+#endif
 
 #endif
daemons/clvmd/clvmd.c +15 -1
@@ -110,7 +110,7 @@
 #define DFAIL_TIMEOUT    5
 #define SUCCESS          0
 
-typedef enum {IF_AUTO, IF_CMAN, IF_GULM, IF_OPENAIS, IF_COROSYNC} if_type_t;
+typedef enum {IF_AUTO, IF_CMAN, IF_GULM, IF_OPENAIS, IF_COROSYNC, IF_SINGLENODE} if_type_t;
 
 typedef void *(lvm_pthread_fn_t)(void*);
 
@@ -180,6 +180,9 @@
 #ifdef USE_GULM
 	fprintf(file, "gulm ");
 #endif
+#ifdef USE_SINGLENODE
+	fprintf(file, "singlenode");
+#endif
 	fprintf(file, "\n");
 }
 
@@ -434,6 +437,15 @@
 			syslog(LOG_NOTICE, "Cluster LVM daemon started - connected to OpenAIS");
 		}
 #endif
+#ifdef USE_SINGLENODE
+	if (!clops)
+		if ((cluster_iface == IF_AUTO || cluster_iface == IF_SINGLENODE) && (clops = init_singlenode_cluster())) {
+			max_csid_len = SINGLENODE_CSID_LEN;
+			max_cluster_message = SINGLENODE_MAX_CLUSTER_MESSAGE;
+			max_cluster_member_name_len = MAX_CLUSTER_MEMBER_NAME_LEN;
+			syslog(LOG_NOTICE, "Cluster LVM daemon started - running in single-node mode");
+		}
+#endif
 
 	if (!clops) {
 		DEBUGLOG("Can't initialise cluster interface\n");
@@ -2063,6 +2075,8 @@
 		iface = IF_OPENAIS;
 	if (!strcmp(ifname, "corosync"))
 		iface = IF_COROSYNC;
+	if (!strcmp(ifname, "singlenode"))
+		iface = IF_SINGLENODE;
 
 	return iface;
 }
lib/misc/configure.h.in +4 -1
@@ -270,7 +270,7 @@
 /* Define to 1 if you have the `strtoul' function. */
 #undef HAVE_STRTOUL
 
-/* Define to 1 if `st_rdev' is member of `struct stat'. */
+/* Define to 1 if `struct stat' is a member of `st_rdev'. */
 #undef HAVE_STRUCT_STAT_ST_RDEV
 
 /* Define to 1 if you have the <syslog.h> header file. */
@@ -407,6 +407,9 @@
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
 
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
test/Makefile.in +5 -1
@@ -42,7 +42,10 @@
 endif
 
 all: init.sh
-	./bin/harness t-*.sh
+	@echo Testing with locking_type 1
+	#./bin/harness t-*.sh
+	@echo Testing with locking_type 3
+	LVM_TEST_LOCKING=3 ./bin/harness t-*.sh
 
 bin/not: $(srcdir)/not.c .bin-dir-stamp
 	$(CC) -o bin/not $<
@@ -77,6 +80,7 @@
 	  ln -s ../lvm-wrapper bin/$$i; \
 	done
 	ln -s "$(abs_top_builddir)/tools/dmsetup" bin/dmsetup
+	ln -s "$(abs_top_builddir)/daemons/clvmd/clvmd" bin/clvmd
 	touch $@
 
 lvm-wrapper: Makefile
test/test-utils.sh +25 -0
@@ -54,10 +54,31 @@
 	fi
 }
 
+prepare_clvmd() {
+	if test -z "$LVM_TEST_LOCKING" || test "$LVM_TEST_LOCKING" -ne 3 ; then
+		return 0 # not needed
+	fi
+
+	if pgrep clvmd ; then
+		echo "Cannot use fake cluster locking with real clvmd ($(pgrep clvmd)) running."
+		exit 1
+	fi
+
+	# skip if we don't have our own clvmd...
+	(which clvmd | grep $abs_builddir) || exit 200
+
+	trap 'aux teardown_' EXIT # don't forget to clean up
+
+	clvmd -Isinglenode -d 1 &
+	LOCAL_CLVMD="$!"
+}
+
 teardown() {
 	echo $LOOP
 	echo $PREFIX
 
+	test -n "$LOCAL_CLVMD" && kill -9 "$LOCAL_CLVMD"
+
 	test -n "$PREFIX" && {
 		rm -rf $G_root_/dev/$PREFIX*
 
@@ -288,6 +309,8 @@
 	local filter="$1"
 	test -z "$filter" && \
 		filter='[ "a/dev\/mirror/", "a/dev\/mapper\/.*pv[0-9_]*$/", "r/.*/" ]'
+        locktype=
+	if test -n "$LVM_TEST_LOCKING"; then locktype="locking_type = $LVM_TEST_LOCKING"; fi
 	cat > $G_root_/etc/lvm.conf <<-EOF
   devices {
     dir = "$G_dev_"
@@ -309,6 +332,7 @@
     abort_on_internal_errors = 1
     library_dir = "$G_root_/lib"
     locking_dir = "$G_root_/var/lock/lvm"
+    $locktype
   }
   activation {
     udev_sync = 1
@@ -319,4 +343,5 @@
 
 set -vexE -o pipefail
 aux prepare_lvmconf
+prepare_clvmd
 
#1 lore raw

Hi,

Quoted 2 lines · mornfall at sourceware.org

Modified files:
. : configure.in

if someone could please run autoreconf with the right autoconf version (mine seems to be one minor too new)... it's just for the help string, but still. Thanks!

Yours,
Petr.