main - makefiles: static linking enhancements
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=aee0cd6530c6340f6f0...
Commit: aee0cd6530c6340f6f0a8256b887c8561f29dde6
Parent: 01f108c4d03f848a84bff74104dd18b21c7a8e3f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 8 19:44:53 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Apr 12 09:54:15 2021 +0200
makefiles: static linking enhancements
---
Makefile.in | 3 +--
daemons/dmeventd/Makefile.in | 8 ++++----
daemons/lvmlockd/Makefile.in | 14 ++++++--------
libdm/Makefile.in | 6 ++----
libdm/dm-tools/Makefile.in | 25 +++++++++++++------------
libdm/make.tmpl.in | 6 ++----
make.tmpl.in | 6 ++++--
test/Makefile.in | 2 +-
test/unit/Makefile | 9 ++++++---
tools/Makefile.in | 13 ++++++-------
10 files changed, 45 insertions(+), 47 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 69c73598e..5dd642f63 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -18,7 +18,7 @@ top_builddir = @top_builddir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
-SUBDIRS = conf daemons include lib libdaemon libdm man scripts tools
+SUBDIRS = libdm conf daemons include lib libdaemon man scripts tools
ifeq ("@UDEV_RULES@", "yes")
SUBDIRS += udev
@@ -56,7 +56,6 @@ tools: lib libdaemon
po: tools daemons
man: tools
all_man: tools
-scripts: libdm
test: tools daemons
unit-test run-unit-test: test
diff --git a/daemons/dmeventd/Makefile.in b/daemons/dmeventd/Makefile.in
index d688a0d3b..af51198aa 100644
--- a/daemons/dmeventd/Makefile.in
+++ b/daemons/dmeventd/Makefile.in
@@ -47,6 +47,7 @@ endif
LIB_VERSION = $(LIB_VERSION_DM)
LIB_SHARED = $(LIB_NAME).$(LIB_SUFFIX)
+LIBS = $(PTHREAD_LIBS) -L$(interfacebuilddir) -ldevmapper
CLEAN_TARGETS = dmeventd.static $(LIB_NAME).a
@@ -67,16 +68,15 @@ device-mapper: $(TARGETS)
plugins.device-mapper: $(LIB_SHARED)
CFLAGS_dmeventd.o += $(EXTRA_EXEC_CFLAGS)
-LIBS += $(PTHREAD_LIBS) -L$(top_builddir)/libdm -ldevmapper
dmeventd: $(LIB_SHARED) dmeventd.o
@echo " [CC] $@"
- $(Q) $(CC) $(CFLAGS) -L. $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) dmeventd.o \
- -o $@ $(DL_LIBS) $(DMEVENT_LIBS) $(LIBS) -lm
+ $(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) dmeventd.o \
+ -o $@ $(DL_LIBS) $(DMEVENT_LIBS) $(LIBS)
dmeventd.static: $(LIB_STATIC) dmeventd.o
@echo " [CC] $@"
- $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -static -L. -L$(interfacebuilddir) dmeventd.o \
+ $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -static dmeventd.o \
-o $@ $(DL_LIBS) $(DMEVENT_LIBS) $(LIBS) $(STATIC_LIBS)
ifeq ("@PKGCONFIG@", "yes")
diff --git a/daemons/lvmlockd/Makefile.in b/daemons/lvmlockd/Makefile.in
index ec5d5750a..e69ab9127 100644
--- a/daemons/lvmlockd/Makefile.in
+++ b/daemons/lvmlockd/Makefile.in
@@ -37,29 +37,27 @@ TARGETS = lvmlockd lvmlockctl
CFLOW_SOURCES = $(addprefix $(srcdir)/, $(SOURCES))
CFLOW_TARGET = lvmlockd
-.PHONY: install_lvmlockd
+.PHONY: install_lvmlockd install_lvmlockctl
include $(top_builddir)/make.tmpl
CFLAGS += $(EXTRA_EXEC_CFLAGS)
INCLUDES += -I$(top_srcdir)/libdaemon/server
LDFLAGS += -L$(top_builddir)/libdaemon/server $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS)
-LIBS += $(RT_LIBS) $(DAEMON_LIBS) $(PTHREAD_LIBS)
-
+LIBS += $(DAEMON_LIBS) $(PTHREAD_LIBS)
ifeq ($(USE_SD_NOTIFY),yes)
CFLAGS += $(shell pkg-config --cflags libsystemd) -DUSE_SD_NOTIFY
LIBS += $(shell pkg-config --libs libsystemd)
endif
-lvmlockd: $(OBJECTS) $(top_builddir)/libdaemon/client/libdaemonclient.a \
- $(top_builddir)/libdaemon/server/libdaemonserver.a
+lvmlockd: $(OBJECTS) $(top_builddir)/libdaemon/server/libdaemonserver.a $(INTERNAL_LIBS)
@echo " [CC] $@"
- $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) $(LOCK_LIBS) -ldaemonserver $(INTERNAL_LIBS) $(LIBS)
+ $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+ $(LOCK_LIBS) $(LIBS)
-lvmlockctl: lvmlockctl.o $(top_builddir)/libdaemon/client/libdaemonclient.a
+lvmlockctl: lvmlockctl.o $(INTERNAL_LIBS)
@echo " [CC] $@"
- $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(INTERNAL_LIBS) $(LIBS)
+ $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $+ $(LIBS)
install_lvmlockd: lvmlockd
@echo " [INSTALL] $<"
diff --git a/libdm/Makefile.in b/libdm/Makefile.in
index a78d2b517..35115d7f0 100644
--- a/libdm/Makefile.in
+++ b/libdm/Makefile.in
@@ -59,11 +59,9 @@ include $(top_builddir)/libdm/make.tmpl
PROGS_CFLAGS = $(UDEV_CFLAGS)
-LIBS += $(SELINUX_LIBS) $(UDEV_LIBS) $(PTHREAD_LIBS) $(RT_LIBS) $(M_LIBS)
+device-mapper: $(TARGETS)
-device-mapper: all
-
-dm-tools.device-mapper: $(TARGETS)
+dm-tools.device-mapper: device-mapper
libdevmapper.$(LIB_SUFFIX) libdevmapper.$(LIB_SUFFIX).$(LIB_VERSION): $(LIB_SHARED)
@echo " [LN] $<"
diff --git a/libdm/dm-tools/Makefile.in b/libdm/dm-tools/Makefile.in
index 8fbdfc152..9ddb3c261 100644
--- a/libdm/dm-tools/Makefile.in
+++ b/libdm/dm-tools/Makefile.in
@@ -52,18 +52,19 @@ include $(top_builddir)/libdm/make.tmpl
CFLAGS_dmsetup.o += $(UDEV_CFLAGS) $(EXTRA_EXEC_CFLAGS)
CFLAGS_dmfilemapd.o += $(EXTRA_EXEC_CFLAGS)
-LDFLAGS += -L$(interfacebuilddir)
-DMLIBS = -ldevmapper
+LIBDM_LIBS = -L$(interfacebuilddir) -ldevmapper
+LIBDM_SHARED = $(interfacebuilddir)/libdevmapper.so
+LIBDM_STATIC = $(interfacebuilddir)/libdevmapper.a
-dmsetup: dmsetup.o
+dmsetup: dmsetup.o $(LIBDM_SHARED)
@echo " [CC] $@"
$(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) \
- -o $@ $+ $(DMLIBS)
+ -o $@ $< $(LIBDM_LIBS) $(LIBS)
-dmsetup.static: dmsetup.o
+dmsetup.static: dmsetup.o $(LIBDM_STATIC)
@echo " [CC] $@"
$(Q) $(CC) $(CFLAGS) $(LDFLAGS) -static \
- -o $@ $+ $(DMLIBS) $(STATIC_LIBS)
+ -o $@ $< $(LIBDM_LIBS) $(LIBS) $(STATIC_LIBS)
install_dmsetup_dynamic: dmsetup
@echo " [INSTALL] $<"
@@ -73,18 +74,18 @@ install_dmsetup_dynamic: dmsetup
install_dmsetup_static: dmsetup.static
@echo " [INSTALL] $<"
$(Q) $(INSTALL_PROGRAM) -D $< $(staticdir)/$(<F)
- $(Q) $(LN_S) -f $(<F) $(staticdir)/dmstats
+ $(Q) $(LN_S) -f $(<F) $(staticdir)/dmstats.static
-dmfilemapd: dmfilemapd.o $(LIB_SHARED)
+dmfilemapd: dmfilemapd.o $(LIBDM_SHARED)
@echo " [CC] $@"
$(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) \
- -o $@ $+ $(DMLIBS)
+ -o $@ $< $(LIBDM_LIBS) $(LIBS)
-dmfilemapd.static: dmfilemapd.o $(LIB_STATIC)
+dmfilemapd.static: dmfilemapd.o $(LIBDM_STATIC)
@echo " [CC] $@"
- $(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(ELDFLAGS) -static \
- -o $@ $+ $(DMLIBS) $(STATIC_LIBS)
+ $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -static \
+ -o $@ $< $(LIBDM_LIBS) $(LIBS) $(STATIC_LIBS)
install_dmfilemapd_dynamic: dmfilemapd
@echo " [INSTALL] $<"
diff --git a/libdm/make.tmpl.in b/libdm/make.tmpl.in
index 9ef39fc0a..f7a5a7a73 100644
--- a/libdm/make.tmpl.in
+++ b/libdm/make.tmpl.in
@@ -53,11 +53,9 @@ WC = @WC@
AR = @AR@
RM = rm -f
-
-LIBS = @LIBS@
-LIBS += $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS) $(RT_LIBS) -lm
+LIBS += @LIBS@ $(PTHREAD_LIBS) $(SELINUX_LIBS) $(UDEV_LIBS) $(RT_LIBS) $(M_LIBS)
# Extra libraries always linked with static binaries
-STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS)
+STATIC_LIBS = $(PTHREAD_LIBS)
DEFS += @DEFS@
# FIXME set this only where it's needed, not globally?
CFLAGS ?= @COPTIMISE_FLAG@ @CFLAGS@
diff --git a/make.tmpl.in b/make.tmpl.in
index b28ef6f8f..14557c4c4 100644
--- a/make.tmpl.in
+++ b/make.tmpl.in
@@ -61,9 +61,10 @@ PYTHON2 = @PYTHON2@
PYTHON3 = @PYTHON3@
PYCOMPILE = $(top_srcdir)/autoconf/py-compile
-LIBS += @LIBS@ $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS) $(RT_LIBS) $(M_LIBS)
+LIBS += @LIBS@ $(SELINUX_LIBS) $(UDEV_LIBS) $(RT_LIBS) $(M_LIBS)
+LVMLIBS = $(DMEVENT_LIBS) $(READLINE_LIBS) $(EDITLINE_LIBS) $(SYSTEMD_LIBS) $(BLKID_LIBS) $(AIO_LIBS) $(LIBS)
# Extra libraries always linked with static binaries
-STATIC_LIBS = $(SELINUX_LIBS) $(UDEV_LIBS) $(BLKID_LIBS)
+STATIC_LIBS = $(PTHREAD_LIBS)
DEFS += @DEFS@
# FIXME set this only where it's needed, not globally?
CFLAGS ?= @COPTIMISE_FLAG@ @CFLAGS@
@@ -146,6 +147,7 @@ vpath %.po $(srcdir)
vpath %.exported_symbols $(srcdir)
interface = @interface@
+interfacebuilddir = $(top_builddir)/libdm/$(interface)
rpmbuilddir = $(abs_top_builddir)/build
# The number of jobs to run, if blank, defaults to the make standard
diff --git a/test/Makefile.in b/test/Makefile.in
index 41ddb9d8e..e4cd3aac5 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -258,7 +258,7 @@ lib/dmsecuretest: lib/dmsecuretest.o .lib-dir-stamp $(INTERNAL_LIBS)
lib/securetest: lib/dmsecuretest.o .lib-dir-stamp
@echo " [CC] $@"
- $(Q) $(CC) -g $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) -o $@ $< -L$(top_builddir)/libdm/ioctl -ldevmapper $(LIBS)
+ $(Q) $(CC) -g $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) -o $@ $< -L$(interfacebuilddir) -ldevmapper $(LIBS)
lib/runner.o: $(wildcard $(srcdir)/lib/*.h)
diff --git a/test/unit/Makefile b/test/unit/Makefile
index 7bc711719..455c18d2a 100644
--- a/test/unit/Makefile
+++ b/test/unit/Makefile
@@ -42,16 +42,19 @@ CLEAN_TARGETS += $(UNIT_DEPENDS) $(UNIT_OBJECTS) \
$(UNIT_SOURCE:%.c=%.gcno) \
$(UNIT_TARGET)
+lib/liblvm-internal.a: lib
+libdaemon/client/libdaemonclient.a: libdaemon
+
$(UNIT_TARGET): $(UNIT_OBJECTS) $(LVMINTERNAL_LIBS)
@echo " [LD] $@"
$(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) \
- -o $@ $+ $(DMEVENT_LIBS) $(SYSTEMD_LIBS) -L$(top_builddir)/libdm -ldevmapper $(LIBS) -laio
+ -o $@ $+ $(LVMLIBS)
-.PHONEY: run-unit-test unit-test
+.PHONY: run-unit-test unit-test
unit-test: $(UNIT_TARGET)
run-unit-test: $(UNIT_TARGET)
@echo "Running unit tests"
- LD_LIBRARY_PATH=libdm $(UNIT_TARGET) run
+ LD_LIBRARY_PATH=$(top_builddir)/libdm $(UNIT_TARGET) run
ifeq ("$(DEPENDS)","yes")
-include $(UNIT_SOURCE:%.c=%.d)
diff --git a/tools/Makefile.in b/tools/Makefile.in
index e871fbddd..ec546ca63 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -83,7 +83,7 @@ TARGETS =\
INSTALL_LVM_TARGETS = install_tools_dynamic
INSTALL_DMSETUP_TARGETS =
-INSTALL_CMDLIB_TARGETS = install_cmdlib_dynamic install_cmdlib_include
+INSTALL_CMDLIB_TARGETS = install_cmdlib_dynamic install_cmdlib_include
ifeq ("@STATIC_LINK@", "yes")
TARGETS += lvm.static
@@ -91,7 +91,6 @@ ifeq ("@STATIC_LINK@", "yes")
INSTALL_CMDLIB_TARGETS += install_cmdlib_static
endif
-LVMLIBS = $(SYSTEMD_LIBS) -L$(top_builddir)/libdm -ldevmapper $(LIBS) -laio
LIB_VERSION = $(LIB_VERSION_LVM)
INCLUDES = -I$(top_builddir)/tools
@@ -123,8 +122,8 @@ CFLAGS_lvm.o += $(EXTRA_EXEC_CFLAGS)
lvm: $(OBJECTS) lvm.o $(LVMINTERNAL_LIBS)
@echo " [CC] $@"
- $(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) -o $@ $+ \
- $(DMEVENT_LIBS) $(READLINE_LIBS) $(EDITLINE_LIBS) $(LVMLIBS)
+ $(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) \
+ -o $@ $+ $(LVMLIBS)
DEFS_man-generator.o += -DMAN_PAGE_GENERATOR
@@ -138,8 +137,8 @@ man-generator: man-generator.o
lvm.static: $(OBJECTS) lvm-static.o $(LVMINTERNAL_LIBS)
@echo " [CC] $@"
- $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) -o $@ $+ \
- $(DMEVENT_LIBS) $(STATIC_LIBS) $(LVMLIBS)
+ $(Q) $(CC) $(CFLAGS) $(LDFLAGS) -static -L$(interfacebuilddir) \
+ -o $@ $+ $(LVMLIBS) $(STATIC_LIBS)
liblvm2cmd.a: $(top_builddir)/lib/liblvm-internal.a $(OBJECTS) lvmcmdlib.o lvm2cmd.o
@echo " [AR] $@"
@@ -156,7 +155,7 @@ liblvm2cmd.$(LIB_SUFFIX): liblvm2cmd.a $(LDDEPS)
$(Q) $(CC) -shared -Wl,-soname,$@.$(LIB_VERSION) \
$(CFLAGS) $(CLDFLAGS) -o $@ \
@CLDWHOLEARCHIVE@ $< @CLDNOWHOLEARCHIVE@ \
- $(LVMINTERNAL_LIBS) $(LVMLIBS)
+ $(INTERNAL_LIBS) $(LVMLIBS)
liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION): liblvm2cmd.$(LIB_SUFFIX)
@echo " [LN] $@"
3 years
main - tests: skip autoactivation-metadata with lvmlockd
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=01f108c4d03f848a84b...
Commit: 01f108c4d03f848a84bff74104dd18b21c7a8e3f
Parent: 0a28e3c44b05470061f15516e1c89a84fa2e8569
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Apr 8 16:08:45 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Apr 8 16:08:45 2021 -0500
tests: skip autoactivation-metadata with lvmlockd
shared vgs are not autoactivated
---
test/shell/autoactivation-metadata.sh | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/test/shell/autoactivation-metadata.sh b/test/shell/autoactivation-metadata.sh
index 4ee2b75c0..3cdb5b315 100644
--- a/test/shell/autoactivation-metadata.sh
+++ b/test/shell/autoactivation-metadata.sh
@@ -1,5 +1,6 @@
SKIP_WITH_LVMPOLLD=1
+SKIP_WITH_LVMLOCKD=1
RUNDIR="/run"
test -d "$RUNDIR" || RUNDIR="/var/run"
@@ -24,7 +25,7 @@ aux prepare_devs 1
#
# default
-vgcreate $SHARED $vg "$dev1"
+vgcreate $vg "$dev1"
lvcreate -n $lv1 -l1 -an $vg
check vg_field $vg autoactivation "enabled"
check lv_field $vg/$lv1 autoactivation "enabled"
@@ -84,7 +85,7 @@ vgremove -y $vg
#
# default
-vgcreate $SHARED $vg "$dev1"
+vgcreate $vg "$dev1"
lvcreate -n $lv1 -l1 -an $vg
# --aa=n
@@ -127,7 +128,7 @@ vgremove -y $vg
# test vgcreate --setautoactivation, lvcreate --setautoactivation
#
-vgcreate $SHARED $vg "$dev1"
+vgcreate $vg "$dev1"
lvcreate -n $lv1 -l1 -an $vg
lvcreate -n $lv2 -l1 --setautoactivation y -an $vg
lvcreate -n $lv3 -l1 --setautoactivation n -an $vg
@@ -155,7 +156,7 @@ vgchange -an $vg
vgremove -y $vg
_clear_online_files
-vgcreate $SHARED --setautoactivation y $vg "$dev1"
+vgcreate --setautoactivation y $vg "$dev1"
lvcreate -n $lv1 -l1 -an $vg
lvcreate -n $lv2 -l1 --setautoactivation y -an $vg
lvcreate -n $lv3 -l1 --setautoactivation n -an $vg
@@ -183,7 +184,7 @@ vgchange -an $vg
vgremove -y $vg
_clear_online_files
-vgcreate $SHARED --setautoactivation n $vg "$dev1"
+vgcreate --setautoactivation n $vg "$dev1"
lvcreate -n $lv1 -l1 -an $vg
lvcreate -n $lv2 -l1 --setautoactivation y -an $vg
lvcreate -n $lv3 -l1 --setautoactivation n -an $vg
@@ -213,7 +214,7 @@ _clear_online_files
# test combination of --aa and auto_activation_volume_list
#
-vgcreate $SHARED $vg "$dev1"
+vgcreate $vg "$dev1"
lvcreate -n $lv1 -l1 -an $vg
lvcreate -n $lv2 -l1 --setautoactivation n -an $vg
check vg_field $vg autoactivation "enabled"
@@ -290,7 +291,7 @@ _clear_online_files
vgremove -y $vg
-vgcreate $SHARED --setautoactivation n $vg "$dev1"
+vgcreate --setautoactivation n $vg "$dev1"
lvcreate -n $lv1 -l1 -an $vg
lvcreate -n $lv2 -l1 --setautoactivation n -an $vg
check vg_field $vg autoactivation ""
3 years
main - Add metadata-based autoactivation property for VG and LV
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0a28e3c44b05470061f...
Commit: 0a28e3c44b05470061f15516e1c89a84fa2e8569
Parent: 6f6583afede02dddec41b85f896c9d4e73d87beb
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Apr 1 17:20:00 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Apr 7 15:32:49 2021 -0500
Add metadata-based autoactivation property for VG and LV
The autoactivation property can be specified in lvcreate
or vgcreate for new LVs/VGs, and the property can be changed
by lvchange or vgchange for existing LVs/VGs.
--setautoactivation y|n
enables|disables autoactivation of a VG or LV.
Autoactivation is enabled by default, which is consistent with
past behavior. The disabled state is stored as a new flag
in the VG metadata, and the absence of the flag allows
autoactivation.
If autoactivation is disabled for the VG, then no LVs in the VG
will be autoactivated (the LV autoactivation property will have
no effect.) When autoactivation is enabled for the VG, then
autoactivation can be controlled on individual LVs.
The state of this property can be reported for LVs/VGs using
the "-o autoactivation" option in lvs/vgs commands, which will
report "enabled", or "" for the disabled state.
Previous versions of lvm do not recognize this property. Since
autoactivation is enabled by default, the disabled setting will
have no effect in older lvm versions. If the VG is modified by
older lvm versions, the disabled state will also be dropped from
the metadata.
The autoactivation property is an alternative to using the lvm.conf
auto_activation_volume_list, which is still applied to to VGs/LVs
in addition to the new property.
If VG or LV autoactivation is disabled either in metadata or in
auto_activation_volume_list, it will not be autoactivated.
An autoactivation command will silently skip activating an LV
when the autoactivation property is disabled.
To determine the effective autoactivation behavior for a specific
LV, multiple settings would need to be checked:
the VG autoactivation property, the LV autoactivation property,
the auto_activation_volume_list. The "activation skip" property
would also be relevant, since it applies to both normal and auto
activation.
---
lib/config/config_settings.h | 40 ++--
lib/format_text/flags.c | 2 +
lib/metadata/lv_manip.c | 4 +
lib/metadata/metadata-exported.h | 6 +-
lib/metadata/metadata.h | 1 -
lib/report/columns.h | 2 +
lib/report/properties.c | 4 +
lib/report/report.c | 17 ++
test/shell/autoactivation-metadata.sh | 335 ++++++++++++++++++++++++++++++++++
tools/args.h | 28 ++-
tools/command-lines.in | 9 +-
tools/lvchange.c | 32 ++++
tools/lvcreate.c | 3 +
tools/vgchange.c | 31 ++++
tools/vgcreate.c | 3 +
15 files changed, 486 insertions(+), 31 deletions(-)
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index a19402d9d..3946a7129 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -1119,10 +1119,12 @@ cfg(global_event_activation_CFG, "event_activation", global_CFG_SECTION, CFG_DEF
"Activate LVs based on system-generated device events.\n"
"When a device appears on the system, a system-generated event runs\n"
"the pvscan command to activate LVs if the new PV completes the VG.\n"
- "Use auto_activation_volume_list to select which LVs should be\n"
- "activated from these events (the default is all.)\n"
"When event_activation is disabled, the system will generally run\n"
- "a direct activation command to activate LVs in complete VGs.\n")
+ "a direct activation command to activate LVs in complete VGs.\n"
+ "Activation commands that are run by the system, either from events\n"
+ "or at fixed points during startup, use autoactivation (-aay). See\n"
+ "the --setautoactivation option or the auto_activation_volume_list\n"
+ "setting to configure autoactivation for specific VGs or LVs.\n")
cfg(global_use_lvmetad_CFG, "use_lvmetad", global_CFG_SECTION, 0, CFG_TYPE_BOOL, 0, vsn(2, 2, 93), 0, vsn(2, 3, 0), NULL,
NULL)
@@ -1402,22 +1404,22 @@ cfg_array(activation_volume_list_CFG, "volume_list", activation_CFG_SECTION, CFG
"#\n")
cfg_array(activation_auto_activation_volume_list_CFG, "auto_activation_volume_list", activation_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 97), NULL, 0, NULL,
- "Only LVs selected by this list are auto-activated.\n"
- "This list works like volume_list, but it is used only by\n"
- "auto-activation commands. It does not apply to direct activation\n"
- "commands. If this list is defined, an LV is only auto-activated\n"
- "if it matches an entry in this list. If this list is undefined, it\n"
- "imposes no limits on LV auto-activation (all are allowed.) If this\n"
- "list is defined and empty, i.e. \"[]\", then no LVs are selected for\n"
- "auto-activation. An LV that is selected by this list for\n"
- "auto-activation, must also be selected by volume_list (if defined)\n"
- "before it is activated. Auto-activation is an activation command that\n"
- "includes the 'a' argument: --activate ay or -a ay. The 'a' (auto)\n"
- "argument for auto-activation is meant to be used by activation\n"
- "commands that are run automatically by the system, as opposed to LVM\n"
- "commands run directly by a user. A user may also use the 'a' flag\n"
- "directly to perform auto-activation. Also see pvscan(8) for more\n"
- "information about auto-activation.\n"
+ "A list of VGs or LVs that should be autoactivated.\n"
+ "Autoactivation is an activation command run with -aay,\n"
+ "i.e. vgchange -aay, lvchange -aay, or pvscan --cache -aay.\n"
+ "When this list is defined, an autoactivation command will only\n"
+ "activate LVs included in the list. If this list is undefined,\n"
+ "it has no effect. If this list is defined but empty, then no\n"
+ "LVs will be autoactivated. LVs can be included in the list by\n"
+ "LV name, VG name (applies to all LVs in the VG), or tag name.\n"
+ "VGs and LVs can also have an autoactivation property set in\n"
+ "metadata, see --setautoactivation. LVs included in this list\n"
+ "will not be autoactivated if the VG or LV autoactivation\n"
+ "property is disabled (see vgs or lvs \"-o autoactivation\").\n"
+ "The volume_list setting and the \"activation skip\" property\n"
+ "also apply to autoactivation.\n"
+ "The -aay option is meant to be used by activation commands that\n"
+ "are run automatically by the system, e.g. from systemd services.\n"
"#\n"
"Accepted values:\n"
" vgname\n"
diff --git a/lib/format_text/flags.c b/lib/format_text/flags.c
index 4cee14aa7..3890a40cc 100644
--- a/lib/format_text/flags.c
+++ b/lib/format_text/flags.c
@@ -35,6 +35,7 @@ static const struct flag _vg_flags[] = {
{LVM_READ, "READ", STATUS_FLAG},
{LVM_WRITE, "WRITE", STATUS_FLAG},
{LVM_WRITE_LOCKED, "WRITE_LOCKED", COMPATIBLE_FLAG},
+ {NOAUTOACTIVATE, "NOAUTOACTIVATE", COMPATIBLE_FLAG},
{CLUSTERED, "CLUSTERED", STATUS_FLAG},
{SHARED, "SHARED", STATUS_FLAG},
{PARTIAL_VG, NULL, 0},
@@ -70,6 +71,7 @@ static const struct flag _lv_flags[] = {
{LV_REMOVE_AFTER_RESHAPE, "REMOVE_AFTER_RESHAPE", SEGTYPE_FLAG},
{LV_WRITEMOSTLY, "WRITEMOSTLY", STATUS_FLAG},
{LV_ACTIVATION_SKIP, "ACTIVATION_SKIP", COMPATIBLE_FLAG},
+ {LV_NOAUTOACTIVATE, "NOAUTOACTIVATE", COMPATIBLE_FLAG},
{LV_ERROR_WHEN_FULL, "ERROR_WHEN_FULL", COMPATIBLE_FLAG},
{LV_METADATA_FORMAT, "METADATA_FORMAT", SEGTYPE_FLAG},
{LV_CROP_METADATA, "CROP_METADATA", SEGTYPE_FLAG},
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index b38acf883..ff2a673eb 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -8569,6 +8569,10 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
lv_set_activation_skip(lv, lp->activation_skip & ACTIVATION_SKIP_SET,
lp->activation_skip & ACTIVATION_SKIP_SET_ENABLED);
+
+ if (lp->noautoactivate)
+ lv->status |= LV_NOAUTOACTIVATE;
+
/*
* Check for autoactivation.
* If the LV passes the auto activation filter, activate
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 8ae067ebc..c6116350f 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -57,7 +57,9 @@
#define ALLOCATABLE_PV UINT64_C(0x0000000000000008) /* PV */
#define ARCHIVED_VG ALLOCATABLE_PV /* VG, reuse same bit */
-//#define SPINDOWN_LV UINT64_C(0x0000000000000010) /* LV */
+#define LV_NOAUTOACTIVATE UINT64_C(0x0000000000000010) /* LV - also a PV flag */
+#define NOAUTOACTIVATE UINT64_C(0x0000000000000010) /* VG - also a PV flag */
+
//#define BADBLOCK_ON UINT64_C(0x0000000000000020) /* LV */
#define VISIBLE_LV UINT64_C(0x0000000000000040) /* LV */
#define FIXED_MINOR UINT64_C(0x0000000000000080) /* LV */
@@ -159,6 +161,7 @@
#define LV_CACHE_USES_CACHEVOL UINT64_C(0x4000000000000000) /* LV - also a PV flag */
+
/* Format features flags */
#define FMT_SEGMENTS 0x00000001U /* Arbitrary segment params? */
// #define FMT_MDAS 0x00000002U /* Proper metadata areas? */
@@ -972,6 +975,7 @@ struct lvcreate_params {
#define ACTIVATION_SKIP_SET_ENABLED 0x02 /* set the LV activation skip flag state to 'enabled' */
#define ACTIVATION_SKIP_IGNORE 0x04 /* request to ignore LV activation skip flag (if any) */
int activation_skip; /* activation skip flags */
+ int noautoactivate; /* 1 if --setautoactivation n */
activation_change_t activate; /* non-snapshot, non-mirror */
thin_discards_t discards; /* thin */
thin_zero_t zero_new_blocks;
diff --git a/lib/metadata/metadata.h b/lib/metadata/metadata.h
index 3ea77ce2e..dfd576e3c 100644
--- a/lib/metadata/metadata.h
+++ b/lib/metadata/metadata.h
@@ -55,7 +55,6 @@
/* May any free extents on this PV be used or must they be left free? */
-#define SPINDOWN_LV UINT64_C(0x00000010) /* LV */
#define BADBLOCK_ON UINT64_C(0x00000020) /* LV */
//#define VIRTUAL UINT64_C(0x00010000) /* LV - internal use only */
#define PRECOMMITTED UINT64_C(0x00200000) /* VG - internal use only */
diff --git a/lib/report/columns.h b/lib/report/columns.h
index 8d2f7a993..12b78b766 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -61,6 +61,7 @@ FIELD(LVS, lv, STR, "AllocPol", lvid, 10, lvallocationpolicy, lv_allocation_poli
FIELD(LVS, lv, BIN, "AllocLock", lvid, 10, lvallocationlocked, lv_allocation_locked, "Set if LV is locked against allocation changes.", 0)
FIELD(LVS, lv, BIN, "FixMin", lvid, 10, lvfixedminor, lv_fixed_minor, "Set if LV has fixed minor number assigned.", 0)
FIELD(LVS, lv, BIN, "SkipAct", lvid, 15, lvskipactivation, lv_skip_activation, "Set if LV is skipped on activation.", 0)
+FIELD(LVS, lv, BIN, "AutoAct", lvid, 0, lvautoactivation, lv_autoactivation, "Set if LV autoactivation is enabled.", 0)
FIELD(LVS, lv, STR, "WhenFull", lvid, 15, lvwhenfull, lv_when_full, "For thin pools, behavior when full.", 0)
FIELD(LVS, lv, STR, "Active", lvid, 0, lvactive, lv_active, "Active state of the LV.", 0)
FIELD(LVS, lv, BIN, "ActLocal", lvid, 10, lvactivelocally, lv_active_locally, "Set if the LV is active locally.", 0)
@@ -222,6 +223,7 @@ FIELD(VGS, vg, STR, "Attr", cmd, 5, vgstatus, vg_attr, "Various attributes - see
FIELD(VGS, vg, STR, "VPerms", cmd, 10, vgpermissions, vg_permissions, "VG permissions.", 0)
FIELD(VGS, vg, BIN, "Extendable", cmd, 0, vgextendable, vg_extendable, "Set if VG is extendable.", 0)
FIELD(VGS, vg, BIN, "Exported", cmd, 10, vgexported, vg_exported, "Set if VG is exported.", 0)
+FIELD(VGS, vg, BIN, "AutoAct", cmd, 0, vgautoactivation, vg_autoactivation, "Set if VG autoactivation is enabled.", 0)
FIELD(VGS, vg, BIN, "Partial", cmd, 10, vgpartial, vg_partial, "Set if VG is partial.", 0)
FIELD(VGS, vg, STR, "AllocPol", cmd, 10, vgallocationpolicy, vg_allocation_policy, "VG allocation policy.", 0)
FIELD(VGS, vg, BIN, "Clustered", cmd, 10, vgclustered, vg_clustered, "Set if VG is clustered.", 0)
diff --git a/lib/report/properties.c b/lib/report/properties.c
index f2174b83c..12ea890f4 100644
--- a/lib/report/properties.c
+++ b/lib/report/properties.c
@@ -269,6 +269,8 @@ GET_PV_STR_PROPERTY_FN(pv_device_id_type, pv->device_id_type)
#define _vg_extendable_get prop_not_implemented_get
#define _vg_exported_set prop_not_implemented_set
#define _vg_exported_get prop_not_implemented_get
+#define _vg_autoactivation_set prop_not_implemented_set
+#define _vg_autoactivation_get prop_not_implemented_get
#define _vg_partial_set prop_not_implemented_set
#define _vg_partial_get prop_not_implemented_get
#define _vg_allocation_policy_set prop_not_implemented_set
@@ -323,6 +325,8 @@ GET_PV_STR_PROPERTY_FN(pv_device_id_type, pv->device_id_type)
#define _lv_skip_activation_get prop_not_implemented_get
#define _lv_check_needed_set prop_not_implemented_set
#define _lv_check_needed_get prop_not_implemented_get
+#define _lv_autoactivation_set prop_not_implemented_set
+#define _lv_autoactivation_get prop_not_implemented_get
#define _lv_historical_set prop_not_implemented_set
#define _lv_historical_get prop_not_implemented_get
diff --git a/lib/report/report.c b/lib/report/report.c
index 2f5811a96..222d3f4b6 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -3573,6 +3573,15 @@ static int _vgexported_disp(struct dm_report *rh, struct dm_pool *mem,
return _binary_disp(rh, mem, field, exported, GET_FIRST_RESERVED_NAME(vg_exported_y), private);
}
+static int _vgautoactivation_disp(struct dm_report *rh, struct dm_pool *mem,
+ struct dm_report_field *field,
+ const void *data, void *private)
+{
+ const struct volume_group *vg = (const struct volume_group *)data;
+ int aa_yes = (vg->status & NOAUTOACTIVATE) ? 0 : 1;
+ return _binary_disp(rh, mem, field, aa_yes, "enabled", private);
+}
+
static int _vgpartial_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
@@ -3969,6 +3978,14 @@ static int _lvskipactivation_disp(struct dm_report *rh, struct dm_pool *mem,
return _binary_disp(rh, mem, field, skip_activation, "skip activation", private);
}
+static int _lvautoactivation_disp(struct dm_report *rh, struct dm_pool *mem,
+ struct dm_report_field *field,
+ const void *data, void *private)
+{
+ int aa_yes = (((const struct logical_volume *) data)->status & LV_NOAUTOACTIVATE) ? 0 : 1;
+ return _binary_disp(rh, mem, field, aa_yes, "enabled", private);
+}
+
static int _lvhistorical_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
diff --git a/test/shell/autoactivation-metadata.sh b/test/shell/autoactivation-metadata.sh
new file mode 100644
index 000000000..4ee2b75c0
--- /dev/null
+++ b/test/shell/autoactivation-metadata.sh
@@ -0,0 +1,335 @@
+
+SKIP_WITH_LVMPOLLD=1
+
+RUNDIR="/run"
+test -d "$RUNDIR" || RUNDIR="/var/run"
+PVS_ONLINE_DIR="$RUNDIR/lvm/pvs_online"
+VGS_ONLINE_DIR="$RUNDIR/lvm/vgs_online"
+PVS_LOOKUP_DIR="$RUNDIR/lvm/pvs_lookup"
+
+_clear_online_files() {
+ # wait till udev is finished
+ aux udev_wait
+ rm -f "$PVS_ONLINE_DIR"/*
+ rm -f "$VGS_ONLINE_DIR"/*
+ rm -f "$PVS_LOOKUP_DIR"/*
+}
+
+. lib/inittest
+
+aux prepare_devs 1
+
+#
+# test lvchange --setautoactivation
+#
+
+# default
+vgcreate $SHARED $vg "$dev1"
+lvcreate -n $lv1 -l1 -an $vg
+check vg_field $vg autoactivation "enabled"
+check lv_field $vg/$lv1 autoactivation "enabled"
+
+lvchange -aay $vg/$lv1
+check lv_field $vg/$lv1 lv_active "active"
+lvchange -an $vg/$lv1
+lvchange -aay $vg
+check lv_field $vg/$lv1 lv_active "active"
+lvchange -an $vg/$lv1
+vgchange -aay $vg
+check lv_field $vg/$lv1 lv_active "active"
+lvchange -an $vg/$lv1
+pvscan --cache -aay "$dev1"
+check lv_field $vg/$lv1 lv_active "active"
+lvchange -an $vg/$lv1
+_clear_online_files
+
+# --aa=n
+lvchange --setautoactivation n $vg/$lv1
+check vg_field $vg autoactivation "enabled"
+check lv_field $vg/$lv1 autoactivation ""
+
+lvchange -aay $vg/$lv1
+check lv_field $vg/$lv1 lv_active ""
+lvchange -aay $vg
+check lv_field $vg/$lv1 lv_active ""
+vgchange -aay $vg
+check lv_field $vg/$lv1 lv_active ""
+pvscan --cache -aay "$dev1"
+check lv_field $vg/$lv1 lv_active ""
+_clear_online_files
+
+# --aa=y
+lvchange --setautoactivation y $vg/$lv1
+check vg_field $vg autoactivation "enabled"
+check lv_field $vg/$lv1 autoactivation "enabled"
+
+lvchange -aay $vg/$lv1
+check lv_field $vg/$lv1 lv_active "active"
+lvchange -an $vg/$lv1
+lvchange -aay $vg
+check lv_field $vg/$lv1 lv_active "active"
+lvchange -an $vg/$lv1
+vgchange -aay $vg
+check lv_field $vg/$lv1 lv_active "active"
+lvchange -an $vg/$lv1
+pvscan --cache -aay "$dev1"
+check lv_field $vg/$lv1 lv_active "active"
+lvchange -an $vg/$lv1
+_clear_online_files
+
+vgremove -y $vg
+
+#
+# test vgchange --setautoactivation
+#
+
+# default
+vgcreate $SHARED $vg "$dev1"
+lvcreate -n $lv1 -l1 -an $vg
+
+# --aa=n
+vgchange --setautoactivation n $vg
+check vg_field $vg autoactivation ""
+check lv_field $vg/$lv1 autoactivation "enabled"
+
+lvchange -aay $vg/$lv1
+check lv_field $vg/$lv1 lv_active ""
+lvchange -aay $vg
+check lv_field $vg/$lv1 lv_active ""
+vgchange -aay $vg
+check lv_field $vg/$lv1 lv_active ""
+pvscan --cache -aay "$dev1"
+check lv_field $vg/$lv1 lv_active ""
+_clear_online_files
+
+# --aa=y
+vgchange --setautoactivation y $vg
+check vg_field $vg autoactivation "enabled"
+check lv_field $vg/$lv1 autoactivation "enabled"
+
+lvchange -aay $vg/$lv1
+check lv_field $vg/$lv1 lv_active "active"
+lvchange -an $vg/$lv1
+lvchange -aay $vg
+check lv_field $vg/$lv1 lv_active "active"
+lvchange -an $vg/$lv1
+vgchange -aay $vg
+check lv_field $vg/$lv1 lv_active "active"
+lvchange -an $vg/$lv1
+pvscan --cache -aay "$dev1"
+check lv_field $vg/$lv1 lv_active "active"
+lvchange -an $vg/$lv1
+_clear_online_files
+
+vgremove -y $vg
+
+#
+# test vgcreate --setautoactivation, lvcreate --setautoactivation
+#
+
+vgcreate $SHARED $vg "$dev1"
+lvcreate -n $lv1 -l1 -an $vg
+lvcreate -n $lv2 -l1 --setautoactivation y -an $vg
+lvcreate -n $lv3 -l1 --setautoactivation n -an $vg
+check vg_field $vg autoactivation "enabled"
+check lv_field $vg/$lv1 autoactivation "enabled"
+check lv_field $vg/$lv2 autoactivation "enabled"
+check lv_field $vg/$lv3 autoactivation ""
+vgchange -aay $vg
+check lv_field $vg/$lv1 lv_active "active"
+check lv_field $vg/$lv2 lv_active "active"
+check lv_field $vg/$lv3 lv_active ""
+vgchange -an $vg
+lvchange -aay $vg/$lv1
+lvchange -aay $vg/$lv2
+lvchange -aay $vg/$lv3
+check lv_field $vg/$lv1 lv_active "active"
+check lv_field $vg/$lv2 lv_active "active"
+check lv_field $vg/$lv3 lv_active ""
+vgchange -an $vg
+pvscan --cache -aay "$dev1"
+check lv_field $vg/$lv1 lv_active "active"
+check lv_field $vg/$lv2 lv_active "active"
+check lv_field $vg/$lv3 lv_active ""
+vgchange -an $vg
+vgremove -y $vg
+_clear_online_files
+
+vgcreate $SHARED --setautoactivation y $vg "$dev1"
+lvcreate -n $lv1 -l1 -an $vg
+lvcreate -n $lv2 -l1 --setautoactivation y -an $vg
+lvcreate -n $lv3 -l1 --setautoactivation n -an $vg
+check vg_field $vg autoactivation "enabled"
+check lv_field $vg/$lv1 autoactivation "enabled"
+check lv_field $vg/$lv2 autoactivation "enabled"
+check lv_field $vg/$lv3 autoactivation ""
+vgchange -aay $vg
+check lv_field $vg/$lv1 lv_active "active"
+check lv_field $vg/$lv2 lv_active "active"
+check lv_field $vg/$lv3 lv_active ""
+vgchange -an $vg
+lvchange -aay $vg/$lv1
+lvchange -aay $vg/$lv2
+lvchange -aay $vg/$lv3
+check lv_field $vg/$lv1 lv_active "active"
+check lv_field $vg/$lv2 lv_active "active"
+check lv_field $vg/$lv3 lv_active ""
+vgchange -an $vg
+pvscan --cache -aay "$dev1"
+check lv_field $vg/$lv1 lv_active "active"
+check lv_field $vg/$lv2 lv_active "active"
+check lv_field $vg/$lv3 lv_active ""
+vgchange -an $vg
+vgremove -y $vg
+_clear_online_files
+
+vgcreate $SHARED --setautoactivation n $vg "$dev1"
+lvcreate -n $lv1 -l1 -an $vg
+lvcreate -n $lv2 -l1 --setautoactivation y -an $vg
+lvcreate -n $lv3 -l1 --setautoactivation n -an $vg
+check vg_field $vg autoactivation ""
+check lv_field $vg/$lv1 autoactivation "enabled"
+check lv_field $vg/$lv2 autoactivation "enabled"
+check lv_field $vg/$lv3 autoactivation ""
+vgchange -aay $vg
+check lv_field $vg/$lv1 lv_active ""
+check lv_field $vg/$lv2 lv_active ""
+check lv_field $vg/$lv3 lv_active ""
+lvchange -aay $vg/$lv1
+lvchange -aay $vg/$lv2
+lvchange -aay $vg/$lv3
+check lv_field $vg/$lv1 lv_active ""
+check lv_field $vg/$lv2 lv_active ""
+check lv_field $vg/$lv3 lv_active ""
+pvscan --cache -aay "$dev1"
+check lv_field $vg/$lv1 lv_active ""
+check lv_field $vg/$lv2 lv_active ""
+check lv_field $vg/$lv3 lv_active ""
+vgremove -y $vg
+_clear_online_files
+
+
+#
+# test combination of --aa and auto_activation_volume_list
+#
+
+vgcreate $SHARED $vg "$dev1"
+lvcreate -n $lv1 -l1 -an $vg
+lvcreate -n $lv2 -l1 --setautoactivation n -an $vg
+check vg_field $vg autoactivation "enabled"
+check lv_field $vg/$lv1 autoactivation "enabled"
+check lv_field $vg/$lv2 autoactivation ""
+
+# list prevents all aa, metadata settings don't matter
+aux lvmconf "activation/auto_activation_volume_list = [ ]"
+vgchange -aay $vg
+check lv_field $vg/$lv1 lv_active ""
+check lv_field $vg/$lv2 lv_active ""
+vgchange -an $vg
+lvchange -aay $vg/$lv1
+lvchange -aay $vg/$lv2
+check lv_field $vg/$lv1 lv_active ""
+check lv_field $vg/$lv2 lv_active ""
+vgchange -an $vg
+pvscan --cache -aay "$dev1"
+check lv_field $vg/$lv1 lv_active ""
+check lv_field $vg/$lv2 lv_active ""
+vgchange -an $vg
+_clear_online_files
+
+# list allows all vg aa, metadata allows lv1 -> lv1 activated
+aux lvmconf "activation/auto_activation_volume_list = [ \"$vg\" ]"
+vgchange -aay $vg
+check lv_field $vg/$lv1 lv_active "active"
+check lv_field $vg/$lv2 lv_active ""
+vgchange -an $vg
+lvchange -aay $vg/$lv1
+lvchange -aay $vg/$lv2
+check lv_field $vg/$lv1 lv_active "active"
+check lv_field $vg/$lv2 lv_active ""
+vgchange -an $vg
+pvscan --cache -aay "$dev1"
+check lv_field $vg/$lv1 lv_active "active"
+check lv_field $vg/$lv2 lv_active ""
+vgchange -an $vg
+_clear_online_files
+
+# list allows lv1, metadata allows lv1 -> lv1 activated
+aux lvmconf "activation/auto_activation_volume_list = [ \"$vg/$lv1\" ]"
+vgchange -aay $vg
+check lv_field $vg/$lv1 lv_active "active"
+check lv_field $vg/$lv2 lv_active ""
+vgchange -an $vg
+lvchange -aay $vg/$lv1
+lvchange -aay $vg/$lv2
+check lv_field $vg/$lv1 lv_active "active"
+check lv_field $vg/$lv2 lv_active ""
+vgchange -an $vg
+pvscan --cache -aay "$dev1"
+check lv_field $vg/$lv1 lv_active "active"
+check lv_field $vg/$lv2 lv_active ""
+vgchange -an $vg
+_clear_online_files
+
+# list allows lv2, metadata allows lv1 -> nothing activated
+aux lvmconf "activation/auto_activation_volume_list = [ \"$vg/$lv2\" ]"
+vgchange -aay $vg
+check lv_field $vg/$lv1 lv_active ""
+check lv_field $vg/$lv2 lv_active ""
+vgchange -an $vg
+lvchange -aay $vg/$lv1
+lvchange -aay $vg/$lv2
+check lv_field $vg/$lv1 lv_active ""
+check lv_field $vg/$lv2 lv_active ""
+vgchange -an $vg
+pvscan --cache -aay "$dev1"
+check lv_field $vg/$lv1 lv_active ""
+check lv_field $vg/$lv2 lv_active ""
+vgchange -an $vg
+_clear_online_files
+
+vgremove -y $vg
+
+vgcreate $SHARED --setautoactivation n $vg "$dev1"
+lvcreate -n $lv1 -l1 -an $vg
+lvcreate -n $lv2 -l1 --setautoactivation n -an $vg
+check vg_field $vg autoactivation ""
+check lv_field $vg/$lv1 autoactivation "enabled"
+check lv_field $vg/$lv2 autoactivation ""
+
+# list prevents all aa, metadata settings don't matter
+aux lvmconf "activation/auto_activation_volume_list = [ ]"
+vgchange -aay $vg
+check lv_field $vg/$lv1 lv_active ""
+check lv_field $vg/$lv2 lv_active ""
+vgchange -an $vg
+lvchange -aay $vg/$lv1
+lvchange -aay $vg/$lv2
+check lv_field $vg/$lv1 lv_active ""
+check lv_field $vg/$lv2 lv_active ""
+vgchange -an $vg
+pvscan --cache -aay "$dev1"
+check lv_field $vg/$lv1 lv_active ""
+check lv_field $vg/$lv2 lv_active ""
+vgchange -an $vg
+_clear_online_files
+
+# list allows lv1, metadata disallows vg -> nothing activated
+aux lvmconf "activation/auto_activation_volume_list = [ \"$vg/$lv1\" ]"
+vgchange -aay $vg
+check lv_field $vg/$lv1 lv_active ""
+check lv_field $vg/$lv2 lv_active ""
+vgchange -an $vg
+lvchange -aay $vg/$lv1
+lvchange -aay $vg/$lv2
+check lv_field $vg/$lv1 lv_active ""
+check lv_field $vg/$lv2 lv_active ""
+vgchange -an $vg
+pvscan --cache -aay "$dev1"
+check lv_field $vg/$lv1 lv_active ""
+check lv_field $vg/$lv2 lv_active ""
+vgchange -an $vg
+_clear_online_files
+
+vgremove -y $vg
+
diff --git a/tools/args.h b/tools/args.h
index c1d32be32..3dcffe224 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -87,6 +87,17 @@ arg(atversion_ARG, '\0', "atversion", string_VAL, 0, 0,
"which does not contain any newer settings for which LVM would\n"
"issue a warning message when checking the configuration.\n")
+arg(setautoactivation_ARG, '\0', "setautoactivation", bool_VAL, 0, 0,
+ "Set the autoactivation property on a VG or LV.\n"
+ "Display the property with vgs or lvs \"-o autoactivation\".\n"
+ "When the autoactivation property is disabled, the VG or LV\n"
+ "will not be activated by a command doing autoactivation\n"
+ "(vgchange, lvchange, or pvscan using -aay.)\n"
+ "If autoactivation is disabled on a VG, no LVs will be autoactivated\n"
+ "in that VG, and the LV autoactivation property has no effect.\n"
+ "If autoactivation is enabled on a VG, autoactivation can be disabled\n"
+ "for individual LVs.\n")
+
arg(binary_ARG, '\0', "binary", 0, 0, 0,
"Use binary values \"0\" or \"1\" instead of descriptive literal values\n"
"for columns that have exactly two valid values to report (not counting\n"
@@ -960,12 +971,17 @@ arg(activate_ARG, 'a', "activate", activation_VAL, 0, 0,
"link and present this as the name of the device.\n"
"The location and name of the underlying device node may depend on\n"
"the distribution, configuration (e.g. udev), or release version.\n"
- "\\fBay\\fP specifies autoactivation, in which case an LV is activated\n"
- "only if it matches an item in lvm.conf activation/auto_activation_volume_list.\n"
- "If the list is not set, all LVs are considered to match, and if\n"
- "if the list is set but empty, no LVs match.\n"
- "Autoactivation should be used during system boot to make it possible\n"
- "to select which LVs should be automatically activated by the system.\n"
+ "\\fBay\\fP specifies autoactivation, which is used by system-generated\n"
+ "activation commands. By default, LVs are autoactivated.\n"
+ "An autoactivation property can be set on a VG or LV to disable autoactivation,\n"
+ "see --setautoactivation y|n in vgchange, lvchange, vgcreate, and lvcreate.\n"
+ "Display the property with vgs or lvs \"-o autoactivation\".\n"
+ "The lvm.conf auto_activation_volume_list includes names of VGs or LVs\n"
+ "that should be autoactivated, and anything not listed is not autoactivated.\n"
+ "When auto_activation_volume_list is undefined (the default), it has no effect.\n"
+ "If auto_activation_volume_list is defined and empty, no LVs are autoactivated.\n"
+ "Items included by auto_activation_volume_list will not be autoactivated if\n"
+ "the autoactivation property has been disabled.\n"
"See \\fBlvmlockd\\fP(8) for more information about activation options \\fBey\\fP and \\fBsy\\fP for shared VGs.\n"
"#lvcreate\n"
"Controls the active state of the new LV.\n"
diff --git a/tools/command-lines.in b/tools/command-lines.in
index 528811f52..0a3359630 100644
--- a/tools/command-lines.in
+++ b/tools/command-lines.in
@@ -224,7 +224,7 @@ OO_LVCHANGE_META: --addtag Tag, --deltag Tag,
--compression Bool, --deduplication Bool,
--detachprofile, --metadataprofile String, --profile String,
--permission Permission, --readahead Readahead, --setactivationskip Bool,
---errorwhenfull Bool, --discards Discards, --zero Bool,
+--setautoactivation Bool, --errorwhenfull Bool, --discards Discards, --zero Bool,
--cachemode CacheMode, --cachepolicy String, --cachesettings String,
--minrecoveryrate SizeKB, --maxrecoveryrate SizeKB,
--writebehind Number, --writemostly WriteMostlyPV, --persistent n
@@ -799,7 +799,7 @@ OO_LVCREATE: --addtag Tag, --alloc Alloc, --autobackup Bool, --activate Active,
--metadataprofile String, --minor Number, --monitor Bool, --name String, --nosync,
--noudevsync, --permission Permission, --persistent Bool, --readahead Readahead,
--reportformat ReportFmt, --setactivationskip Bool, --wipesignatures Bool,
---zero Bool
+--zero Bool, --setautoactivation Bool
OO_LVCREATE_CACHE: --cachemode CacheMode, --cachepolicy String, --cachesettings String,
--chunksize SizeKB, --cachemetadataformat CacheMetadataFormat
@@ -1662,7 +1662,8 @@ OO_VGCHANGE_META: --addtag Tag, --deltag Tag,
--logicalvolume Uint32, --maxphysicalvolumes Uint32, --alloc Alloc, --uuid,
--pvmetadatacopies MetadataCopiesPV, --vgmetadatacopies MetadataCopiesVG,
--physicalextentsize SizeMB, --resizeable Bool,
---profile String, --detachprofile, --metadataprofile String
+--profile String, --detachprofile, --metadataprofile String,
+--setautoactivation Bool
vgchange OO_VGCHANGE_META
OO: --poll Bool, OO_VGCHANGE
@@ -1742,7 +1743,7 @@ OO: --addtag Tag, --alloc Alloc, --autobackup Bool, --clustered Bool, --maxlogic
--physicalextentsize SizeMB, --force, --zero Bool, --labelsector Number,
--metadatasize SizeMB, --pvmetadatacopies MetadataCopiesPV, --vgmetadatacopies MetadataCopiesVG,
--reportformat ReportFmt, --dataalignment SizeKB, --dataalignmentoffset SizeKB,
---shared, --systemid String, --locktype LockType
+--shared, --systemid String, --locktype LockType, --setautoactivation Bool
ID: vgcreate_general
---
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 0189c365e..8293f5035 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -215,6 +215,10 @@ static int _lvchange_activate(struct cmd_context *cmd, struct logical_volume *lv
!lv_passes_auto_activation_filter(cmd, lv))
return 1;
+ if ((activate == CHANGE_AAY) &&
+ ((lv->status & LV_NOAUTOACTIVATE) || (lv->vg->status & NOAUTOACTIVATE)))
+ return 1;
+
if (!lv_change_activate(cmd, lv, activate))
return_0;
@@ -1009,6 +1013,28 @@ static int _lvchange_activation_skip(struct logical_volume *lv, uint32_t *mr)
return 1;
}
+static int _lvchange_autoactivation(struct logical_volume *lv, uint32_t *mr)
+{
+ int aa_no_arg = !arg_int_value(lv->vg->cmd, setautoactivation_ARG, 0);
+ int aa_no_meta = (lv->status & LV_NOAUTOACTIVATE);
+
+ if ((aa_no_arg && aa_no_meta) || (!aa_no_arg && !aa_no_meta))
+ return 1;
+
+ if (aa_no_arg)
+ lv->status |= LV_NOAUTOACTIVATE;
+ else
+ lv->status &= ~LV_NOAUTOACTIVATE;
+
+ log_verbose("Changing autoactivation flag to %s for LV %s.",
+ display_lvname(lv), aa_no_arg ? "no" : "yes");
+
+ /* Request caller to commit+backup metadata */
+ *mr |= MR_COMMIT;
+
+ return 1;
+}
+
static int _lvchange_compression(struct logical_volume *lv, uint32_t *mr)
{
struct cmd_context *cmd = lv->vg->cmd;
@@ -1112,6 +1138,7 @@ static int _option_allows_group_commit(int opt_enum)
metadataprofile_ARG,
detachprofile_ARG,
setactivationskip_ARG,
+ setautoactivation_ARG,
-1
};
@@ -1250,6 +1277,11 @@ static int _lvchange_properties_single(struct cmd_context *cmd,
doit += _lvchange_activation_skip(lv, &mr);
break;
+ case setautoactivation_ARG:
+ docmds++;
+ doit += _lvchange_autoactivation(lv, &mr);
+ break;
+
case compression_ARG:
docmds++;
doit += _lvchange_compression(lv, &mr);
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 1ce561fc3..a28f0931e 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -742,6 +742,9 @@ static int _read_activation_params(struct cmd_context *cmd,
if (arg_is_set(cmd, ignoreactivationskip_ARG))
lp->activation_skip |= ACTIVATION_SKIP_IGNORE;
+ if (arg_is_set(cmd, setautoactivation_ARG) && !arg_int_value(cmd, setautoactivation_ARG, 1))
+ lp->noautoactivate = 1;
+
return 1;
}
diff --git a/tools/vgchange.c b/tools/vgchange.c
index 58c8ddc84..032f3efcf 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -117,6 +117,10 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd, struct volume_group *vg,
!lv_passes_auto_activation_filter(cmd, lv))
continue;
+ /* vg NOAUTOACTIVATE flag was already checked */
+ if ((activate == CHANGE_AAY) && (lv->status & LV_NOAUTOACTIVATE))
+ continue;
+
expected_count++;
if (!lv_change_activate(cmd, lv, activate)) {
@@ -209,6 +213,11 @@ int vgchange_activate(struct cmd_context *cmd, struct volume_group *vg,
return 0;
}
+ if ((activate == CHANGE_AAY) && (vg->status & NOAUTOACTIVATE)) {
+ log_debug("Autoactivation is disabled for VG %s.", vg->name);
+ return 1;
+ }
+
/*
* Safe, since we never write out new metadata here. Required for
* partial activation to work.
@@ -317,6 +326,26 @@ static int _vgchange_resizeable(struct cmd_context *cmd,
return 1;
}
+static int _vgchange_autoactivation(struct cmd_context *cmd,
+ struct volume_group *vg)
+{
+ int aa_no_arg = !arg_int_value(cmd, setautoactivation_ARG, 0);
+ int aa_no_meta = (vg->status & NOAUTOACTIVATE) ? 1 : 0;
+
+ if ((aa_no_arg && aa_no_meta) || (!aa_no_arg && !aa_no_meta)) {
+ log_error("Volume group autoactivation is already %s.",
+ aa_no_arg ? "no" : "yes");
+ return 0;
+ }
+
+ if (aa_no_arg)
+ vg->status |= NOAUTOACTIVATE;
+ else
+ vg->status &= ~NOAUTOACTIVATE;
+
+ return 1;
+}
+
static int _vgchange_logicalvolume(struct cmd_context *cmd,
struct volume_group *vg)
{
@@ -619,6 +648,7 @@ static int _vgchange_single(struct cmd_context *cmd, const char *vg_name,
{ logicalvolume_ARG, &_vgchange_logicalvolume },
{ maxphysicalvolumes_ARG, &_vgchange_physicalvolumes },
{ resizeable_ARG, &_vgchange_resizeable },
+ { setautoactivation_ARG, &_vgchange_autoactivation },
{ deltag_ARG, &_vgchange_deltag },
{ addtag_ARG, &_vgchange_addtag },
{ physicalextentsize_ARG, &_vgchange_pesize },
@@ -707,6 +737,7 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
arg_is_set(cmd, logicalvolume_ARG) ||
arg_is_set(cmd, maxphysicalvolumes_ARG) ||
arg_is_set(cmd, resizeable_ARG) ||
+ arg_is_set(cmd, setautoactivation_ARG) ||
arg_is_set(cmd, uuid_ARG) ||
arg_is_set(cmd, physicalextentsize_ARG) ||
arg_is_set(cmd, alloc_ARG) ||
diff --git a/tools/vgcreate.c b/tools/vgcreate.c
index 73066e9a4..f9c40e86d 100644
--- a/tools/vgcreate.c
+++ b/tools/vgcreate.c
@@ -118,6 +118,9 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
!vg_set_mda_copies(vg, vp_new.vgmetadatacopies))
goto_bad;
+ if (arg_is_set(cmd, setautoactivation_ARG) && !arg_int_value(cmd, setautoactivation_ARG, 1))
+ vg->status |= NOAUTOACTIVATE;
+
/* attach the pv's */
if (!vg_extend_each_pv(vg, &pp))
goto_bad;
3 years
main - libdm: fix compiling with older gcc
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6f6583afede02dddec4...
Commit: 6f6583afede02dddec41b85f896c9d4e73d87beb
Parent: 9980ed9527e73d8396f8e1ce877837c0355ba8dc
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Apr 6 22:31:23 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 6 22:31:23 2021 +0200
libdm: fix compiling with older gcc
---
libdm/misc/dmlib.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/libdm/misc/dmlib.h b/libdm/misc/dmlib.h
index 95f4b8ecb..0b937cdda 100644
--- a/libdm/misc/dmlib.h
+++ b/libdm/misc/dmlib.h
@@ -77,7 +77,10 @@
# endif
# endif
#ifndef DM_EXPORT_NEW_SYMBOL
-#define DM_EXPORT_NEW_SYMBOL(rettype, func, ver) rettype func
+#define DM_EXPORT_NEW_SYMBOL(rettype, func, ver) \
+ __typeof__(func) func ##_v ##ver; \
+ __asm__(".symver " #func "_v" #ver ", " #func "@@DM_" #ver ); \
+ rettype func ##_v ##ver
#define DM_EXPORT_SYMBOL(func, ver) \
__asm__(".symver " #func "_v" #ver ", " #func "@DM_" #ver );
#define DM_EXPORT_SYMBOL_BASE(func) \
3 years
main - WHATS_NEW: updates
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9980ed9527e73d8396f...
Commit: 9980ed9527e73d8396f8e1ce877837c0355ba8dc
Parent: 79a168d119d31b99463a286dff8a42e25863895a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Apr 6 21:20:18 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 6 22:02:31 2021 +0200
WHATS_NEW: updates
---
WHATS_NEW | 3 +++
WHATS_NEW_DM | 1 +
2 files changed, 4 insertions(+)
diff --git a/WHATS_NEW b/WHATS_NEW
index 83c94701a..c2676c820 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,8 @@
Version 2.03.12 -
===================================
+ Improve signal handling with lvmpolld.
+ Signal handler can interrupt command also for SIGTERM.
+ Lvreduce --yes support.
Add configure option --with/out-symvers for non-glibc builds.
Report error when the filesystem is missing on fsadm resized volume.
Handle better blockdev with --getsize64 support for fsadm.
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 400e458b4..822ca14eb 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.177 -
====================================
+ Fix symbol versioning build with -O2 -flto.
Add dm_tree_node_add_thin_pool_target_v1 with crop_metadata support.
Version 1.02.175 - 08th January 2021
3 years
main - tests: pvmove updates
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=79a168d119d31b99463...
Commit: 79a168d119d31b99463a286dff8a42e25863895a
Parent: b99f7d0df95e24ee367ce0973924ebfdd62a207a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 1 11:33:40 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 6 22:02:31 2021 +0200
tests: pvmove updates
Switch to plain 'kill' we should no longer need SIGKILL
as polling can be interrupted.
Resolve problem in aux wait_pvmove_lv_ready() that was using
lvm command to check for UUID - but this was interferring with
VG lock and it's been delaying confirmation.
So reducing slow-down of test - so it can run faster.
---
test/lib/aux.sh | 19 +++++++++---------
test/shell/pvmove-resume-1.sh | 37 ++++++++++++++----------------------
test/shell/pvmove-resume-2.sh | 18 +++++++-----------
test/shell/pvmove-resume-multiseg.sh | 26 ++++++++++---------------
4 files changed, 41 insertions(+), 59 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 6177de4d4..5cdbe1302 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -215,7 +215,7 @@ prepare_dmeventd() {
}
prepare_lvmpolld() {
- lvmconf "global/use_lvmpolld = 1"
+ test -e LOCAL_LVMPOLLD || lvmconf "global/use_lvmpolld = 1"
local run_valgrind=""
test "${LVM_VALGRIND_LVMPOLLD:-0}" -eq 0 || run_valgrind="run_valgrind"
@@ -226,11 +226,11 @@ prepare_lvmpolld() {
$run_valgrind lvmpolld -f "$@" -s "$TESTDIR/lvmpolld.socket" -B "$TESTDIR/lib/lvm" -l all &
echo $! > LOCAL_LVMPOLLD
for i in {200..0} ; do
- test "$i" -eq 0 && die "Startup of lvmpolld is too slow."
test -e "$TESTDIR/lvmpolld.socket" && break
echo -n .;
sleep .1;
done # wait for the socket
+ test "$i" -gt 0 || die "Startup of lvmpolld is too slow."
echo ok
}
@@ -1126,7 +1126,10 @@ remove_dm_devs() {
}
}
done
- test ${#held[@]} -eq 0 && return
+ test ${#held[@]} -eq 0 && {
+ rm -f debug.log*
+ return
+ }
remove=( "${held[@]}" )
done
die "Can't remove device(s) ${held[@]}"
@@ -1801,8 +1804,8 @@ check_lvmpolld_init_rq_count() {
}
wait_pvmove_lv_ready() {
- # given sleep .1 this is about 60 secs of waiting
- local retries=${2-300}
+ # given sleep .1 this is about 20 secs of waiting
+ local retries=${2-100}
if [ -e LOCAL_LVMPOLLD ]; then
local lvid=""
@@ -1810,10 +1813,8 @@ wait_pvmove_lv_ready() {
test "$retries" -le 0 && die "Waiting for lvmpolld timed out"
test -n "$lvid" || {
# wait till wanted LV really appears
- lvid=$(get lv_field "${1//-//}" vg_uuid,lv_uuid -a 2>/dev/null) && {
- lvid=${lvid//\ /}
- lvid=${lvid//-/}
- }
+ lvid=$(dmsetup info --noheadings -c -o uuid "$1" 2>/dev/null || true)
+ lvid=${lvid##LVM-}
}
test -z "$lvid" || {
lvmpolld_dump > lvmpolld_dump.txt
diff --git a/test/shell/pvmove-resume-1.sh b/test/shell/pvmove-resume-1.sh
index 00a8f2dcd..14db30840 100644
--- a/test/shell/pvmove-resume-1.sh
+++ b/test/shell/pvmove-resume-1.sh
@@ -20,8 +20,6 @@ SKIP_WITH_CLVMD=1
. lib/inittest
-test -e LOCAL_LVMPOLLD && aux throttle_dm_mirror 20 || :
-
aux prepare_pvs 4 30
vgcreate -s 128k $vg "$dev1"
@@ -36,24 +34,25 @@ test_pvmove_resume() {
lvcreate -an -Zn -l30 -n $lv1 $vg
lvcreate -an -Zn -l30 -n $lv1 $vg1
- aux delay_dev "$dev3" 0 200 "$(get first_extent_sector "$dev3"):"
+ aux delay_dev "$dev3" 0 30 "$(get first_extent_sector "$dev3"):"
test -e HAVE_DM_DELAY || { lvremove -f $vg $vg1; return 0; }
- aux delay_dev "$dev4" 0 200 "$(get first_extent_sector "$dev4"):"
+ aux delay_dev "$dev4" 0 30 "$(get first_extent_sector "$dev4"):"
pvmove -i5 "$dev1" &
PVMOVE=$!
- aux wait_pvmove_lv_ready "$vg-pvmove0" 300
- kill -9 $PVMOVE
+ aux wait_pvmove_lv_ready "$vg-pvmove0"
+ kill $PVMOVE
+ test -e LOCAL_LVMPOLLD && aux prepare_lvmpolld
pvmove -i5 "$dev2" &
PVMOVE=$!
- aux wait_pvmove_lv_ready "$vg1-pvmove0" 300
- kill -9 $PVMOVE
-
- aux remove_dm_devs "$vg-$lv1" "$vg1-$lv1" "$vg-pvmove0" "$vg1-pvmove0"
+ aux wait_pvmove_lv_ready "$vg1-pvmove0"
+ kill $PVMOVE
test -e LOCAL_LVMPOLLD && aux prepare_lvmpolld
wait
+ aux remove_dm_devs "$vg-$lv1" "$vg1-$lv1" "$vg-pvmove0" "$vg1-pvmove0"
+
check lv_attr_bit type $vg/pvmove0 "p"
check lv_attr_bit type $vg1/pvmove0 "p"
@@ -79,22 +78,14 @@ test_pvmove_resume() {
# bg polling as parameter
$1 2
- aux enable_dev "$dev3"
- aux enable_dev "$dev4"
+ aux enable_dev "$dev3" "$dev4"
- i=0
- while get lv_field $vg name -a | grep -E "^\[?pvmove"; do
- # wait for 30 secs at max
- test $i -ge 300 && die "Pvmove is too slow or does not progress."
- sleep .1
- i=$((i + 1))
- done
- while get lv_field $vg1 name -a | grep -E "^\[?pvmove"; do
- # wait for 30 secs at max
- test $i -ge 300 && die "Pvmove is too slow or does not progress."
+ for i in {100..0} ; do
+ lvs -ao name $vg $vg1 | grep "\[pvmove" || break
sleep .1
- i=$((i + 1))
done
+ # wait for 10 secs at max
+ test $i -eq 0 && die "Pvmove is too slow or does not progress."
aux kill_tagged_processes
diff --git a/test/shell/pvmove-resume-2.sh b/test/shell/pvmove-resume-2.sh
index 233aec3c1..1ba4bc662 100644
--- a/test/shell/pvmove-resume-2.sh
+++ b/test/shell/pvmove-resume-2.sh
@@ -20,8 +20,6 @@ SKIP_WITH_CLVMD=1
. lib/inittest
-test -e LOCAL_LVMPOLLD && aux throttle_dm_mirror 20 || :
-
aux prepare_pvs 2 30
vgcreate -s 128k $vg "$dev1"
@@ -33,16 +31,16 @@ test_pvmove_resume() {
lvcreate -an -Zn -l15 -n $lv1 $vg "$dev1"
lvcreate -an -Zn -l15 -n $lv2 $vg "$dev1"
- aux delay_dev "$dev2" 0 200 "$(get first_extent_sector "$dev2"):"
+ aux delay_dev "$dev2" 0 30 "$(get first_extent_sector "$dev2"):"
pvmove -i5 "$dev1" &
PVMOVE=$!
- aux wait_pvmove_lv_ready "$vg-pvmove0" 300
- kill -9 $PVMOVE
+ aux wait_pvmove_lv_ready "$vg-pvmove0"
+ kill $PVMOVE
- aux remove_dm_devs "$vg-$lv1" "$vg-$lv2" "$vg-pvmove0"
test -e LOCAL_LVMPOLLD && aux prepare_lvmpolld
wait
+ aux remove_dm_devs "$vg-$lv1" "$vg-$lv2" "$vg-pvmove0"
check lv_attr_bit type $vg/pvmove0 "p"
@@ -70,13 +68,11 @@ test_pvmove_resume() {
aux enable_dev "$dev2"
- i=0
- while get lv_field $vg name -a | grep -E "^\[?pvmove"; do
- # wait for 30 secs at max
- test $i -ge 300 && die "Pvmove is too slow or does not progress."
+ for i in {100..0} ; do # wait for 10 secs at max
+ get lv_field $vg name -a | grep -E "^\[?pvmove" || break
sleep .1
- i=$((i + 1))
done
+ test $i -gt 0 || die "Pvmove is too slow or does not progress."
aux kill_tagged_processes
diff --git a/test/shell/pvmove-resume-multiseg.sh b/test/shell/pvmove-resume-multiseg.sh
index 73c7cf354..af26e5692 100644
--- a/test/shell/pvmove-resume-multiseg.sh
+++ b/test/shell/pvmove-resume-multiseg.sh
@@ -19,8 +19,6 @@ SKIP_WITH_LVMLOCKD=1
. lib/inittest
-test -e LOCAL_LVMPOLLD && aux throttle_dm_mirror 20 || :
-
aux prepare_pvs 5 40
vgcreate -s 128k $vg "$dev1" "$dev2" "$dev3"
@@ -35,23 +33,23 @@ test_pvmove_resume() {
# next LV on same VG and differetnt PV (we want to test 2 pvmoves per VG)
lvcreate -an -Zn -l50 -n $lv2 $vg "$dev3"
- aux delay_dev "$dev4" 0 200 "$(get first_extent_sector "$dev4"):"
+ aux delay_dev "$dev4" 0 30 "$(get first_extent_sector "$dev4"):"
test -e HAVE_DM_DELAY || { lvremove -f $vg; return 0; }
- aux delay_dev "$dev5" 0 200 "$(get first_extent_sector "$dev5"):"
+ aux delay_dev "$dev5" 0 30 "$(get first_extent_sector "$dev5"):"
pvmove -i5 "$dev1" "$dev4" &
PVMOVE=$!
- aux wait_pvmove_lv_ready "$vg-pvmove0" 300
- kill -9 $PVMOVE
+ aux wait_pvmove_lv_ready "$vg-pvmove0"
+ kill $PVMOVE
pvmove -i5 -n $vg/$lv2 "$dev3" "$dev5" &
PVMOVE=$!
- aux wait_pvmove_lv_ready "$vg-pvmove1" 300
- kill -9 $PVMOVE
+ aux wait_pvmove_lv_ready "$vg-pvmove1"
+ kill $PVMOVE
- aux remove_dm_devs "$vg-$lv1" "$vg-$lv2" "$vg-pvmove0" "$vg-pvmove1"
test -e LOCAL_LVMPOLLD && aux prepare_lvmpolld
wait
+ aux remove_dm_devs "$vg-$lv1" "$vg-$lv2" "$vg-pvmove0" "$vg-pvmove1"
check lv_attr_bit type $vg/pvmove0 "p"
check lv_attr_bit type $vg/pvmove1 "p"
@@ -73,22 +71,18 @@ test_pvmove_resume() {
aux prepare_clvmd
fi
-## rm -f debug.log_DEBUG*
-# lvs -ao+devices $vg
-
# call resume function (see below)
# with expected number of spawned
# bg polling as parameter
$1 2
- aux enable_dev "$dev4"
- aux enable_dev "$dev5"
+ aux enable_dev "$dev4" "$dev5"
- for i in {0..300} ; do # wait for 30 secs at max
+ for i in {100..0} ; do # wait for 10 secs at max
get lv_field $vg name -a | grep -E "^\[?pvmove" || break
sleep .1
done
- test $i -ge 300 && die "Pvmove is too slow or does not progress."
+ test $i -gt 0 || die "Pvmove is too slow or does not progress."
aux kill_tagged_processes
3 years
main - lib: remove unused macros
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b99f7d0df95e24ee367...
Commit: b99f7d0df95e24ee367ce0973924ebfdd62a207a
Parent: e86cd9c5ba5f675798d2553359632b44d2fe237f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Apr 3 21:25:26 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 6 22:02:31 2021 +0200
lib: remove unused macros
Internally lvm2 is not using versioning for device-mapper.
---
lib/misc/lib.h | 54 ------------------------------------------------------
1 file changed, 54 deletions(-)
diff --git a/lib/misc/lib.h b/lib/misc/lib.h
index a4d109fb4..a3a11bad2 100644
--- a/lib/misc/lib.h
+++ b/lib/misc/lib.h
@@ -19,60 +19,6 @@
#ifndef _LVM_LIB_H
#define _LVM_LIB_H
-/*
- * Symbol export control macros
- *
- * DM_EXPORT_SYMBOL(func,ver)
- * DM_EXPORT_SYMBOL_BASE(func,ver)
- *
- * For functions that have multiple implementations these macros control
- * symbol export and versioning.
- *
- * Function definitions that exist in only one version never need to use
- * these macros.
- *
- * Backwards compatible implementations must include a version tag of
- * the form "_v1_02_104" as a suffix to the function name and use the
- * macro DM_EXPORT_SYMBOL to export the function and bind it to the
- * specified version string.
- *
- * Since versioning is only available when compiling with GCC the entire
- * compatibility version should be enclosed in '#if defined(GNU_SYMVER)',
- * for example:
- *
- * int dm_foo(int bar)
- * {
- * return bar;
- * }
- *
- * #if defined(__GNUC__)
- * // Backward compatible dm_foo() version 1.02.104
- * int dm_foo_v1_02_104(void);
- * int dm_foo_v1_02_104(void)
- * {
- * return 0;
- * }
- * DM_EXPORT_SYMBOL(dm_foo,1_02_104)
- * #endif
- *
- * A prototype for the compatibility version is required as these
- * functions must not be declared static.
- *
- * The DM_EXPORT_SYMBOL_BASE macro is only used to export the base
- * versions of library symbols prior to the introduction of symbol
- * versioning: it must never be used for new symbols.
- */
-#if defined(GNU_SYMVER)
-#define DM_EXPORT_SYMBOL(func, ver) \
- __asm__(".symver " #func "_v" #ver ", " #func "@DM_" #ver )
-#define DM_EXPORT_SYMBOL_BASE(func) \
- __asm__(".symver " #func "_base, " #func "@Base" )
-#else
-#define DM_EXPORT_SYMBOL(func, ver)
-#define DM_EXPORT_SYMBOL_BASE(func)
-#endif
-
-
#include "device_mapper/all.h"
#include "base/memory/zalloc.h"
#include "lib/misc/intl.h"
3 years
main - makefiles: remove unneeded var changes
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e86cd9c5ba5f675798d...
Commit: e86cd9c5ba5f675798d2553359632b44d2fe237f
Parent: 9452e62efb28acdadc916c00d39e7cd615d5c953
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Apr 4 13:13:38 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 6 22:02:31 2021 +0200
makefiles: remove unneeded var changes
---
libdm/make.tmpl.in | 3 ---
1 file changed, 3 deletions(-)
diff --git a/libdm/make.tmpl.in b/libdm/make.tmpl.in
index 219eeca9d..9ef39fc0a 100644
--- a/libdm/make.tmpl.in
+++ b/libdm/make.tmpl.in
@@ -250,9 +250,6 @@ endif
# end of fPIC protection
endif
-LDFLAGS += -L$(top_builddir)/libdm
-CLDFLAGS += -L$(top_builddir)/libdm
-
# Combination of DEBUG_POOL and DEBUG_ENFORCE_POOL_LOCKING is not suppored.
#DEFS += -DDEBUG_POOL
# Default pool locking is using the crc checksum. With mprotect memory
3 years
main - makefiles: cscope only predefined dirs
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9452e62efb28acdadc9...
Commit: 9452e62efb28acdadc916c00d39e7cd615d5c953
Parent: f1bfc0621b9d86349a1878c1e64e96c5c7040786
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Apr 4 11:25:54 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 6 22:02:31 2021 +0200
makefiles: cscope only predefined dirs
Avoid scanning for source duplicates in various build dirs.
---
Makefile.in | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/Makefile.in b/Makefile.in
index c0915fac7..69c73598e 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -83,8 +83,9 @@ cflow: include.cflow
endif
ifneq ("@CSCOPE_CMD@", "")
+CSCOPE_DIRS = base daemons device_mapper include lib libdaemon scripts tools
cscope.out:
- @CSCOPE_CMD@ -b -R -s$(top_srcdir)
+ @CSCOPE_CMD@ -b -R $(patsubst %,-s%,$(addprefix $(srcdir)/,$(CSCOPE_DIRS)))
all: cscope.out
endif
DISTCLEAN_TARGETS += cscope.out
3 years
main - makefiles: plugins can be build after shared library
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f1bfc0621b9d86349a1...
Commit: f1bfc0621b9d86349a1878c1e64e96c5c7040786
Parent: d2522f4a05aa027bcc911ecb832450bc19b7fb57
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Apr 3 22:55:20 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 6 22:02:31 2021 +0200
makefiles: plugins can be build after shared library
---
daemons/dmeventd/Makefile.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/daemons/dmeventd/Makefile.in b/daemons/dmeventd/Makefile.in
index c737ca40d..d688a0d3b 100644
--- a/daemons/dmeventd/Makefile.in
+++ b/daemons/dmeventd/Makefile.in
@@ -64,6 +64,7 @@ include $(top_builddir)/make.tmpl
all: device-mapper
device-mapper: $(TARGETS)
+plugins.device-mapper: $(LIB_SHARED)
CFLAGS_dmeventd.o += $(EXTRA_EXEC_CFLAGS)
LIBS += $(PTHREAD_LIBS) -L$(top_builddir)/libdm -ldevmapper
3 years