From 94988e9e3d8ad2989ccab208b7ae69b238e00ade Mon Sep 17 00:00:00 2001 From: Tao Liu Date: Wed, 9 Nov 2022 15:56:18 +0800 Subject: [PATCH] Add lvm2 thin provision dump target checker resolves: bz2083475 upstream: fedora conflict: none commit 0a5b71d123ee41b244732fb04d224d36e9ccff84 Author: Tao Liu Date: Sat Oct 8 15:41:39 2022 +0800 Add lvm2 thin provision dump target checker We need to check if a directory or a device is lvm2 thinp target. First, we use get_block_dump_target() to convert dump path into block device, then we check if the device is lvm2 thinp target by cmd lvs. is_lvm2_thinp_device is now located in kdump-lib-initramfs.sh, for it will be used in 2nd kernel. is_lvm2_thinp_dump_target is located in kdump-lib.sh, for it is only used in 1st kernel, and it has dependencies which exist in kdump-lib.sh. Signed-off-by: Tao Liu Reviewed-by: Philipp Rudo Signed-off-by: Tao Liu --- kdump-lib-initramfs.sh | 9 +++++++++ kdump-lib.sh | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index cd34162..db501e9 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -152,3 +152,12 @@ is_fs_dump_target() { [ -n "$(kdump_get_conf_val "ext[234]\|xfs\|btrfs\|minix\|virtiofs")" ] } + +is_lvm2_thinp_device() +{ + _device_path=$1 + _lvm2_thin_device=$(lvm lvs -S 'lv_layout=sparse && lv_layout=thin' \ + --nosuffix --noheadings -o vg_name,lv_name "$_device_path" 2> /dev/null) + + [ -n "$_lvm2_thin_device" ] +} diff --git a/kdump-lib.sh b/kdump-lib.sh index 0e89268..0c57a38 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -116,6 +116,12 @@ is_dump_to_rootfs() [[ $(kdump_get_conf_val 'failure_action\|default') == dump_to_rootfs ]] } +is_lvm2_thinp_dump_target() +{ + _target=$(get_block_dump_target) + [ -n "$_target" ] && is_lvm2_thinp_device "$_target" +} + get_failure_action_target() { local _target