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.
Signed-off-by: Tao Liu <ltao(a)redhat.com>
---
kdump-lib-initramfs.sh | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh
index 84e6bf7..92404f4 100755
--- a/kdump-lib-initramfs.sh
+++ b/kdump-lib-initramfs.sh
@@ -131,3 +131,22 @@ is_fs_dump_target()
{
[ -n "$(kdump_get_conf_val "ext[234]\|xfs\|btrfs\|minix")" ]
}
+
+is_lvm2_thinp_device()
+{
+ _device_path=$1
+ _lvm2_thin_device=$(lvs -S 'lv_layout=sparse && lv_layout=thin' \
+ --nosuffix --noheadings -o vg_name,lv_name "$_device_path" 2>/dev/null)
+
+ [ -n "$_lvm2_thin_device" ] && return $?
+}
+
+is_lvm2_thinp_dump_target()
+{
+ _target=$(get_block_dump_target)
+ if [ -n "$_target" ]; then
+ is_lvm2_thinp_device "$_target"
+ else
+ return 1
+ fi
+}
\ No newline at end of file
--
2.33.1