- lvm2-monitor.service fails to start (boo#1228854)

+ bug-1228854_lvm2-monitor-service-start-after-systemd-remount-fs.patch

OBS-URL: https://build.opensuse.org/package/show/Base:System/lvm2?expand=0&rev=347
This commit is contained in:
heming zhao 2024-08-15 08:26:49 +00:00 committed by Git OBS Bridge
commit 8358cf276a
23 changed files with 7484 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

BIN
LVM2.2.03.24.tgz (Stored with Git LFS) Normal file

Binary file not shown.

16
LVM2.2.03.24.tgz.asc Normal file
View File

@ -0,0 +1,16 @@
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEE1QGkeEQK4v0TChvouREkMeUJA58FAmZF3zYACgkQuREkMeUJ
A5+JxA/9HXxpPzrLKLo4+TmGHw53eVp/xrFCNt43AO+cywJ/iAyZNa/Moyz8xD1k
nBtEoGk/2yooJlHWnrtxKCXGVuNiUwuzRwwsU/EVB1+UA/x8GMUaQHelOzGwCFsd
YxmsoQ6rGE9+GMfz3AMd0noOPJkj5g8GXIy1Dv3wF8/xdaRcEEODbPYCBmVTVtv7
vrNVAP9yXo4tibV05C0Arm8D9ymWK/pXjE3LHD1m7s66gLDziubYNuiOik4nb5y9
DiECfO1B1fNXMF51FH3miRia/UgoDbrJhkVTTDrDO9ivjq4A7LZPpBmV93gNDOM9
1aGymKFv0zgzveyOdr+As7GvH8ShQSbcXUAwerGXjvcjqx3VbPR0yZo1jY6cDY+F
58K1bGG0XmdfxasWW/ZZjpCPs2bfpaMadDcnOC9gs7h5jVF7D7rAS+twazGqI/Yg
Ak2IsBMVYV2WRuEyBHqCYKsQlhsybtYm+ptn7k9qc1QDJXXrjJbE1USmNtdC5Dyj
nvpkkxdehzxDgcCKg1xr2lKkKTXO40+uXlhaDRmmVvAkrXIJQGqizfbB6rk3LsM8
tKfCOyQbp7nE0ZtOYmZIqeb0WZ1N/mHIOjzMefx7IfDKX4neJ7f1kB4F3ntjsIOK
hNjVH8CTjKqckMTJzwR/zpIXp3LfSvdNGVfVX/ghsSr8A7aiODU=
=T58+
-----END PGP SIGNATURE-----

4
_multibuild Normal file
View File

@ -0,0 +1,4 @@
<multibuild>
<package>devicemapper</package>
<package>lockd</package>
</multibuild>

7
baselibs.conf Normal file
View File

@ -0,0 +1,7 @@
libdevmapper1_03
conflicts "device-mapper-<targettype> < <version>"
libdevmapper-event1_03
conflicts "device-mapper-<targettype> < <version>"
device-mapper-devel
requires "libdevmapper1_03-<targettype> = <version>"
requires "libdevmapper-event1_03-<targettype> = <version>"

View File

@ -0,0 +1,66 @@
From 5633a8ad6522f0f1340ef35c2f3943a3b20cc200 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.com>
Date: Wed, 4 Jan 2017 14:20:53 +1100
Subject: [PATCH] Simplify special-case for md in 69-dm-lvm.rules.in
This special casing brings little value. It appears to attempt to
determine if the array is active yet or not, and to skip
processing if the array has not yet been started.
However, if the array hasn't been started, then "blkid" will
not have been able to read a signature, so:
ENV{ID_FS_TYPE}!="LVM2_member|LVM1_member", GOTO="lvm_end"
will have caused all this code to be skipped.
Further, this code causes incorrect behaviour in at least one case.
It assumes that the first "add" event should be ignored, as it will be
followed by a "change" event which indicates the array coming on line.
This is consistent with how the kernel sends events, but not always
consistent with how this script sees event.
Specifically: if the initrd has "mdadm" support installed, but not
"lvm2" support, then the initial "add" and "change" events will
happen while the initrd is in charge and this file is not available.
Once the root filesystem is mountd, this file will be available
and "udevadm trigger --action=add" will be run.
So the first and only event seen by this script for an md device will be
"add", and it will incorrectly ignore it.
So replace the special handling with code that simply jumps to lvm_scan
on any 'add' or 'change' event.
Signed-off-by: NeilBrown <neilb@suse.com>
2023-09-18:
udev/69-dm-lvm-metadata.rules was removed in v2_03_09 and 69-dm-lvm.rules.in
should be modified instead. The subject of this patch should be modified too.
NOTE: the updated patch may let shell/duplicate-pvs-md0.sh fail because
we change timing of lvm_scan in the rule file.
Signed-off-by: Glass Su <glass.su@suse.com>
---
udev/69-dm-lvm.rules.in | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/udev/69-dm-lvm.rules.in b/udev/69-dm-lvm.rules.in
index 3ec50a5cb878..45fdad444562 100644
--- a/udev/69-dm-lvm.rules.in
+++ b/udev/69-dm-lvm.rules.in
@@ -35,12 +35,11 @@ ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}=="1", ENV{DM_ACTIVATION}=="1", GOTO="lvm_scan"
GOTO="lvm_end"
# MD device:
+# Need to scan on both 'add' and 'change'
LABEL="next"
KERNEL!="md[0-9]*", GOTO="next"
-IMPORT{db}="LVM_MD_PV_ACTIVATED"
-ACTION=="add", ENV{LVM_MD_PV_ACTIVATED}=="1", GOTO="lvm_scan"
-ACTION=="change", ENV{LVM_MD_PV_ACTIVATED}!="1", TEST=="md/array_state", ENV{LVM_MD_PV_ACTIVATED}="1", GOTO="lvm_scan"
-ACTION=="add", KERNEL=="md[0-9]*p[0-9]*", GOTO="lvm_scan"
+ACTION=="add", GOTO="lvm_scan"
+ACTION=="change", GOTO="lvm_scan"
GOTO="lvm_end"
# Loop device:
--
2.42.0

View File

@ -0,0 +1,47 @@
From 6cfd57627c7c8b1aee4cf8164d88e206660bf753 Mon Sep 17 00:00:00 2001
From: Eric Ren <zren@suse.com>
Date: Tue, 4 Jul 2017 20:11:17 +0800
Subject: [PATCH] build: skip compliling daemons/lvmlockd directory
bsc#1037309
Signed-off-by: Eric Ren <zren@suse.com>
---
configure | 3 ++-
daemons/Makefile.in | 6 +++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/configure b/configure
index 0bb5b3dbc6ca..ea657178076b 100755
--- a/configure
+++ b/configure
@@ -12023,7 +12023,8 @@ fi
printf "%s\n" "$BUILD_LVMPOLLD" >&6; }
################################################################################
-BUILD_LVMLOCKD=no
+#BUILD_LVMLOCKD=no
+BUILD_LVMLOCKD=yes
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build lvmlockdsanlock" >&5
printf %s "checking whether to build lvmlockdsanlock... " >&6; }
diff --git a/daemons/Makefile.in b/daemons/Makefile.in
index e548b1556478..642d839c046f 100644
--- a/daemons/Makefile.in
+++ b/daemons/Makefile.in
@@ -32,9 +32,9 @@ ifeq ("@BUILD_LVMPOLLD@", "yes")
SUBDIRS += lvmpolld
endif
-ifeq ("@BUILD_LVMLOCKD@", "yes")
- SUBDIRS += lvmlockd
-endif
+#ifeq ("@BUILD_LVMLOCKD@", "yes")
+# SUBDIRS += lvmlockd
+#endif
ifeq ("@BUILD_LVMDBUSD@", "yes")
SUBDIRS += lvmdbusd
--
2.42.0

View File

@ -0,0 +1,12 @@
diff --git a/test/Makefile.in b/test/Makefile.in
index 20e97ebd0f4d..d4d3ce9f6dc7 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -31,6 +31,7 @@ LVM_TEST_RESULTS ?= results
SOURCES := lib/not.c lib/harness.c lib/dmsecuretest.c
CXXSOURCES := lib/runner.cpp
CXXFLAGS += $(EXTRA_EXEC_CFLAGS)
+LDFLAGS += -pie
CLEAN_DIRS += dbus/__pycache__ $(LVM_TEST_RESULTS)
ifneq (.,$(firstword $(srcdir)))

View File

