Thin provision is a mechanism that you can allocate a lvm volume which has a large virtual size for file systems but actually in a small physical size. The physical size can be autoextended in use if thin pool reached a threshold specified in /etc/lvm/lvm.conf.
There are 2 works should be handled when enable lvm2 thinp for kdump:
1) Check if the dump target device or directory is thinp device. 2) Monitor the thin pool and autoextend its size when it reached the threshold during kdump.
According to my testing, the memory consumption procedure for lvm2 thinp is the thin pool size-autoextend phase. For fedora and rhel9, the default crashkernel value is enough. But for rhel8, the default crashkernel value 1G-4G:160M is not enough, so it should be handled particularly.
v1 -> v2:
1) Modified the usage of lvs cmd when check if target is lvm2 thinp device. 2) Removed the sync flag way of mounting for lvm2 thinp target during kdump, use "sync -f vmcore" to force sync data, and handle the error if fails.
v2 -> v3:
1) Removed "sync -f vmcore" patch out of the patch set, for it is addressing an issue which is not specifically to lvm2 thinp support for kdump.
v3 -> v4:
1) Removed lvm2-monitor.service, implemented the monitor service with a loop function within a shell script instead. 2) Add lvm2 thinp support for dump_raw, for it is addressing the similar issue as dump_fs. 3) Dave suggested me to implement the lvm2 thin support in dracut modules instead of kexec-tools. If you are OK with the loop-function-shell-script technical way, I will give a try to migrate it to dracut.
v4 -> v5:
1) A new 80lvmthinpool-monitor module [1] has been integrated in dracut. Now we simply depend on it. 2) Add lvm2 thin provision selftest.
[1]: https://github.com/dracutdevs/dracut/pull/1842
Tao Liu (5): Add lvm2 thin provision dump target checker lvm.conf should be check modified if lvm2 thinp enabled Add dependency of dracut lvmthinpool-monitor module selftest: Only iterate the .sh files for test execution selftest: Add lvm2 thin provision for kdump test
dracut-module-setup.sh | 4 ++ kdump-lib-initramfs.sh | 10 ++++ kdump-lib.sh | 10 ++++ kdumpctl | 1 + tests/scripts/run-test.sh | 4 +- .../lvm2-thinp-kdump/0-local-lvm2-thinp.sh | 59 +++++++++++++++++++ .../testcases/lvm2-thinp-kdump/lvm.conf | 5 ++ 7 files changed, 91 insertions(+), 2 deletions(-) create mode 100755 tests/scripts/testcases/lvm2-thinp-kdump/0-local-lvm2-thinp.sh create mode 100644 tests/scripts/testcases/lvm2-thinp-kdump/lvm.conf
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 ltao@redhat.com --- kdump-lib-initramfs.sh | 9 +++++++++ kdump-lib.sh | 10 ++++++++++ 2 files changed, 19 insertions(+)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index 84e6bf7..bcf9927 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -131,3 +131,12 @@ is_fs_dump_target() { [ -n "$(kdump_get_conf_val "ext[234]|xfs|btrfs|minix")" ] } + +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" ] && return $? +} \ No newline at end of file diff --git a/kdump-lib.sh b/kdump-lib.sh index f7b659e..f32b802 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -117,6 +117,16 @@ is_dump_to_rootfs() [[ $(kdump_get_conf_val 'failure_action|default') == dump_to_rootfs ]] }
+is_lvm2_thinp_dump_target() +{ + _target=$(get_block_dump_target) + if [ -n "$_target" ]; then + is_lvm2_thinp_device "$_target" + else + return 1 + fi +} + get_failure_action_target() { local _target
Hi Tao,
On Mon, 8 Aug 2022 19:52:23 +0800 Tao Liu ltao@redhat.com wrote:
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 ltao@redhat.com
kdump-lib-initramfs.sh | 9 +++++++++ kdump-lib.sh | 10 ++++++++++ 2 files changed, 19 insertions(+)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index 84e6bf7..bcf9927 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -131,3 +131,12 @@ is_fs_dump_target() { [ -n "$(kdump_get_conf_val "ext[234]|xfs|btrfs|minix")" ] }
+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" ] && return $?
you can drop the '&& return $?'. Bash automatically does that on function exit.
+} \ No newline at end of file diff --git a/kdump-lib.sh b/kdump-lib.sh index f7b659e..f32b802 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -117,6 +117,16 @@ is_dump_to_rootfs() [[ $(kdump_get_conf_val 'failure_action|default') == dump_to_rootfs ]] }
+is_lvm2_thinp_dump_target() +{
- _target=$(get_block_dump_target)
- if [ -n "$_target" ]; then
is_lvm2_thinp_device "$_target"- else
return 1- fi
+}
similar to above. You can simply use
[ -n "$_target" ] && is_lvm2_thinp_device "$_target"
or maybe even drop the -n "$_target" when you can guarantee that is_lvm2_thinp_device returns false for an empty target.
Thanks Philipp
get_failure_action_target() { local _target
Hi Philipp,
On Thu, Aug 11, 2022 at 12:24 AM Philipp Rudo prudo@redhat.com wrote:
Hi Tao,
On Mon, 8 Aug 2022 19:52:23 +0800 Tao Liu ltao@redhat.com wrote:
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 ltao@redhat.com
kdump-lib-initramfs.sh | 9 +++++++++ kdump-lib.sh | 10 ++++++++++ 2 files changed, 19 insertions(+)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index 84e6bf7..bcf9927 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -131,3 +131,12 @@ is_fs_dump_target() { [ -n "$(kdump_get_conf_val "ext[234]|xfs|btrfs|minix")" ] }
+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" ] && return $?you can drop the '&& return $?'. Bash automatically does that on function exit.
Agreed
+} \ No newline at end of file diff --git a/kdump-lib.sh b/kdump-lib.sh index f7b659e..f32b802 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -117,6 +117,16 @@ is_dump_to_rootfs() [[ $(kdump_get_conf_val 'failure_action|default') == dump_to_rootfs ]] }
+is_lvm2_thinp_dump_target() +{
_target=$(get_block_dump_target)if [ -n "$_target" ]; thenis_lvm2_thinp_device "$_target"elsereturn 1fi+}
similar to above. You can simply use
[ -n "$_target" ] && is_lvm2_thinp_device "$_target"
Agreed.
or maybe even drop the -n "$_target" when you can guarantee that is_lvm2_thinp_device returns false for an empty target.
Thanks Philipp
get_failure_action_target() { local _target
lvm2 relies on /etc/lvm/lvm.conf to determine its behaviour. The important configs such as thin_pool_autoextend_threshold and thin_pool_autoextend_percent will be used during kdump in 2nd kernel. So if the file is modified, the initramfs should be rebuild to include the latest.
Signed-off-by: Tao Liu ltao@redhat.com --- kdump-lib-initramfs.sh | 1 + kdumpctl | 1 + 2 files changed, 2 insertions(+)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index bcf9927..80da64a 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -8,6 +8,7 @@ DEFAULT_SSHKEY="/root/.ssh/kdump_id_rsa" KDUMP_CONFIG_FILE="/etc/kdump.conf" FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump" FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send" +LVM_CONF="/etc/lvm/lvm.conf"
# Read kdump config in well formated style kdump_read_conf() diff --git a/kdumpctl b/kdumpctl index 126ecb9..18e3043 100755 --- a/kdumpctl +++ b/kdumpctl @@ -390,6 +390,7 @@ check_files_modified()
# HOOKS is mandatory and need to check the modification time files="$files $HOOKS" + is_lvm2_thinp_dump_target && files="$files $LVM_CONF" check_exist "$files" && check_executable "$EXTRA_BINS" || return 2
for file in $files; do
The lvmthinpool-monitor module is needed for monitor and autoextend the size of thin pool in 2nd kernel.
Signed-off-by: Tao Liu ltao@redhat.com --- dracut-module-setup.sh | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 4c6096a..66249dd 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -40,6 +40,10 @@ depends() { _dep="$_dep ssh-client" fi
+ if is_lvm2_thinp_dump_target; then + add_opt_module lvmthinpool-monitor + fi + if [[ "$(uname -m)" == "s390x" ]]; then _dep="$_dep znet" fi
Hi Tao,
On Mon, 8 Aug 2022 19:52:25 +0800 Tao Liu ltao@redhat.com wrote:
The lvmthinpool-monitor module is needed for monitor and autoextend the size of thin pool in 2nd kernel.
for documentation please add the dracut version wich added the module to the commit message.
Other than that the patch looks fine to me.
Thanks Philipp
Signed-off-by: Tao Liu ltao@redhat.com
dracut-module-setup.sh | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 4c6096a..66249dd 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -40,6 +40,10 @@ depends() { _dep="$_dep ssh-client" fi
- if is_lvm2_thinp_dump_target; then
add_opt_module lvmthinpool-monitor- fi
- if [[ "$(uname -m)" == "s390x" ]]; then _dep="$_dep znet" fi
Hi Philipp,
On Thu, Aug 11, 2022 at 12:26 AM Philipp Rudo prudo@redhat.com wrote:
Hi Tao,
On Mon, 8 Aug 2022 19:52:25 +0800 Tao Liu ltao@redhat.com wrote:
The lvmthinpool-monitor module is needed for monitor and autoextend the size of thin pool in 2nd kernel.
for documentation please add the dracut version wich added the module to the commit message.
Agreed
Other than that the patch looks fine to me.
Thank you!
Thanks, Tao Liu
Thanks Philipp
Signed-off-by: Tao Liu ltao@redhat.com
dracut-module-setup.sh | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 4c6096a..66249dd 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -40,6 +40,10 @@ depends() { _dep="$_dep ssh-client" fi
- if is_lvm2_thinp_dump_target; then
add_opt_module lvmthinpool-monitor- fi
- if [[ "$(uname -m)" == "s390x" ]]; then _dep="$_dep znet" fi
Previously, all files within $TESTCASEDIR/$test_case are regarded as shell script files for testing. However there might be config files under the directory. So let's only iterate the .sh files.
Signed-off-by: Tao Liu ltao@redhat.com --- tests/scripts/run-test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/scripts/run-test.sh b/tests/scripts/run-test.sh index 1501db4..68df5fd 100755 --- a/tests/scripts/run-test.sh +++ b/tests/scripts/run-test.sh @@ -85,8 +85,8 @@ for test_case in $testcases; do results[$test_case]="<Test Skipped>"
testdir=$TESTCASEDIR/$test_case - script_num=$(ls -1 $testdir | wc -l) - scripts=$(ls -r -1 $testdir | tr '\n' ' ') + script_num=$(ls -1 $testdir | egrep ".sh$" | wc -l) + scripts=$(ls -r -1 $testdir | egrep ".sh$" | tr '\n' ' ') test_outputs="" read main_script aux_script <<< "$scripts"
Hi Tao,
On Mon, 8 Aug 2022 19:52:26 +0800 Tao Liu ltao@redhat.com wrote:
Previously, all files within $TESTCASEDIR/$test_case are regarded as shell script files for testing. However there might be config files under the directory. So let's only iterate the .sh files.
Signed-off-by: Tao Liu ltao@redhat.com
tests/scripts/run-test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/scripts/run-test.sh b/tests/scripts/run-test.sh index 1501db4..68df5fd 100755 --- a/tests/scripts/run-test.sh +++ b/tests/scripts/run-test.sh @@ -85,8 +85,8 @@ for test_case in $testcases; do results[$test_case]="<Test Skipped>"
testdir=$TESTCASEDIR/$test_case
- script_num=$(ls -1 $testdir | wc -l)
- scripts=$(ls -r -1 $testdir | tr '\n' ' ')
- script_num=$(ls -1 $testdir | egrep ".sh$" | wc -l)
I don't see any user for script_num. I think you can simply drop it.
- scripts=$(ls -r -1 $testdir | egrep ".sh$" | tr '\n' ' ')
Instead of piping to egrep you can simply use the bash globbing, i.e.
ls -r -1 $testdir/*.sh ...
Thanks Philipp
test_outputs="" read main_script aux_script <<< "$scripts"
Hi Philipp,
On Thu, Aug 11, 2022 at 12:29 AM Philipp Rudo prudo@redhat.com wrote:
Hi Tao,
On Mon, 8 Aug 2022 19:52:26 +0800 Tao Liu ltao@redhat.com wrote:
Previously, all files within $TESTCASEDIR/$test_case are regarded as shell script files for testing. However there might be config files under the directory. So let's only iterate the .sh files.
Signed-off-by: Tao Liu ltao@redhat.com
tests/scripts/run-test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/scripts/run-test.sh b/tests/scripts/run-test.sh index 1501db4..68df5fd 100755 --- a/tests/scripts/run-test.sh +++ b/tests/scripts/run-test.sh @@ -85,8 +85,8 @@ for test_case in $testcases; do results[$test_case]="<Test Skipped>"
testdir=$TESTCASEDIR/$test_case
script_num=$(ls -1 $testdir | wc -l)scripts=$(ls -r -1 $testdir | tr '\n' ' ')
script_num=$(ls -1 $testdir | egrep "\.sh$" | wc -l)I don't see any user for script_num. I think you can simply drop it.
Thanks, I will drop it.
scripts=$(ls -r -1 $testdir | egrep "\.sh$" | tr '\n' ' ')Instead of piping to egrep you can simply use the bash globbing, i.e.
ls -r -1 $testdir/*.sh ...
I'm afraid it cannot be modified this way. For command like:
$ ls -r -1 fc-kexec-tools/*.sh fc-kexec-tools/kdump-restart.sh fc-kexec-tools/kdump-migrate-action.sh fc-kexec-tools/kdump-logger.sh ...
$ ls -r -1 fc-kexec-tools | egrep ".sh$" kdump-restart.sh kdump-migrate-action.sh kdump-logger.sh kdump-lib.sh ...
There shouldn't be any folder name for the variable "scripts". The complete path of "script" will later be assembled by "$testdir/$script". I tested the change and it will fail.
Thanks, Tao Liu
Thanks Philipp
test_outputs="" read main_script aux_script <<< "$scripts"
Hi Tao,
On Tue, 16 Aug 2022 18:18:24 +0800 Tao Liu ltao@redhat.com wrote:
Hi Philipp,
On Thu, Aug 11, 2022 at 12:29 AM Philipp Rudo prudo@redhat.com wrote:
Hi Tao,
On Mon, 8 Aug 2022 19:52:26 +0800 Tao Liu ltao@redhat.com wrote:
Previously, all files within $TESTCASEDIR/$test_case are regarded as shell script files for testing. However there might be config files under the directory. So let's only iterate the .sh files.
Signed-off-by: Tao Liu ltao@redhat.com
tests/scripts/run-test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/scripts/run-test.sh b/tests/scripts/run-test.sh index 1501db4..68df5fd 100755 --- a/tests/scripts/run-test.sh +++ b/tests/scripts/run-test.sh @@ -85,8 +85,8 @@ for test_case in $testcases; do results[$test_case]="<Test Skipped>"
testdir=$TESTCASEDIR/$test_case
script_num=$(ls -1 $testdir | wc -l)scripts=$(ls -r -1 $testdir | tr '\n' ' ')
script_num=$(ls -1 $testdir | egrep "\.sh$" | wc -l)I don't see any user for script_num. I think you can simply drop it.
Thanks, I will drop it.
scripts=$(ls -r -1 $testdir | egrep "\.sh$" | tr '\n' ' ')Instead of piping to egrep you can simply use the bash globbing, i.e.
ls -r -1 $testdir/*.sh ...
I'm afraid it cannot be modified this way. For command like:
$ ls -r -1 fc-kexec-tools/*.sh fc-kexec-tools/kdump-restart.sh fc-kexec-tools/kdump-migrate-action.sh fc-kexec-tools/kdump-logger.sh ...
$ ls -r -1 fc-kexec-tools | egrep ".sh$" kdump-restart.sh kdump-migrate-action.sh kdump-logger.sh kdump-lib.sh ...
There shouldn't be any folder name for the variable "scripts". The complete path of "script" will later be assembled by "$testdir/$script". I tested the change and it will fail.
you are right... In that case keep the egrep. I don't think it's worth rewriting all the code to work with the new script path...
Thanks Philipp
Thanks, Tao Liu
Thanks Philipp
test_outputs="" read main_script aux_script <<< "$scripts"
Hi Philipp,
On Tue, Aug 16, 2022 at 6:34 PM Philipp Rudo prudo@redhat.com wrote:
Hi Tao,
On Tue, 16 Aug 2022 18:18:24 +0800 Tao Liu ltao@redhat.com wrote:
Hi Philipp,
On Thu, Aug 11, 2022 at 12:29 AM Philipp Rudo prudo@redhat.com wrote:
Hi Tao,
On Mon, 8 Aug 2022 19:52:26 +0800 Tao Liu ltao@redhat.com wrote:
Previously, all files within $TESTCASEDIR/$test_case are regarded as shell script files for testing. However there might be config files under the directory. So let's only iterate the .sh files.
Signed-off-by: Tao Liu ltao@redhat.com
tests/scripts/run-test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/scripts/run-test.sh b/tests/scripts/run-test.sh index 1501db4..68df5fd 100755 --- a/tests/scripts/run-test.sh +++ b/tests/scripts/run-test.sh @@ -85,8 +85,8 @@ for test_case in $testcases; do results[$test_case]="<Test Skipped>"
testdir=$TESTCASEDIR/$test_case
script_num=$(ls -1 $testdir | wc -l)scripts=$(ls -r -1 $testdir | tr '\n' ' ')
script_num=$(ls -1 $testdir | egrep "\.sh$" | wc -l)I don't see any user for script_num. I think you can simply drop it.
Thanks, I will drop it.
scripts=$(ls -r -1 $testdir | egrep "\.sh$" | tr '\n' ' ')Instead of piping to egrep you can simply use the bash globbing, i.e.
ls -r -1 $testdir/*.sh ...
I'm afraid it cannot be modified this way. For command like:
$ ls -r -1 fc-kexec-tools/*.sh fc-kexec-tools/kdump-restart.sh fc-kexec-tools/kdump-migrate-action.sh fc-kexec-tools/kdump-logger.sh ...
$ ls -r -1 fc-kexec-tools | egrep ".sh$" kdump-restart.sh kdump-migrate-action.sh kdump-logger.sh kdump-lib.sh ...
There shouldn't be any folder name for the variable "scripts". The complete path of "script" will later be assembled by "$testdir/$script". I tested the change and it will fail.
you are right... In that case keep the egrep. I don't think it's worth rewriting all the code to work with the new script path...
Yes, I agree.
Thanks, Tao Liu
Thanks Philipp
Thanks, Tao Liu
Thanks Philipp
test_outputs="" read main_script aux_script <<< "$scripts"
Signed-off-by: Tao Liu ltao@redhat.com --- .../lvm2-thinp-kdump/0-local-lvm2-thinp.sh | 59 +++++++++++++++++++ .../testcases/lvm2-thinp-kdump/lvm.conf | 5 ++ 2 files changed, 64 insertions(+) create mode 100755 tests/scripts/testcases/lvm2-thinp-kdump/0-local-lvm2-thinp.sh create mode 100644 tests/scripts/testcases/lvm2-thinp-kdump/lvm.conf
diff --git a/tests/scripts/testcases/lvm2-thinp-kdump/0-local-lvm2-thinp.sh b/tests/scripts/testcases/lvm2-thinp-kdump/0-local-lvm2-thinp.sh new file mode 100755 index 0000000..c4ebded --- /dev/null +++ b/tests/scripts/testcases/lvm2-thinp-kdump/0-local-lvm2-thinp.sh @@ -0,0 +1,59 @@ +on_build() { + TEST_DIR_PREFIX=/tmp/lvm_test.XXXXXX + # clear TEST_DIRs if any + rm -rf ${TEST_DIR_PREFIX%.*}.* + TEST_IMG="$(mktemp -d $TEST_DIR_PREFIX)/test.img" + + img_inst_pkg "lvm2" + img_inst $TESTDIR/scripts/testcases/lvm2-thinp-kdump/lvm.conf /etc/lvm/ + dd if=/dev/zero of=$TEST_IMG bs=300M count=1 + # The test.img will be /dev/sdb + img_add_qemu_cmd "-hdb $TEST_IMG" +} + +on_test() { + VG=vg00 + LV_THINPOOL=thinpool + LV_VOLUME=thinlv + VMCORE_PATH=var/crash + + local boot_count=$(get_test_boot_count) + + if [ $boot_count -eq 1 ]; then + + vgcreate $VG /dev/sdb + # Create a small thinpool which is definitely not enough for + # vmcore, then create a thin volume which is definitely enough + # for vmcore, so we can make sure thinpool should be autoextend + # during runtime. + lvcreate -L 10M -T $VG/$LV_THINPOOL + lvcreate -V 300M -T $VG/$LV_THINPOOL -n $LV_VOLUME + mkfs.ext4 /dev/$VG/$LV_VOLUME + mount /dev/$VG/$LV_VOLUME /mnt + mkdir -p /mnt/$VMCORE_PATH + + cat << EOF > /etc/kdump.conf +ext4 /dev/$VG/$LV_VOLUME +path /$VMCORE_PATH +core_collector makedumpfile -l --message-level 7 -d 31 +EOF + kdumpctl start || test_failed "Failed to start kdump" + + sync + + echo 1 > /proc/sys/kernel/sysrq + echo c > /proc/sysrq-trigger + + elif [ $boot_count -eq 2 ]; then + mount /dev/$VG/$LV_VOLUME /mnt + if has_valid_vmcore_dir /mnt/$VMCORE_PATH; then + test_passed + else + test_failed "Vmcore missing" + fi + + shutdown -h 0 + else + test_failed "Unexpected reboot" + fi +} diff --git a/tests/scripts/testcases/lvm2-thinp-kdump/lvm.conf b/tests/scripts/testcases/lvm2-thinp-kdump/lvm.conf new file mode 100644 index 0000000..4d81fbd --- /dev/null +++ b/tests/scripts/testcases/lvm2-thinp-kdump/lvm.conf @@ -0,0 +1,5 @@ +activation { + thin_pool_autoextend_threshold = 70 + thin_pool_autoextend_percent = 20 + monitoring = 1 +} \ No newline at end of file