Skip to contentSkip to conversation

master - scripts/lvm2_activation_generator_systemd_red_hat: rewrite to use lvmconfig

PATCH Joe Thornber 1 participant 1 message Jun 7, 2018 Kbuild

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=bd8c6cf8628e5898ea89ebbcccfe423dba83a840
Commit:        bd8c6cf8628e5898ea89ebbcccfe423dba83a840
Parent:        74460cd009267564be032a373e78ec5eba67b4ce
Author:        Joe Thornber <[email protected]>
AuthorDate:    Thu Jun 7 16:15:04 2018 +0100
Committer:     Joe Thornber <[email protected]>
CommitterDate: Thu Jun 7 16:15:04 2018 +0100

scripts/lvm2_activation_generator_systemd_red_hat: rewrite to use lvmconfig

Unit tested the new code, but not run functional tests (assuming they exist).

---
 configure.ac                                       |    3 +
 scripts/Makefile.in                                |   16 +--
 scripts/generator-internals.c                      |  200 +++++++++++++++++
 .../lvm2_activation_generator_systemd_red_hat.c    |  232 ++++++++++++--------
 test/unit/Makefile.in                              |    6 +-
 test/unit/units.h                                  |    2 +
 6 files changed, 348 insertions(+), 111 deletions(-)
configure.ac +3 -0
index 67f2462..365df25 100644
@@ -1533,6 +1533,9 @@ SBINDIR="$(eval echo $(eval echo $sbindir))"
 LVM_PATH="$SBINDIR/lvm"
 AC_DEFINE_UNQUOTED(LVM_PATH, ["$LVM_PATH"], [Path to lvm binary.])
 
+LVMCONFIG_PATH="$$BINDIR/lvmconfig"
+AC_DEFINE_UNQUOTED(LVMCONFIG_PATH, ["$LVMCONFIG_PATH"], [Path to lvmconfig binary.])
+
 USRSBINDIR="$(eval echo $(eval echo $usrsbindir))"
 
 FSADM_PATH="$SBINDIR/fsadm"
scripts/Makefile.in +2 -14
index ee39306..208aebf 100644
@@ -15,21 +15,14 @@ srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 top_builddir = @top_builddir@
 
-ifeq ("@APPLIB@", "yes")
-	SOURCES = lvm2_activation_generator_systemd_red_hat.c
-	TARGETS = lvm2_activation_generator_systemd_red_hat
-endif
+SOURCES = lvm2_activation_generator_systemd_red_hat.c
+TARGETS = lvm2_activation_generator_systemd_red_hat
 
 include $(top_builddir)/make.tmpl
 
-ifeq ("@APPLIB@", "yes")
-	DEPLIBS += $(top_builddir)/liblvm/liblvm2app.so
-	LDFLAGS += -L$(top_builddir)/liblvm
 ifeq ("@BUILD_DMEVENTD@", "yes")
 	LDFLAGS += -Wl,-rpath-link,$(top_builddir)/daemons/dmeventd
 endif
-	LVMLIBS = @LVM2APP_LIB@ -laio
-endif
 
 LVM_SCRIPTS = lvmdump.sh lvmconf.sh
 DM_SCRIPTS =
@@ -93,12 +86,7 @@ lvm2_activation_generator_systemd_red_hat: $(OBJECTS) $(DEPLIBS) $(INTERNAL_LIBS
 
 install_systemd_generators:
 	$(INSTALL_DIR) $(systemd_generator_dir)
-ifeq ("@APPLIB@", "yes")
 	$(INSTALL_PROGRAM) lvm2_activation_generator_systemd_red_hat $(systemd_generator_dir)/lvm2-activation-generator
-else
-	@echo "WARNING: LVM2 activation systemd generator not installed." \
-	      "It requires the LVM2 application library to be built as well."
-endif
 
 install_systemd_units:	install_dbus_service
 	$(INSTALL_DIR) $(systemd_unit_dir)
scripts/generator-internals.c new file +200 -0

200 lines not on this page · raw message

scripts/lvm2_activation_generator_systemd_red_hat.c +138 -94

323 lines not on this page · raw message

test/unit/Makefile.in +3 -3
index 994968c..e7cc852 100644
@@ -14,6 +14,7 @@ UNIT_SOURCE=\
 	base/data-struct/radix-tree.c \
 	device_mapper/vdo/status.c \
 	\
+	test/unit/activation-generator_t.c \
 	test/unit/bcache_t.c \
 	test/unit/bcache_utils_t.c \
 	test/unit/bitset_t.c \
@@ -32,12 +33,11 @@ UNIT_SOURCE=\
 UNIT_DEPENDS=$(subst .c,.d,$(UNIT_SOURCE))
 UNIT_OBJECTS=$(UNIT_SOURCE:%.c=%.o)
 CLEAN_TARGETS+=$(UNIT_DEPENDS) $(UNIT_OBJECTS)
-UNIT_LDLIBS += $(LVMINTERNAL_LIBS) -laio
 
-test/unit/unit-test: $(UNIT_OBJECTS) lib/liblvm-internal.a $(INTERNAL_LIBS)
+test/unit/unit-test: $(UNIT_OBJECTS) lib/liblvm-internal.a libdaemon/client/libdaemonclient.a $(INTERNAL_LIBS)
 	@echo "    [LD] $@"
 	$(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) \
-	      -o $@ $+ $(UNIT_LDLIBS) -lm
+	      -o $@ $+ $(LIBS) -lm -ldl -laio
 
 .PHONEY: run-unit-test
 run-unit-test: test/unit/unit-test
test/unit/units.h +2 -0
index d7ac6ad..bc0db8d 100644
@@ -20,6 +20,7 @@
 //-----------------------------------------------------------------
 
 // Declare the function that adds tests suites here ...
+void activation_generator_tests(struct dm_list *suites);
 void bcache_tests(struct dm_list *suites);
 void bcache_utils_tests(struct dm_list *suites);
 void bitset_tests(struct dm_list *suites);
@@ -36,6 +37,7 @@ void vdo_tests(struct dm_list *suites);
 // ... and call it in here.
 static inline void register_all_tests(struct dm_list *suites)
 {
+        activation_generator_tests(suites);
 	bcache_tests(suites);
 	bcache_utils_tests(suites);
 	bitset_tests(suites);