mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
A compromise integration of LVMetaD into the build: I have kept all the
daemon/common code in a single libdaemon.a, which is completely private. This is currently linked into the lvmetad binary, and will be linked into LVM (the client part, since static linking only picks up only symbols that are actually used). I have also added --enable/disable-lvmetad to ./configure; although the current default is off, I expect this to be flipped to on shortly. There's no LVM-side support yet, but when there is, even when built, it'll still need to be enabled by an lvm.conf option.
This commit is contained in:
parent
68e89ab2d2
commit
615534d305
14
configure.in
14
configure.in
@ -37,6 +37,7 @@ case "$host_os" in
|
||||
LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
|
||||
LIB_SUFFIX=so
|
||||
DEVMAPPER=yes
|
||||
LVMETAD=no
|
||||
ODIRECT=yes
|
||||
DM_IOCTLS=yes
|
||||
SELINUX=yes
|
||||
@ -789,6 +790,17 @@ if test x$DEVMAPPER = xyes; then
|
||||
AC_DEFINE([DEVMAPPER_SUPPORT], 1, [Define to 1 to enable LVM2 device-mapper interaction.])
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
dnl -- Build lvmetad
|
||||
AC_MSG_CHECKING(whether to build LVMetaD)
|
||||
AC_ARG_ENABLE(lvmetad,
|
||||
AC_HELP_STRING([--disable-lvmetad],
|
||||
[disable the LVM Metadata Daemon]),
|
||||
LVMETAD=$enableval)
|
||||
AC_MSG_RESULT($LVMETAD)
|
||||
|
||||
BUILD_LVMETAD=$LVMETAD
|
||||
|
||||
################################################################################
|
||||
dnl -- Enable udev synchronisation
|
||||
AC_MSG_CHECKING(whether to enable synchronisation with udev processing)
|
||||
@ -1288,6 +1300,7 @@ AC_SUBST(APPLIB)
|
||||
AC_SUBST(AWK)
|
||||
AC_SUBST(BUILD_CMIRRORD)
|
||||
AC_SUBST(BUILD_DMEVENTD)
|
||||
AC_SUBST(BUILD_LVMETAD)
|
||||
AC_SUBST(CFLAGS)
|
||||
AC_SUBST(CFLOW_CMD)
|
||||
AC_SUBST(CLDFLAGS)
|
||||
@ -1401,6 +1414,7 @@ daemons/dmeventd/plugins/lvm2/Makefile
|
||||
daemons/dmeventd/plugins/raid/Makefile
|
||||
daemons/dmeventd/plugins/mirror/Makefile
|
||||
daemons/dmeventd/plugins/snapshot/Makefile
|
||||
daemons/lvmetad/Makefile
|
||||
doc/Makefile
|
||||
doc/example.conf
|
||||
include/.symlinks
|
||||
|
@ -15,7 +15,10 @@ srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
|
||||
.PHONY: dmeventd clvmd cmirrord
|
||||
LIB_STATIC=libdaemon.a
|
||||
SOURCES = common/daemon-shared.c common/daemon-server.c common/daemon-client.c
|
||||
|
||||
.PHONY: dmeventd clvmd cmirrord lvmetad
|
||||
|
||||
ifneq ("@CLVMD@", "none")
|
||||
SUBDIRS = clvmd
|
||||
@ -25,6 +28,10 @@ ifeq ("@BUILD_CMIRRORD@", "yes")
|
||||
SUBDIRS += cmirrord
|
||||
endif
|
||||
|
||||
ifeq ("@BUILD_LVMETAD@", "yes")
|
||||
SUBDIRS += lvmetad
|
||||
endif
|
||||
|
||||
ifeq ("@BUILD_DMEVENTD@", "yes")
|
||||
SUBDIRS += dmeventd
|
||||
ifneq ("$(CFLOW_CMD)", "")
|
||||
@ -33,7 +40,7 @@ endif
|
||||
endif
|
||||
|
||||
ifeq ($(MAKECMDGOALS),distclean)
|
||||
SUBDIRS = clvmd cmirrord dmeventd
|
||||
SUBDIRS = clvmd cmirrord dmeventd lvmetad
|
||||
endif
|
||||
|
||||
include $(top_builddir)/make.tmpl
|
||||
@ -41,3 +48,5 @@ include $(top_builddir)/make.tmpl
|
||||
ifeq ("@BUILD_DMEVENTD@", "yes")
|
||||
device-mapper: dmeventd.device-mapper
|
||||
endif
|
||||
|
||||
device-mapper: libdaemon.a
|
||||
|
@ -247,13 +247,13 @@ void *client_thread(void *baton)
|
||||
fprintf(stderr, "error parsing request:\n %s\n", req.buffer);
|
||||
response res = b->s.handler(b->s, b->client, req);
|
||||
if (req.cft)
|
||||
destroy_config_tree(req.cft);
|
||||
dm_config_destroy(req.cft);
|
||||
dm_free(req.buffer);
|
||||
|
||||
if (!res.buffer) {
|
||||
dm_config_write_node(res.cft->root, buffer_line, &res);
|
||||
buffer_rewrite(&res.buffer, "%s\n\n", NULL);
|
||||
destroy_config_tree(res.cft);
|
||||
dm_config_destroy(res.cft);
|
||||
}
|
||||
|
||||
write_buffer(b->client.socket_fd, res.buffer, strlen(res.buffer));
|
||||
|
59
daemons/lvmetad/Makefile.in
Normal file
59
daemons/lvmetad/Makefile.in
Normal file
@ -0,0 +1,59 @@
|
||||
# Copyright (C) 2011 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This file is part of the device-mapper userspace tools.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing to use,
|
||||
# modify, copy, or redistribute it subject to the terms and conditions
|
||||
# of the GNU Lesser General Public License v.2.1.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
|
||||
SOURCES = lvmetad-core.c
|
||||
SOURCES2 = testclient.c
|
||||
|
||||
TARGETS = lvmetad lvmetad-testclient
|
||||
|
||||
.PHONY: install_lib_dynamic install_lib_static install_include \
|
||||
install_pkgconfig install_dmeventd_dynamic install_dmeventd_static \
|
||||
install_lib install_dmeventd
|
||||
|
||||
INCLUDES += -I$(top_srcdir)/daemons/common/
|
||||
INSTALL_LVMETAD_TARGETS = install_lvmetad
|
||||
CLEAN_TARGETS = lvmetad lvmetad-testclient
|
||||
|
||||
CFLOW_LIST = $(SOURCES)
|
||||
CFLOW_LIST_TARGET = $(LIB_NAME).cflow
|
||||
CFLOW_TARGET = lvmetad
|
||||
|
||||
include $(top_builddir)/make.tmpl
|
||||
|
||||
all: device-mapper
|
||||
device-mapper: $(TARGETS)
|
||||
|
||||
LIBS += -ldevmapper -ldaemon -lpthread
|
||||
|
||||
lvmetad: lvmetad-core.o
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -L$(top_builddir)/daemons -o $@ lvmetad-core.o \
|
||||
$(DL_LIBS) $(LVMLIBS) $(LIBS) -rdynamic
|
||||
|
||||
# TODO: No idea. No idea how to test either.
|
||||
#ifneq ("$(CFLOW_CMD)", "")
|
||||
#CFLOW_SOURCES = $(addprefix $(srcdir)/, $(SOURCES))
|
||||
#-include $(top_builddir)/libdm/libdevmapper.cflow
|
||||
#-include $(top_builddir)/lib/liblvm-internal.cflow
|
||||
#-include $(top_builddir)/lib/liblvm2cmd.cflow
|
||||
#-include $(top_builddir)/daemons/dmeventd/$(LIB_NAME).cflow
|
||||
#-include $(top_builddir)/daemons/dmeventd/plugins/mirror/$(LIB_NAME)-lvm2mirror.cflow
|
||||
#endif
|
||||
|
||||
install_lvmetad: $(INSTALL_DMEVENTD_TARGETS)
|
||||
|
||||
install: install_lvmetad
|
||||
|
||||
install_device-mapper: install_lvmetad
|
@ -96,10 +96,11 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
for i in lvm $$(cat ../tools/.commands); do \
|
||||
ln -fs lvm-wrapper lib/$$i; \
|
||||
done
|
||||
ln -s "$(abs_top_builddir)/tools/dmsetup" lib/dmsetup
|
||||
ln -s "$(abs_top_builddir)/daemons/clvmd/clvmd" lib/clvmd
|
||||
ln -s "$(abs_top_builddir)/daemons/dmeventd/dmeventd" lib/dmeventd
|
||||
ln -s "$(abs_top_builddir)/scripts/vgimportclone.sh" lib/vgimportclone
|
||||
ln -fs "$(abs_top_builddir)/tools/dmsetup" lib/dmsetup
|
||||
ln -fs "$(abs_top_builddir)/daemons/clvmd/clvmd" lib/clvmd
|
||||
ln -fs "$(abs_top_builddir)/daemons/dmeventd/dmeventd" lib/dmeventd
|
||||
ln -fs "$(abs_top_builddir)/daemons/lvmetad/lvmetad" lib/lvmetad
|
||||
ln -fs "$(abs_top_builddir)/scripts/vgimportclone.sh" lib/vgimportclone
|
||||
touch $@
|
||||
|
||||
clean:
|
||||
|
@ -60,6 +60,21 @@ prepare_dmeventd() {
|
||||
sleep 1
|
||||
}
|
||||
|
||||
prepare_lvmetad() {
|
||||
# skip if we don't have our own lvmetad...
|
||||
(which lvmetad | grep $abs_builddir) || {
|
||||
touch SKIP_THIS_TEST
|
||||
exit 1
|
||||
}
|
||||
|
||||
lvmconf "global/lvmetad = 1"
|
||||
|
||||
lvmetad -f "$@" &
|
||||
echo "$!" > LOCAL_LVMETAD
|
||||
|
||||
sleep 1
|
||||
}
|
||||
|
||||
teardown_devs() {
|
||||
# Delete any remaining dm/udev semaphores
|
||||
teardown_udev_cookies
|
||||
@ -145,6 +160,7 @@ teardown() {
|
||||
echo -n .
|
||||
|
||||
test -f LOCAL_DMEVENTD && kill -9 "$(cat LOCAL_DMEVENTD)"
|
||||
test -f LOCAL_LVMETAD && kill -9 "$(cat LOCAL_LVMETAD)"
|
||||
|
||||
echo -n .
|
||||
|
||||
|
@ -54,6 +54,7 @@ ln -s $abs_top_builddir/test/lib/* $TESTDIR/lib
|
||||
set -eE -o pipefail
|
||||
aux lvmconf
|
||||
aux prepare_clvmd
|
||||
aux prepare_lvmetad
|
||||
echo "@TESTDIR=$TESTDIR"
|
||||
echo "@PREFIX=$PREFIX"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user