@ -0,0 +1,47 @@
From 6ebef9ad80ee156285a61d413b5265de9c0aa2ae Mon Sep 17 00:00:00 2001
From: Heming Zhao <heming.zhao@suse.com>
Date: Wed, 21 Apr 2021 11:17:36 +0800
Subject: [PATCH] Add "nolvm" for kernel cmdline
This patch is inspried by multipath patch cd3184e107c8 ("Add
support for "multipath=off" and "nompath" on kernel cmdline")
This new item for disabling lvm2 startup from kernel command
line. One of usecases is in rescue mode, disabling lvm2 will
allow user to enable lvm2 devices by manual.
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
2023-09-07:
The file udev/69-dm-lvm-metad.rules.in has been removed since v2_03_19.
So remove the change of above file.
Signed-off-by: Glass Su <glass.su@suse.com>
---
diff -Nupr a/scripts/lvm2-pvscan.service.in b/scripts/lvm2-pvscan.service.in
--- a/scripts/lvm2-pvscan.service.in 2022-09-02 14:05:03.706825230 +0800
+++ b/scripts/lvm2-pvscan.service.in 2022-09-02 14:04:09.115063287 +0800
@@ -7,6 +7,7 @@ BindsTo=dev-block-%i.device
After=multipathd.service
Before=shutdown.target
Conflicts=shutdown.target
+ConditionKernelCommandLine=!nolvm
[Service]
Type=oneshot
diff -Nupr a/udev/69-dm-lvm.rules.in b/udev/69-dm-lvm.rules.in
--- a/udev/69-dm-lvm.rules.in 2022-09-02 14:04:51.074880312 +0800
+++ b/udev/69-dm-lvm.rules.in 2022-09-02 14:07:19.978230990 +0800
@@ -10,6 +10,9 @@ (LVM_EXEC_RULE)
ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="lvm_end"
+IMPORT{cmdline}="nolvm"
+ENV{nolvm}=="?*", GOTO="lvm_end"
+
# Ignore PVs on LVs.
# This is usually a case of an LV being used for a guest VM
# image, where the guest is using lvm. The host should
# ignore lvm data from the guest and not attempt to scan or

View File

@ -0,0 +1,20 @@
From: Heming Zhao <heming.zhao@suse.com>
Date: Sun, 20 Aug 2023 11:41:00 +0800
This patch is for 'bsc#1214071 - blkdeactivate calls wrong mountpoint cmd'.
Current 12sp5, 15sp2, 15sp3, 15sp4 & 15sp5 need to fix.
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
diff -Nupr a/scripts/blkdeactivate.sh.in b/scripts/blkdeactivate.sh.in
--- a/scripts/blkdeactivate.sh.in 2023-08-20 10:23:36.744082346 +0800
+++ b/scripts/blkdeactivate.sh.in 2023-08-20 10:23:59.544161133 +0800
@@ -35,7 +35,7 @@ DEV_DIR="/dev"
SYS_BLK_DIR="/sys/block"
MDADM="/sbin/mdadm"
-MOUNTPOINT="/bin/mountpoint"
+MOUNTPOINT="/usr/bin/mountpoint"
MPATHD="/sbin/multipathd"
UMOUNT="/bin/umount"
VDO="/bin/vdo"

View File

@ -0,0 +1,36 @@
From 3ef8ec8eb6a8ccde2ca4db53fcac224eedaf4a28 Mon Sep 17 00:00:00 2001
From: Su Yue <glass.su@suse.com>
Date: Tue, 13 Aug 2024 20:57:53 +0800
Subject: [PATCH] lvm2-monitor.service: start after system fully booted
This patch is for 'bsc#1228854 - lvm2-monitor.service fails to start'.
All verions with system.devices enabled should contain this patch.
Signed-off-by: Su Yue <glass.su@suse.com>
---
scripts/lvm2_monitoring_systemd_red_hat.service.in | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/scripts/lvm2_monitoring_systemd_red_hat.service.in b/scripts/lvm2_monitoring_systemd_red_hat.service.in
index c0c96e316b67..b50007cd8bd2 100644
--- a/scripts/lvm2_monitoring_systemd_red_hat.service.in
+++ b/scripts/lvm2_monitoring_systemd_red_hat.service.in
@@ -3,9 +3,6 @@ Description=Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progres
Documentation=man:dmeventd(8) man:lvcreate(8) man:lvchange(8) man:vgchange(8)
Requires=dm-event.socket
After=dm-event.socket dm-event.service
-Before=local-fs-pre.target shutdown.target
-DefaultDependencies=no
-Conflicts=shutdown.target
[Service]
Type=oneshot
@@ -15,4 +12,4 @@ ExecStop=@SBINDIR@/lvm vgchange --monitor n
RemainAfterExit=yes
[Install]
-WantedBy=sysinit.target
+WantedBy=multi-user.target
--
2.45.2

View File

@ -0,0 +1,36 @@
From d5246ee0d534677439cf4af780422fbb2c9068b2 Mon Sep 17 00:00:00 2001
From: Liuhua Wang <lwang@suse.com>
Date: Thu, 9 Jul 2015 15:44:20 +0800
Subject: [PATCH] dmeventd: fix dso name wrong compare
dso_name is thought as not empty and doesn't create monitor thread,
because lvm sets empty dso_name with "-".
Signed-off-by: Liuhua Wang <lwang@suse.com>
References: bnc#935623
---
daemons/dmeventd/dmeventd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git LVM2.2.02.120.orig/daemons/dmeventd/dmeventd.c LVM2.2.02.120/daemons/dmeventd/dmeventd.c
index e8d1e3b..3b1952c 100644
--- LVM2.2.02.120.orig/daemons/dmeventd/dmeventd.c
+++ LVM2.2.02.120/daemons/dmeventd/dmeventd.c
@@ -1218,12 +1218,12 @@ static int _want_registered_device(char *dso_name, char *device_uuid,
struct thread_status *thread)
{
/* If DSO names and device paths are equal. */
- if (dso_name && device_uuid)
+ if (dso_name && strcmp(dso_name, "-") && device_uuid)
return !strcmp(dso_name, thread->dso_data->dso_name) &&
!strcmp(device_uuid, thread->device.uuid);
/* If DSO names are equal. */
- if (dso_name)
+ if (dso_name && strcmp(dso_name, "-"))
return !strcmp(dso_name, thread->dso_data->dso_name);
/* If device paths are equal. */
--
1.8.4.5

View File

@ -0,0 +1,23 @@
From 0da043466ace27eb483114c87ce81feaf00ed682 Mon Sep 17 00:00:00 2001
From: Eric Ren <zren@suse.com>
Date: Thu, 6 Apr 2017 11:22:30 +0800
Subject: [PATCH] systemd service: make pvscan service after multipathd
bsc#998893
Signed-off-by: Eric Ren <zren@suse.com>
2020-05-13:
lvm2-lvmetad had been removed, so this patch was modified too.
Signed-off-by: Heming zhao <heming.zhao@suse.com>
---
diff -Nupr a/scripts/lvm2-pvscan.service.in b/scripts/lvm2-pvscan.service.in
--- a/scripts/lvm2-pvscan.service.in 2020-05-13 11:28:58.290210992 +0800
+++ b/scripts/lvm2-pvscan.service.in 2020-05-13 11:29:42.997788967 +0800
@@ -4,6 +4,7 @@ Documentation=man:pvscan(8)
DefaultDependencies=no
StartLimitIntervalSec=0
BindsTo=dev-block-%i.device
+After=multipathd.service
Before=shutdown.target
Conflicts=shutdown.target

View File

@ -0,0 +1,16 @@
cmirrord: Do not compile in Data and Time to avoid build retriggering in obs
Signed-off-by: Thomas Renninger <trenn@suse.de>
Index: LVM2.2.02.139/daemons/cmirrord/clogd.c
===================================================================
--- LVM2.2.02.139.orig/daemons/cmirrord/clogd.c
+++ LVM2.2.02.139/daemons/cmirrord/clogd.c
@@ -78,7 +78,6 @@ int main(int argc, char *argv[])
kill(getppid(), SIGTERM);
LOG_PRINT("Starting cmirrord:");
- LOG_PRINT(" Built: "__DATE__" "__TIME__"\n");
LOG_DBG(" Compiled with debugging.");
while (!exit_now) {

View File

@ -0,0 +1,56 @@
---
lib/config/config_settings.h | 3 +++
lib/config/defaults.h | 1 +
lib/display/display.c | 13 +++++++++----
3 files changed, 13 insertions(+), 4 deletions(-)
Index: LVM2.2.02.170/lib/config/config_settings.h
===================================================================
--- LVM2.2.02.170.orig/lib/config/config_settings.h
+++ LVM2.2.02.170/lib/config/config_settings.h
@@ -1039,6 +1039,9 @@ cfg(global_fsadm_executable_CFG, "fsadm_
"The full path to the fsadm command.\n"
"LVM uses this command to help with lvresize -r operations.\n")
+cfg(global_display_dm_name_for_lv_name_CFG, "display_dm_name_for_lv_name", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_BOOL, DEFAULT_DISPLAY_DM_NAME_FOR_LV_NAME, vsn(2, 2, 98), NULL, 0, NULL,
+ "Display dm name for lv name.\n")
+
cfg(global_system_id_source_CFG, "system_id_source", global_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_SYSTEM_ID_SOURCE, vsn(2, 2, 117), NULL, 0, NULL,
"The method LVM uses to set the local system ID.\n"
"Volume Groups can also be given a system ID (by vgcreate, vgchange,\n"
Index: LVM2.2.02.170/lib/config/defaults.h
===================================================================
--- LVM2.2.02.170.orig/lib/config/defaults.h
+++ LVM2.2.02.170/lib/config/defaults.h
@@ -33,6 +33,7 @@
#define DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV 0
#define DEFAULT_EXTERNAL_DEVICE_INFO_SOURCE "none"
#define DEFAULT_SYSFS_SCAN 1
+#define DEFAULT_DISPLAY_DM_NAME_FOR_LV_NAME 0
#define DEFAULT_MD_COMPONENT_DETECTION 1
#define DEFAULT_FW_RAID_COMPONENT_DETECTION 0
#define DEFAULT_MD_CHUNK_ALIGNMENT 1
Index: LVM2.2.02.170/lib/display/display.c
===================================================================
--- LVM2.2.02.170.orig/lib/display/display.c
+++ LVM2.2.02.170/lib/display/display.c
@@ -413,10 +413,15 @@ int lvdisplay_full(struct cmd_context *c
lv->vg->cmd->dev_dir, lv->vg->name, lv->name);
else if (lv_is_visible(lv)) {
/* Thin pool does not have /dev/vg/name link */
- if (!lv_is_thin_pool(lv))
- log_print("LV Path %s%s/%s",
- lv->vg->cmd->dev_dir,
- lv->vg->name, lv->name);
+ if (!lv_is_thin_pool(lv)) {
+ if (find_config_tree_bool(cmd, global_display_dm_name_for_lv_name_CFG, NULL)) {
+ log_print("LV Path %smapper/%s-%s", lv->vg->cmd->dev_dir,
+ lv->vg->name, lv->name);
+ } else {
+ log_print("LV Path %s%s/%s", lv->vg->cmd->dev_dir,
+ lv->vg->name, lv->name);
+ }
+ }
log_print("LV Name %s", lv->name);
} else
log_print("Internal LV Name %s", lv->name);

View File

@ -0,0 +1,191 @@
From 29562a0f53dad77d5d62f5d8b3bf29401d619867 Mon Sep 17 00:00:00 2001
From: Heming Zhao <heming.zhao@suse.com>
Date: Wed, 30 Jun 2021 18:34:27 +0800
Subject: [PATCH 1/3] fsadm: add support to resize & check btrfs filesystem
To: lvm-devel@redhat.com,
zkabelac@redhat.com,
teigland@redhat.com
resize:
btrfs volume may spanning across multiple block devices. resize action should
specific subvolume to not to break the filesystem on LV about to get resized
with lvresize.
this patch finds the mount point first and resizes the filesystem after
getting the device id since there are maybe several devices underneath btrfs
filesystem
check:
check the data integrity.
this patch mounts the device first and then runs `btrfs filesystem scrub
start -B` command
refer legacy patches:
- Ondrej Kozina <okozina@redhat.com>
https://listman.redhat.com/archives/lvm-devel/2012-November/msg00052.html
- Lidong Zhong <lzhong@suse.com>
https://listman.redhat.com/archives/lvm-devel/2015-March/msg00053.html
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
---
scripts/fsadm.sh | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 86 insertions(+), 2 deletions(-)
diff --git a/scripts/fsadm.sh b/scripts/fsadm.sh
index 9ae422f55edf..a7345c503f77 100755
--- a/scripts/fsadm.sh
+++ b/scripts/fsadm.sh
@@ -22,6 +22,7 @@
# ext2/ext3/ext4: resize2fs, tune2fs
# reiserfs: resize_reiserfs, reiserfstune
# xfs: xfs_growfs, xfs_info
+# btrfs: btrfs
#
# Return values:
# 0 success
@@ -59,6 +60,7 @@ XFS_CHECK="xfs_check"
# XFS_REPAIR -n is used when XFS_CHECK is not found
XFS_REPAIR="xfs_repair"
CRYPTSETUP="cryptsetup"
+BTRFS="btrfs"
# user may override lvm location by setting LVM_BINARY
LVM=${LVM_BINARY:-lvm}
@@ -78,6 +80,9 @@ BLOCKCOUNT=
MOUNTPOINT=
MOUNTED=
REMOUNT=
+FINDMNT=
+UUID=
+BTRFS_DEVID=
PROCDIR="/proc"
PROCMOUNTS="$PROCDIR/mounts"
PROCSELFMOUNTINFO="$PROCDIR/self/mountinfo"
@@ -237,6 +242,33 @@ detect_fs() {
verbose "\"$FSTYPE\" filesystem found on \"$VOLUME\"."
}
+check_findmnt() {
+ FINDMNT=$(which findmnt 2>$NULL)
+ test -n "$FINDMNT"
+}
+
+detect_fs_uuid() {
+ UUID=$($BLKID -o value -c $NULL -s UUID "$VOLUME" 2>$NULL)
+ test -n "$UUID"
+}
+
+#find the mountpoint of this device
+detect_mounted_findmnt() {
+ local TMP
+ local STR_IFS=$IFS
+ IFS=" $(echo -n -e '\t')"
+
+ read -r TMP<<EOF
+$($FINDMNT -nuP -o TARGET,UUID 2>$NULL | $GREP "$UUID")
+EOF
+
+ TMP=${TMP##*TARGET=\"}
+ TMP=${TMP%%\"*}
+ MOUNTED=$TMP
+ test -n "$MOUNTED"
+
+ IFS=$STR_IFS
+}
# Check that passed mounted MAJOR:MINOR is not matching $MAJOR:MINOR of resized $VOLUME
validate_mounted_major_minor() {
@@ -365,7 +397,11 @@ detect_mounted_with_proc_mounts() {
# check if the given device is already mounted and where
# FIXME: resolve swap usage and device stacking
detect_mounted() {
- if test -e "$PROCSELFMOUNTINFO"; then
+ if test "$FSTYPE" = "btrfs" ; then
+ check_findmnt || error "Need 'findmnt' utility to work with btrfs filesystem"
+ detect_fs_uuid || verbose "Can't get fs UUID from \"$VOLUME\" volume"
+ detect_mounted_findmnt
+ elif test -e "$PROCSELFMOUNTINFO"; then
detect_mounted_with_proc_self_mountinfo
elif test -e "$PROCMOUNTS"; then
detect_mounted_with_proc_mounts
@@ -662,6 +698,47 @@ resize_crypt() {
dry "$CRYPTSETUP" resize "$1" --size $CRYPT_RESIZE_BLOCKS || error "$CRYPTSETUP failed to resize device $1"
}
+########################
+# Resize btrfs filesystem
+# - mounted for upsize/downsize
+# - cannot resize when unmounted
+########################
+resize_btrfs() {
+ detect_mounted
+ MOUNTPOINT=$MOUNTED
+ if [ -z "$MOUNTED" ]; then
+ MOUNTPOINT=$TEMPDIR
+ temp_mount || error "Cannot mount Btrfs filesystem"
+ fi
+
+ verbose "Parsing $BTRFS filesystem show \"$MOUNTPOINT\""
+ for i in $(LC_ALL=C "$BTRFS" filesystem show "$MOUNTPOINT"); do
+ case "$i" in
+ *"$VOLUME") BTRFS_DEVID=${i##*devid};;
+ esac
+ done
+
+ # If dev doesn't locate in "/dev", 'btrfs filesystem show' will mistakely
+ # report path. Below is a work around to get correct lvm dev path.
+ if [ -z "$BTRFS_DEVID" ];then
+ for i in $(LC_ALL=C "$BTRFS" filesystem show "$MOUNTPOINT"); do
+ case "$i" in
+ *" path "*)
+ path_str=${i##*path}
+ path_str=$(echo $path_str|sed 's/^[ \t]*//g'|sed 's/[ \t]*$'//g)
+ result=$(echo $VOLUME | grep -E "${path_str}$")
+ test -n "$result" && BTRFS_DEVID=${i##*devid}
+ ;;
+ esac
+ done
+ fi
+ BTRFS_DEVID=${BTRFS_DEVID%%size*}
+ BTRFS_DEVID=$(echo $BTRFS_DEVID|sed 's/^[ \t]*//g'|sed 's/[ \t]*$'//g)
+ decode_size $1 1
+ verbose "Resizing filesystem on device \"$VOLUME\" to $NEWSIZE bytes(btrfs devid: $BTRFS_DEVID) "
+ dry "$BTRFS" filesystem resize "$BTRFS_DEVID":"$NEWSIZE" "$MOUNTPOINT"
+}
+
####################
# Resize filesystem
####################
@@ -685,6 +762,7 @@ resize() {
"crypto_LUKS")
which "$CRYPTSETUP" >"$NULL" 2>&1 || error "$CRYPTSETUP utility required to resize LUKS volume"
CMD=resize_luks ;;
+ "btrfs") CMD=resize_btrfs ;;
*) error "Filesystem \"$FSTYPE\" on device \"$VOLUME\" is not supported by this tool." ;;
esac
@@ -762,6 +840,12 @@ check() {
which "$CRYPTSETUP" >"$NULL" 2>&1 || error "$CRYPTSETUP utility required."
check_luks || error "Crypto luks check failed."
;;
+ "btrfs") #mount the device first and then run scrub
+ MOUNTPOINT=$TEMPDIR
+ temp_mount || error "Cannot mount btrfs filesystem"
+ dry "$BTRFS" scrub start -B "$VOLUME"
+ test "$MOUNTPOINT" = "$TEMPDIR" && MOUNTPOINT="" temp_umount
+ ;;
*)
error "Filesystem \"$FSTYPE\" on device \"$VOLUME\" is not supported by this tool." ;;
esac
@@ -780,7 +864,7 @@ test -n "${FSADM_RUNNING-}" && exit 0
for i in "$TUNE_EXT" "$RESIZE_EXT" "$TUNE_REISER" "$RESIZE_REISER" \
"$TUNE_XFS" "$RESIZE_XFS" "$MOUNT" "$UMOUNT" "$MKDIR" \
"$RMDIR" "$BLOCKDEV" "$BLKID" "$GREP" "$READLINK" \
- "$DATE" "$FSCK" "$XFS_CHECK" "$XFS_REPAIR" "$LVM" ; do
+ "$DATE" "$FSCK" "$XFS_CHECK" "$XFS_REPAIR" "$LVM" "$BTRFS" ; do
test -n "$i" || error "Required command definitions in the script are missing!"
done
--
1.8.3.1

View File

@ -0,0 +1,38 @@
From 34c04711e6c2a926b335c746643da7d4b5bba33e Mon Sep 17 00:00:00 2001
From: Heming Zhao <heming.zhao@suse.com>
Date: Wed, 30 Jun 2021 18:39:10 +0800
Subject: [PATCH 2/3] man: add support for btrfs
To: lvm-devel@redhat.com,
zkabelac@redhat.com,
teigland@redhat.com
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
---
man/fsadm.8_main | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/man/fsadm.8_main b/man/fsadm.8_main
index dfff5bb97021..ad924ac3a304 100644
--- a/man/fsadm.8_main
+++ b/man/fsadm.8_main
@@ -31,6 +31,7 @@ It tries to use the same API for
.BR ext2 ,
.BR ext3 ,
.BR ext4 ,
+.BR btrfs ,
.BR ReiserFS
and
.BR XFS
@@ -119,6 +120,9 @@ Defaults to "\fI/dev\fP" and must be an absolute path.
.BR tune2fs (8),
.BR resize2fs (8),
.P
+.BR btrfs (8),
+.BR btrfs-scrub (8),
+.P
.BR reiserfstune (8),
.BR resize_reiserfs (8),
.P
--
1.8.3.1

View File

@ -0,0 +1,205 @@
From 24ec9af4513890b2ab1a6f3683e8aba007a3c983 Mon Sep 17 00:00:00 2001
From: Heming Zhao <heming.zhao@suse.com>
Date: Wed, 30 Jun 2021 18:41:42 +0800
Subject: [PATCH] tests: new test suite of fsadm for btrfs
refer legacy patche:
- Ondrej Kozina <okozina@redhat.com>
https://listman.redhat.com/archives/lvm-devel/2012-November/msg00055.html
Signed-off-by: Heming Zhao <heming.zhao@suse.com>
2023-09-08:
LVs should be resized to 64M after each test.
Signed-off-by: Su Yue <glass.su@suse.com>
---
test/shell/fsadm-btrfs.sh | 176 ++++++++++++++++++++++++++++++++++++++
1 file changed, 176 insertions(+)
create mode 100644 test/shell/fsadm-btrfs.sh
diff --git a/test/shell/fsadm-btrfs.sh b/test/shell/fsadm-btrfs.sh
new file mode 100644
index 000000000000..c1b65036efb2
--- /dev/null
+++ b/test/shell/fsadm-btrfs.sh
@@ -0,0 +1,176 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+# 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 General Public License v.2.
+#
+# You should have received a copy of the GNU 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
+
+test_description='Exercise fsadm btrfs resize'
+
+. lib/inittest
+
+aux prepare_vg 1 1024
+
+# set to "skip" to avoid testing given fs and test warning result
+# i.e. check_btrfs=skip
+check_btrfs=
+
+which mkfs.btrfs || check_btrfs=${check_btrfs:-mkfs.btrfs}
+which btrfs || check_btrfs=${check_btrfs:-btrfs}
+
+vg_lv=$vg/$lv1
+vg_lv2=$vg/${lv1}bar
+vg_lv3=$vg/${lv1}bar2
+dev_vg_lv="$DM_DEV_DIR/$vg_lv"
+dev_vg_lv2="$DM_DEV_DIR/$vg_lv2"
+dev_vg_lv3="$DM_DEV_DIR/$vg_lv3"
+mount_dir="mnt"
+mount_space_dir="mnt space dir"
+# for recursive call
+export LVM_BINARY=$(which lvm)
+
+test ! -d "$mount_dir" && mkdir "$mount_dir"
+test ! -d "$mount_space_dir" && mkdir "$mount_space_dir"
+
+cleanup_mounted_and_teardown()
+{
+ umount "$mount_dir" || true
+ umount "$mount_space_dir" || true
+ aux teardown
+}
+
+reset_lvs()
+{
+ # Since we call mkfs.btrfs with '-f', lvreduce to 64M is enough
+ lvreduce -L64M -nf $vg_lv || true
+ lvreduce -L64M -nf $vg_lv2 || true
+ lvreduce -L64M -nf $vg_lv3 || true
+}
+
+check_missing_btrfs()
+{
+ eval local t=$check_btrfs
+ test -z "$t" && return 0
+ test "$t" = skip && return 1
+ # trick for warning test
+ echo "WARNING: fsadm test skipped btrfs tests, $t tool is missing"
+ return 1
+}
+
+fscheck_btrfs() {
+ btrfsck "$1"
+}
+scrub_btrfs() {
+ btrfs scrub start -B "$1"
+}
+
+# btrfs minimal size calculation is complex, we use 64M here.
+lvcreate -n $lv1 -L64M $vg
+lvcreate -n ${lv1}bar -L64M $vg
+lvcreate -n ${lv1}bar2 -L64M $vg
+trap 'cleanup_mounted_and_teardown' EXIT
+
+single_device_test() {
+ mkfs.btrfs -m single "$dev_vg_lv"
+ mkfs.btrfs -m single "$dev_vg_lv2"
+
+ # kernel limits 256 MB as minimal btrfs resizable size
+ # you can grow fs from 30MB->256MB
+ # but you can't grow from 30MB->180MB
+ fsadm --lvresize resize $vg_lv 256M
+ fsadm --lvresize resize $vg_lv2 256M
+
+ not fsadm -y --lvresize resize $vg_lv 200M
+ lvresize -L+10M -r $vg_lv
+ lvreduce -L256M -r $vg_lv
+ fscheck_btrfs $dev_vg_lv
+
+ mount "$dev_vg_lv" "$mount_dir"
+ mount "$dev_vg_lv2" "$mount_space_dir"
+
+ not fsadm -y --lvresize resize $vg_lv 200M
+ lvresize -L+10M -r $vg_lv
+ lvreduce -L256M -r $vg_lv
+ scrub_btrfs $dev_vg_lv
+ umount "$mount_dir"
+
+ not fsadm -y --lvresize resize $vg_lv2 200M
+ lvresize -L+10M -r $vg_lv2
+ lvreduce -L256M -r $vg_lv2
+ scrub_btrfs $dev_vg_lv2
+ umount "$mount_space_dir"
+}
+
+multiple_devices_test() {
+ mkfs.btrfs -m single -d single -f "$dev_vg_lv" "$dev_vg_lv2" "$dev_vg_lv3"
+
+ fsadm -y --lvresize resize $vg_lv 256M
+ fsadm -y --lvresize resize $vg_lv2 256M
+ fsadm -y --lvresize resize $vg_lv3 256M
+
+ # check if fsadm is able to get/resize btrfs on
+ # the right device
+ lvresize -L+150M $vg_lv
+ fsadm -y resize $vg_lv 300M
+ # no space to extend, so failed
+ not fsadm -y resize $vg_lv2 300M
+ not fsadm -y resize $vg_lv3 300M
+ lvreduce -y -L256M -r $vg_lv
+
+ lvresize -L+150M $vg_lv2
+ fsadm -y resize $vg_lv2 300M
+ not fsadm -y resize $vg_lv3 300M
+ not fsadm -y resize $vg_lv 300M
+ lvreduce -y -L256M -r $vg_lv2
+
+ lvresize -L+150M $vg_lv3
+ fsadm -y resize $vg_lv3 300M
+ not fsadm -y resize $vg_lv2 300M
+ not fsadm -y resize $vg_lv 300M
+ lvreduce -y -L256M -r $vg_lv3
+ fscheck_btrfs $dev_vg_lv
+
+ # repeat with mounted fs
+ mount "$dev_vg_lv" "$mount_dir"
+ mount "$dev_vg_lv2" "$mount_space_dir"
+
+ lvresize -L300M $vg_lv
+ fsadm -y resize $vg_lv 300M
+ not fsadm -y resize $vg_lv2 300M
+ not fsadm -y resize $vg_lv3 300M
+ lvreduce -y -L256M -r $vg_lv
+
+ lvresize -L300M $vg_lv2
+ fsadm -y resize $vg_lv2 300M
+ not fsadm -y resize $vg_lv3 300M
+ not fsadm -y resize $vg_lv 300M
+ lvreduce -y -L256M -r $vg_lv2
+
+ lvresize -L300M $vg_lv3
+ fsadm -y resize $vg_lv3 300M
+ not fsadm -y resize $vg_lv2 300M
+ not fsadm -y resize $vg_lv 300M
+ lvreduce -y -L256M -r $vg_lv3
+
+ scrub_btrfs $dev_vg_lv
+ umount "$mount_dir"
+ umount "$mount_space_dir"
+
+ lvresize -nf -L300M $vg_lv
+ lvresize -nf -L300M $vg_lv2
+}
+
+if check_missing_btrfs; then
+
+ single_device_test
+ # after each test, reset_lv_size should be called to make sure
+ # all lvs are in same state/size.
+ reset_lvs
+ multiple_devices_test
+fi
+
+vgremove -ff $vg
--
2.35.3

2465
lvm.conf Normal file

File diff suppressed because it is too large Load Diff

1
lvm2-rpmlintrc Normal file
View File

@ -0,0 +1 @@
addFilter(r'^lvm2-testsuite')

3380
lvm2.changes Normal file

File diff suppressed because it is too large Load Diff

791
lvm2.spec Normal file
View File

@ -0,0 +1,791 @@
#
# spec file
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define _unpackaged_files_terminate_build 0
%define libname libdevmapper1_03
%define libname_event libdevmapper-event1_03
%define _udevdir %(pkg-config --variable=udevdir udev)
%define cmdlib liblvm2cmd2_03
%define lvm2_version 2.03.24
# For device_mapper_version, it's package version, see bsc#1199074.
# Also note there is another dm version on below "sed -ie ... VERSION_DM".
%define upstream_device_mapper_version 1.02.198
%define device_mapper_version %{lvm2_version}_1.02.198
%define thin_provisioning_version 0.7.0
%define _supportsanlock 1
%define dlm_version 4.0.9
# from lvm2 version 2.03, suse obsoleted clvm, cmirrord, liblvm2app & liblvm2cmd.
# so the obseletes version is 2.03
%define lvm2_clvm_version 2.03
%define lvm2_cmirrord_version 2.03
%define liblvm2app2_2_version 2.03
%define liblvm2cmd2_02_version 2.03
%if 0%{_supportsanlock} == 1
%define sanlock_version 3.3.0
%endif
%if 0%{?suse_version} >= 1600
%define default_use_devices_file 1
%endif
%global flavor @BUILD_FLAVOR@%{nil}
%define psuffix %{nil}
%if "%{flavor}" == "devicemapper"
%define psuffix -device-mapper
%bcond_without devicemapper
%else
%bcond_with devicemapper
%endif
%if "%{flavor}" == "lockd"
%define psuffix -lvmlockd
%bcond_without lockd
%else
%bcond_with lockd
%endif
Name: lvm2%{psuffix}
Version: %{lvm2_version}
Release: 0
Summary: Logical Volume Manager Tools
License: GPL-2.0-or-later AND LGPL-2.1-or-later
Group: System/Base
URL: https://www.sourceware.org/lvm2/
Source: ftp://sourceware.org/pub/lvm2/LVM2.%{version}.tgz
Source1: lvm.conf
Source2: lvm2-rpmlintrc
Source42: ftp://sourceware.org/pub/lvm2/LVM2.%{version}.tgz.asc
Source99: baselibs.conf
# Upstream patches
#Patch0001: n/a
# SUSE patches: 1000+ for LVM
# Never upstream
Patch1001: cmirrord_remove_date_time_from_compilation.patch
Patch1002: fate-309425_display-dm-name-for-lv-name.patch
Patch1003: bug-935623_dmeventd-fix-dso-name-wrong-compare.patch
Patch1004: bug-998893_make_pvscan_service_after_multipathd.patch
Patch1005: bug-1184687_Add-nolvm-for-kernel-cmdline.patch
Patch1006: fate-31841-01_fsadm-add-support-to-resize-check-btrfs-filesystem.patch
Patch1007: fate-31841-02_man-add-support-for-btrfs.patch
Patch1008: fate-31841-03_tests-new-test-suite-of-fsadm-for-btrfs.patch
Patch1009: bug-1214071-blkdeactivate_calls_wrong_mountpoint.patch
Patch1010: bug-1228854_lvm2-monitor-service-start-after-system-fully-booted.patch
# SUSE patches 2000+ for device mapper, udev rules
Patch2001: bug-1012973_simplify-special-case-for-md-in-69-dm-lvm-rules.patch
# SUSE patches 3000+ for test code
Patch3001: bug-1184124-link-tests-as-PIE.patch
# SUSE patches 4000+ for lvm2.spec
Patch4001: bug-1037309_Makefile-skip-compliling-daemons-lvmlockd-directory.patch
# To detect modprobe during build
BuildRequires: kmod-compat
BuildRequires: libaio-devel
BuildRequires: pkgconfig
BuildRequires: python-rpm-macros
BuildRequires: thin-provisioning-tools >= %{thin_provisioning_version}
BuildRequires: pkgconfig(libsystemd)
BuildRequires: pkgconfig(libudev)
Requires: device-mapper >= %{device_mapper_version}
Requires: modutils
# see bsc#1225783 for following 2 lines
Requires: (udev >= 255.7 if udev)
Requires: (multipath-tools >= 0.9.9 if multipath-tools)
Requires(post): coreutils
Requires(postun):coreutils
Provides: lvm = %{version}
Obsoletes: lvm2-cmirrord <= %{lvm2_cmirrord_version}
%{?systemd_requires}
%if %{with devicemapper}
BuildRequires: gcc-c++
BuildRequires: suse-module-tools
BuildRequires: pkgconfig(libselinux)
BuildRequires: pkgconfig(libsepol)
%else
BuildRequires: pkgconfig(blkid)
BuildRequires: pkgconfig(corosync)
%if %{with lockd}
BuildRequires: libdlm-devel >= %{dlm_version}
%if 0%{_supportsanlock} == 1
BuildRequires: sanlock-devel >= %{sanlock_version}
%endif
%else
BuildRequires: gcc-c++
BuildRequires: libselinux-devel
BuildRequires: readline-devel
BuildRequires: pkgconfig(udev)
%endif
%endif
%description
Programs and man pages for configuring and using the LVM2 Logical
Volume Manager.
%prep
%setup -q -n LVM2.%{version}
%patch -P 1001 -p1
%patch -P 1002 -p1
%patch -P 1003 -p1
%patch -P 1004 -p1
%patch -P 1005 -p1
%patch -P 1006 -p1
%patch -P 1007 -p1
%patch -P 1008 -p1
%patch -P 1009 -p1
%patch -P 1010 -p1
%patch -P 2001 -p1
%patch -P 3001 -p1
%if !%{with lockd}
%patch -P 4001 -p1
%endif
%build
%if !%{with devicemapper} && !%{with lockd}
extra_opts="
--enable-blkid_wiping
--with-cache=internal
--with-writecache=internal
--with-integrity=internal
--with-default-locking-dir=/run/lock/lvm
--with-default-pid-dir=/run
--with-default-run-dir=/run/lvm
--enable-fsadm
--enable-write_install
--with-vdo=internal
--with-vdo-format=%{_bindir}/vdoformat
"
%endif
%if %{with lockd}
extra_opts="
--enable-blkid_wiping
--with-default-locking-dir=/run/lock/lvm
--with-default-pid-dir=/run
--with-default-run-dir=/run/lvm
--with-cluster=internal
--enable-lvmlockd-dlm
--enable-lvmlockd-dlmcontrol
%if 0%{_supportsanlock} == 1
--enable-lvmlockd-sanlock
%endif
"
%endif
%if 0%{?default_use_devices_file} == 1
extra_opts="$extra_opts
--with-default-use-devices-file=1
"
%endif
### COMMON-CONFIG-BEGIN ###
export PATH=$PATH:/sbin:%{_sbindir}
# Why this messy fix here? someone released a wrong version...
# There will change library version to 1.03.01, see output "dmsetup --version".
sed -ie "s/%{upstream_device_mapper_version}/1.03.01/g" VERSION_DM
%configure \
--enable-dmeventd \
--enable-dmfilemapd \
--enable-lvmpolld \
--enable-cmdlib \
--enable-udev_rules \
--enable-udev_sync \
--with-udev-prefix="%{_prefix}/" \
--enable-selinux \
--enable-pkgconfig \
--with-usrlibdir=%{_libdir} \
--with-usrsbindir=%{_sbindir} \
--with-libexecdir=%{_libexecdir} \
--with-default-dm-run-dir=/run \
--with-tmpfilesdir=%{_tmpfilesdir} \
--with-thin=internal \
--with-device-gid=6 \
--with-device-mode=0640 \
--with-device-uid=0 \
--with-dmeventd-path=%{_sbindir}/dmeventd \
--with-thin-check=%{_sbindir}/thin_check \
--with-thin-dump=%{_sbindir}/thin_dump \
--with-thin-repair=%{_sbindir}/thin_repair \
--disable-silent-rules \
$extra_opts
### COMMON-CONFIG-END ###
%if %{with devicemapper}
%make_build device-mapper
%else
%make_build
%endif
%install
%if %{with devicemapper}
make DESTDIR=%{buildroot} \
install_device-mapper \
install_systemd_units
ln -s service %{buildroot}/%{_sbindir}/rcdm-event
# provide 1.02 compat links for the shared libraries
# this is needed for various binary packages
ln -s libdevmapper.so.1.03 %{buildroot}/%{_libdir}/libdevmapper.so.1.02
ln -s libdevmapper-event.so.1.03 %{buildroot}/%{_libdir}/libdevmapper-event.so.1.02
# remove blkd, will be in lvm2 proper
# without force on purpose to detect changes and fail if it happens
rm %{buildroot}%{_sbindir}/blkdeactivate
rm %{buildroot}%{_unitdir}/blk-availability.service
rm %{buildroot}%{_unitdir}/lvm2-monitor.service
rm %{buildroot}%{_mandir}/man8/blkdeactivate.8
# remove files, which will be in lvm2 & lockd packages
rm %{buildroot}%{_unitdir}/lvm2-lvmpolld.service
rm %{buildroot}%{_unitdir}/lvm2-lvmpolld.socket
rm %{buildroot}%{_unitdir}/lvmlockd.service
rm %{buildroot}%{_unitdir}/lvmlocks.service
# compat symlinks in /sbin remove with Leap 43
%if 0%{?suse_version} < 1550
mkdir -p %{buildroot}/sbin
ln -s %{_sbindir}/dmsetup %{buildroot}/sbin/dmsetup
%endif
%else
%if %{with lockd}
make DESTDIR=%{buildroot} \
install_systemd_units install_systemd_generators
make DESTDIR=%{buildroot} install -C daemons/lvmlockd
# lvmlockd does not have separate target install the mans by hand for now
install -m0644 -D man/lvmlockd.8 %{buildroot}%{_mandir}/man8/lvmlockd.8
install -m0644 -D man/lvmlockctl.8 %{buildroot}%{_mandir}/man8/lvmlockctl.8
# rc services symlinks
ln -s service %{buildroot}%{_sbindir}/rclvm2-lvmlockd
ln -s service %{buildroot}%{_sbindir}/rclvm2-lvmlocking
# remove files from lvm2 split due to systemd_generators picking them up
rm %{buildroot}%{_unitdir}/blk-availability.service
rm %{buildroot}%{_unitdir}/dm-event.service
rm %{buildroot}%{_unitdir}/dm-event.socket
rm %{buildroot}%{_unitdir}/lvm2-monitor.service
rm %{buildroot}%{_unitdir}/lvm2-lvmpolld.service
rm %{buildroot}%{_unitdir}/lvm2-lvmpolld.socket
%else
%make_install
make install_system_dirs DESTDIR=%{buildroot}
make install_systemd_units DESTDIR=%{buildroot}
make install_systemd_generators DESTDIR=%{buildroot}
make install_tmpfiles_configuration DESTDIR=%{buildroot}
# Install configuration file
install -m 644 %{SOURCE1} "%{buildroot}/%{_sysconfdir}/lvm/"
# Install testsuite
make -C test install DESTDIR=%{buildroot}
%if %{suse_version} >= 1600
%python3_fix_shebang_path %{buildroot}%{_datadir}/lvm2-testsuite/dbus/*
%endif
pushd "%{buildroot}/%{_libdir}"
ln -sf liblvm2cmd.so.2.03 liblvm2cmd.so
for i in libdevmapper-event-lvm2{mirror,raid,snapshot,thin}; do
ln -sf "device-mapper/$i.so" "$i.so"
ln -sf "device-mapper/$i.so" "$i.so.2.03"
done
popd
#rc compat symlinks
ln -s service %{buildroot}%{_sbindir}/rcblk-availability
ln -s service %{buildroot}%{_sbindir}/rclvm2-monitor
ln -s service %{buildroot}%{_sbindir}/rclvm2-lvmpolld
# Remove devicemapper binaries, plain rm so we fail if something change
rm %{buildroot}%{_sbindir}/dmsetup
rm %{buildroot}%{_sbindir}/dmeventd
rm %{buildroot}%{_sbindir}/dmstats
rm %{buildroot}%{_sbindir}/dmfilemapd
rm %{buildroot}%{_udevrulesdir}/10-dm.rules
rm %{buildroot}%{_udevrulesdir}/13-dm-disk.rules
rm %{buildroot}%{_udevrulesdir}/95-dm-notify.rules
rm %{buildroot}%{_unitdir}/dm-event.socket
rm %{buildroot}%{_unitdir}/dm-event.service
# See bsc#1037309 for more info
rm %{buildroot}%{_unitdir}/lvmlockd.service
rm %{buildroot}%{_unitdir}/lvmlocks.service
rm %{buildroot}%{_includedir}/libdevmapper*.h
rm %{buildroot}%{_libdir}/libdevmapper.so.*
rm %{buildroot}%{_libdir}/libdevmapper-event.so.*
rm %{buildroot}%{_libdir}/libdevmapper.so
rm %{buildroot}%{_libdir}/libdevmapper-event.so
rm %{buildroot}%{_libdir}/pkgconfig/devmapper*.pc
rm %{buildroot}%{_mandir}/man8/lvmlockctl.8
rm %{buildroot}%{_mandir}/man8/lvmlockd.8
rm %{buildroot}%{_mandir}/man8/dmstats.8
rm %{buildroot}%{_mandir}/man8/dmsetup.8
rm %{buildroot}%{_mandir}/man8/dmeventd.8
rm %{buildroot}%{_mandir}/man8/dmfilemapd.8
%if 0%{?suse_version} < 1550
# compat symlinks in /sbin remove with Leap 43
mkdir -p %{buildroot}/sbin
pushd %{buildroot}/%{_sbindir}
for i in {vg,pv,lv}*; do
ln -s %{_sbindir}/$i %{buildroot}/sbin/$i
done
popd
%endif
%endif
%endif
%if %{with devicemapper}
%package -n device-mapper
Version: %{device_mapper_version}
Release: 0
Summary: Device Mapper Tools
Group: System/Base
Requires: thin-provisioning-tools >= %{thin_provisioning_version}
Requires(post): coreutils
%description -n device-mapper
Programs and man pages for configuring and using the device mapper.
%pre -n device-mapper
%service_add_pre dm-event.service dm-event.socket
%post -n device-mapper
%service_add_post dm-event.service dm-event.socket
%{?regenerate_initrd_post}
%posttrans -n device-mapper
%{?regenerate_initrd_posttrans}
%preun -n device-mapper
%service_del_preun dm-event.service dm-event.socket
%postun -n device-mapper
%service_del_postun dm-event.service dm-event.socket
%{?regenerate_initrd_post}
%files -n device-mapper
%license COPYING COPYING.LIB
%doc README
%doc udev/12-dm-permissions.rules
%if 0%{?suse_version} < 1550
/sbin/dmsetup
%endif
%{_sbindir}/dmsetup
%{_sbindir}/dmeventd
%{_sbindir}/dmstats
%{_sbindir}/dmfilemapd
%{_mandir}/man8/dmstats.8%{?ext_man}
%{_mandir}/man8/dmsetup.8%{?ext_man}
%{_mandir}/man8/dmeventd.8%{?ext_man}
%{_mandir}/man8/dmfilemapd.8%{?ext_man}
%{_udevrulesdir}/10-dm.rules
%{_udevrulesdir}/13-dm-disk.rules
%{_udevrulesdir}/95-dm-notify.rules
%{_unitdir}/dm-event.socket
%{_sbindir}/rcdm-event
%{_unitdir}/dm-event.service
%package -n %{libname}
Version: %{device_mapper_version}
Release: 0
Summary: Library for device-mapper
Group: System/Libraries
Conflicts: %{name} < %{version}
%description -n %{libname}
Device mapper main shared library
%files -n %{libname}
%{_libdir}/libdevmapper.so.1.03
%{_libdir}/libdevmapper.so.1.02
%post -n %{libname}
%if 0%{?suse_version} < 1550
# in usrmerged scenario we better don't remove ourselves :-)
if [ -f /%{_lib}/libdevmapper.so.1.03 ]; then
# Special migration - the library is now in %{_libdir}, but up to the point where
# zypp removes the 'old' device-mapper package, the old library 'wins' the ldloader race
# resulting in binaries asking for the newer version still getting the old one.
# This in turn results in funny bugs like boo#1045396
# Remove /%{_lib}/libdevmapper.so.1.02 - and the run ldconfig
rm /%{_lib}/libdevmapper.so.1.03
fi
%endif
/sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%package -n %{libname_event}
Version: %{device_mapper_version}
Release: 0
Summary: Event library for device-mapper
Group: System/Libraries
Conflicts: %{name} < %{version}
%description -n %{libname_event}
Device mapper event daemon shared library
%files -n %{libname_event}
%{_libdir}/libdevmapper-event.so.1.03
%{_libdir}/libdevmapper-event.so.1.02
%post -n %{libname_event} -p /sbin/ldconfig
%postun -n %{libname_event} -p /sbin/ldconfig
%package -n device-mapper-devel
Version: %{device_mapper_version}
Release: 0
Summary: Development package for the device mapper
Group: Development/Libraries/C and C++
Requires: %{libname_event} = %{device_mapper_version}
Requires: %{libname} = %{device_mapper_version}
Requires: device-mapper = %{device_mapper_version}
%description -n device-mapper-devel
Files needed for software development using the device mapper
%files -n device-mapper-devel
%{_libdir}/libdevmapper.so
%{_libdir}/libdevmapper-event.so
%{_includedir}/libdevmapper.h
%{_includedir}/libdevmapper-event.h
%{_libdir}/pkgconfig/devmapper.pc
%{_libdir}/pkgconfig/devmapper-event.pc
%else
%if %{with lockd}
%package -n lvm2-lockd
Summary: LVM locking daemon
Group: System/Base
Requires: corosync
Requires: device-mapper >= %{device_mapper_version}
Requires: libdlm >= %{dlm_version}
Requires: lvm2 = %{version}
Obsoletes: lvm2-clvm <= %{lvm2_clvm_version}
%{?systemd_requires}
%if 0%{_supportsanlock} == 1
Requires: sanlock >= %{sanlock_version}
%endif
%description -n lvm2-lockd
LVM commands use lvmlockd to coordinate access to shared storage.
%pre -n lvm2-lockd
%service_add_pre lvmlockd.service lvmlocks.service
%post -n lvm2-lockd
%service_add_post lvmlockd.service lvmlocks.service
%preun -n lvm2-lockd
%service_del_preun lvmlockd.service lvmlocks.service
%postun -n lvm2-lockd
%service_del_postun lvmlockd.service lvmlocks.service
%files -n lvm2-lockd
%defattr(-,root,root,)
%{_sbindir}/lvmlockd
%{_sbindir}/lvmlockctl
%{_mandir}/man8/lvmlockd.8%{?ext_man}
%{_mandir}/man8/lvmlockctl.8%{?ext_man}
%{_unitdir}/lvmlockd.service
%{_unitdir}/lvmlocks.service
%{_sbindir}/rclvm2-lvmlockd
%{_sbindir}/rclvm2-lvmlocking
%else
%pre
%service_add_pre blk-availability.service lvm2-monitor.service lvm2-lvmpolld.service lvm2-lvmpolld.socket
%post
/sbin/ldconfig
%{?regenerate_initrd_post}
%service_add_post blk-availability.service lvm2-monitor.service lvm2-lvmpolld.service lvm2-lvmpolld.socket
# Use %%tmpfiles_create when 13.2 is oldest in support scope
%{_bindir}/systemd-tmpfiles --create %{_tmpfilesdir}/lvm2.conf || :
%posttrans
%{?regenerate_initrd_posttrans}
%preun
%service_del_preun blk-availability.service lvm2-monitor.service lvm2-lvmpolld.service lvm2-lvmpolld.socket
%postun
/sbin/ldconfig
%{?regenerate_initrd_post}
%service_del_postun lvm2-lvmpolld.service lvm2-lvmpolld.socket
%service_del_postun_without_restart blk-availability.service lvm2-monitor.service
%files
%license COPYING COPYING.LIB
%doc README VERSION WHATS_NEW
%doc doc/lvm_fault_handling.txt
# Main binaries
%{_sbindir}/blkdeactivate
%{_sbindir}/fsadm
%{_libexecdir}/lvresize_fs_helper
%{_sbindir}/lvm
%{_sbindir}/lvmconfig
%{_sbindir}/lvmdevices
%{_sbindir}/lvmdump
%{_sbindir}/lvmpolld
%{_sbindir}/lvm_import_vdo
%{_sbindir}/lvchange
%{_sbindir}/lvconvert
%{_sbindir}/lvcreate
%{_sbindir}/lvdisplay
%{_sbindir}/lvextend
%{_sbindir}/lvmdiskscan
%{_sbindir}/lvmsadc
%{_sbindir}/lvmsar
%{_sbindir}/lvreduce
%{_sbindir}/lvremove
%{_sbindir}/lvrename
%{_sbindir}/lvresize
%{_sbindir}/lvs
%{_sbindir}/lvscan
%{_sbindir}/pvchange
%{_sbindir}/pvck
%{_sbindir}/pvcreate
%{_sbindir}/pvdisplay
%{_sbindir}/pvmove
%{_sbindir}/pvremove
%{_sbindir}/pvresize
%{_sbindir}/pvs
%{_sbindir}/pvscan
%{_sbindir}/vgcfgbackup
%{_sbindir}/vgcfgrestore
%{_sbindir}/vgchange
%{_sbindir}/vgck
%{_sbindir}/vgconvert
%{_sbindir}/vgcreate
%{_sbindir}/vgdisplay
%{_sbindir}/vgexport
%{_sbindir}/vgextend
%{_sbindir}/vgimport
%{_sbindir}/vgimportclone
%{_sbindir}/vgimportdevices
%{_sbindir}/vgmerge
%{_sbindir}/vgmknodes
%{_sbindir}/vgreduce
%{_sbindir}/vgremove
%{_sbindir}/vgrename
%{_sbindir}/vgs
%{_sbindir}/vgscan
%{_sbindir}/vgsplit
%{_sbindir}/rcblk-availability
%{_sbindir}/rclvm2-lvmpolld
%{_sbindir}/rclvm2-monitor
# compat symlinks in /sbin
%if 0%{?suse_version} < 1550
/sbin/lvm
/sbin/lvmconfig
/sbin/lvmdevices
/sbin/lvmdump
/sbin/lvmpolld
/sbin/lvm_import_vdo
/sbin/lvchange
/sbin/lvconvert
/sbin/lvcreate
/sbin/lvdisplay
/sbin/lvextend
/sbin/lvmdiskscan
/sbin/lvmsadc
/sbin/lvmsar
/sbin/lvreduce
/sbin/lvremove
/sbin/lvrename
/sbin/lvresize
/sbin/lvs
/sbin/lvscan
/sbin/pvchange
/sbin/pvck
/sbin/pvcreate
/sbin/pvdisplay
/sbin/pvmove
/sbin/pvremove
/sbin/pvresize
/sbin/pvs
/sbin/pvscan
/sbin/vgcfgbackup
/sbin/vgcfgrestore
/sbin/vgchange
/sbin/vgck
/sbin/vgconvert
/sbin/vgcreate
/sbin/vgdisplay
/sbin/vgexport
/sbin/vgextend
/sbin/vgimport
/sbin/vgimportclone
/sbin/vgimportdevices
/sbin/vgmerge
/sbin/vgmknodes
/sbin/vgreduce
/sbin/vgremove
/sbin/vgrename
/sbin/vgs
/sbin/vgscan
/sbin/vgsplit
%endif
%{_mandir}/man5/lvm.conf.5%{?ext_man}
%{_mandir}/man7/lvmautoactivation.7%{?ext_man}
%{_mandir}/man7/lvmcache.7%{?ext_man}
%{_mandir}/man7/lvmraid.7%{?ext_man}
%{_mandir}/man7/lvmreport.7%{?ext_man}
%{_mandir}/man7/lvmthin.7%{?ext_man}
%{_mandir}/man7/lvmsystemid.7%{?ext_man}
%{_mandir}/man7/lvmvdo.7%{?ext_man}
%{_mandir}/man8/fsadm.8%{?ext_man}
%{_mandir}/man8/lvchange.8%{?ext_man}
%{_mandir}/man8/lvconvert.8%{?ext_man}
%{_mandir}/man8/lvcreate.8%{?ext_man}
%{_mandir}/man8/lvdisplay.8%{?ext_man}
%{_mandir}/man8/lvextend.8%{?ext_man}
%{_mandir}/man8/lvm.8%{?ext_man}
%{_mandir}/man8/lvm-config.8%{?ext_man}
%{_mandir}/man8/lvmconfig.8%{?ext_man}
%{_mandir}/man8/lvmdevices.8%{?ext_man}
%{_mandir}/man8/lvm-dumpconfig.8%{?ext_man}
%{_mandir}/man8/lvmdiskscan.8%{?ext_man}
%{_mandir}/man8/lvmdump.8%{?ext_man}
%{_mandir}/man8/lvm-fullreport.8%{?ext_man}
%{_mandir}/man8/lvmsadc.8%{?ext_man}
%{_mandir}/man8/lvmsar.8%{?ext_man}
%{_mandir}/man8/lvreduce.8%{?ext_man}
%{_mandir}/man8/lvremove.8%{?ext_man}
%{_mandir}/man8/lvrename.8%{?ext_man}
%{_mandir}/man8/lvresize.8%{?ext_man}
%{_mandir}/man8/lvs.8%{?ext_man}
%{_mandir}/man8/lvscan.8%{?ext_man}
%{_mandir}/man8/pvchange.8%{?ext_man}
%{_mandir}/man8/pvck.8%{?ext_man}
%{_mandir}/man8/pvcreate.8%{?ext_man}
%{_mandir}/man8/pvdisplay.8%{?ext_man}
%{_mandir}/man8/pvmove.8%{?ext_man}
%{_mandir}/man8/pvremove.8%{?ext_man}
%{_mandir}/man8/pvresize.8%{?ext_man}
%{_mandir}/man8/pvs.8%{?ext_man}
%{_mandir}/man8/pvscan.8%{?ext_man}
%{_mandir}/man8/vgcfgbackup.8%{?ext_man}
%{_mandir}/man8/vgcfgrestore.8%{?ext_man}
%{_mandir}/man8/vgchange.8%{?ext_man}
%{_mandir}/man8/vgck.8%{?ext_man}
%{_mandir}/man8/vgconvert.8%{?ext_man}
%{_mandir}/man8/vgcreate.8%{?ext_man}
%{_mandir}/man8/vgdisplay.8%{?ext_man}
%{_mandir}/man8/vgexport.8%{?ext_man}
%{_mandir}/man8/vgextend.8%{?ext_man}
%{_mandir}/man8/vgimport.8%{?ext_man}
%{_mandir}/man8/vgimportclone.8%{?ext_man}
%{_mandir}/man8/vgimportdevices.8%{?ext_man}
%{_mandir}/man8/vgmerge.8%{?ext_man}
%{_mandir}/man8/vgmknodes.8%{?ext_man}
%{_mandir}/man8/vgreduce.8%{?ext_man}
%{_mandir}/man8/vgremove.8%{?ext_man}
%{_mandir}/man8/vgrename.8%{?ext_man}
%{_mandir}/man8/vgs.8%{?ext_man}
%{_mandir}/man8/vgscan.8%{?ext_man}
%{_mandir}/man8/vgsplit.8%{?ext_man}
%{_mandir}/man8/blkdeactivate.8%{?ext_man}
%{_mandir}/man8/lvmpolld.8%{?ext_man}
%{_mandir}/man8/lvm-lvpoll.8%{?ext_man}
%{_mandir}/man8/lvm_import_vdo.8%{?ext_man}
%{_udevdir}/rules.d/11-dm-lvm.rules
%{_udevdir}/rules.d/69-dm-lvm.rules
%dir %{_sysconfdir}/lvm
%config(noreplace) %{_sysconfdir}/lvm/lvm.conf
%config(noreplace) %{_sysconfdir}/lvm/lvmlocal.conf
%dir %{_sysconfdir}/lvm/profile
%{_sysconfdir}/lvm/profile/command_profile_template.profile
%{_sysconfdir}/lvm/profile/metadata_profile_template.profile
%{_sysconfdir}/lvm/profile/thin-generic.profile
%{_sysconfdir}/lvm/profile/thin-performance.profile
%{_sysconfdir}/lvm/profile/cache-mq.profile
%{_sysconfdir}/lvm/profile/cache-smq.profile
%{_sysconfdir}/lvm/profile/lvmdbusd.profile
%{_sysconfdir}/lvm/profile/vdo-small.profile
%dir %{_sysconfdir}/lvm/cache
%ghost %{_sysconfdir}/lvm/cache/.cache
%dir %{_sysconfdir}/lvm/archive
%dir %{_sysconfdir}/lvm/backup
%{_tmpfilesdir}/%{name}.conf
%{_unitdir}/blk-availability.service
%{_unitdir}/lvm2-monitor.service
%{_unitdir}/lvm2-lvmpolld.socket
%{_unitdir}/lvm2-lvmpolld.service
%dir %{_libdir}/device-mapper
%{_libdir}/device-mapper/libdevmapper-event-lvm2*.so
%{_libdir}/libdevmapper-event-lvm2*.so
%{_libdir}/libdevmapper-event-lvm2*.so.2.03
%package -n %{cmdlib}
Summary: LVM2 command line library
Group: System/Libraries
Conflicts: %{name} < %{version}
Obsoletes: liblvm2app2_2 <= %{liblvm2app2_2_version}
Obsoletes: liblvm2cmd2_02 <= %{liblvm2cmd2_02_version}
%description -n %{cmdlib}
The lvm2 command line library allows building programs that manage
lvm devices without invoking a separate program.
%post -n %{cmdlib} -p /sbin/ldconfig
%postun -n %{cmdlib} -p /sbin/ldconfig
%files -n %{cmdlib}
%{_libdir}/liblvm2cmd.so.*
%package devel
Summary: Development files for LVM2
Group: Development/Libraries/C and C++
Requires: %{cmdlib} = %{version}
Requires: device-mapper-devel
Requires: lvm2 = %{version}
%description devel
This package provides development files for the LVM2 Logical Volume Manager.
%files devel
%{_includedir}/lvm2cmd.h
%{_libdir}/liblvm2cmd.so
%package testsuite
Summary: LVM2 Testsuite
Group: Development/Libraries/C and C++
Requires: %{cmdlib} = %{version}
Requires: lvm2 = %{version}
%description testsuite
An extensive functional testsuite for the LVM2 Logical Volume Manager.
%files testsuite
%{_datarootdir}/lvm2-testsuite/
%{_libexecdir}/lvm2-testsuite/
%{_bindir}/lvm2-testsuite
%endif
%endif
%changelog