mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-07 17:17:44 +03:00
Merge pull request #26285 from yuwata/test-lvextend
test: add a testcase for lvextend
This commit is contained in:
commit
cc3826155d
@ -89,6 +89,8 @@ check_device_unit() {(
|
|||||||
path="${2?}"
|
path="${2?}"
|
||||||
unit=$(systemd-escape --path --suffix=device "$path")
|
unit=$(systemd-escape --path --suffix=device "$path")
|
||||||
|
|
||||||
|
[[ "$log_level" == 1 ]] && echo "INFO: check_device_unit($unit)"
|
||||||
|
|
||||||
syspath=$(systemctl show --value --property SysFSPath "$unit" 2>/dev/null)
|
syspath=$(systemctl show --value --property SysFSPath "$unit" 2>/dev/null)
|
||||||
if [[ -z "$syspath" ]]; then
|
if [[ -z "$syspath" ]]; then
|
||||||
[[ "$log_level" == 1 ]] && echo >&2 "ERROR: $unit not found."
|
[[ "$log_level" == 1 ]] && echo >&2 "ERROR: $unit not found."
|
||||||
@ -156,12 +158,11 @@ helper_check_device_units() {(
|
|||||||
|
|
||||||
local i
|
local i
|
||||||
|
|
||||||
for ((i = 0; i < 20; i++)); do
|
for (( i = 0; i < 20; i++ )); do
|
||||||
(( i == 0 )) || sleep .5
|
|
||||||
|
|
||||||
if check_device_units 0 "$@"; then
|
if check_device_units 0 "$@"; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
sleep .5
|
||||||
done
|
done
|
||||||
|
|
||||||
check_device_units 1 "$@"
|
check_device_units 1 "$@"
|
||||||
@ -425,6 +426,26 @@ testcase_lvm_basic() {
|
|||||||
helper_check_device_symlinks "/dev/disk" "/dev/$vgroup"
|
helper_check_device_symlinks "/dev/disk" "/dev/$vgroup"
|
||||||
helper_check_device_units
|
helper_check_device_units
|
||||||
|
|
||||||
|
# Mount mypart1 through by-label devlink
|
||||||
|
mkdir -p /tmp/mypart1-mount-point
|
||||||
|
mount /dev/disk/by-label/mylvpart1 /tmp/mypart1-mount-point
|
||||||
|
timeout 30 bash -c "while ! systemctl -q is-active /tmp/mypart1-mount-point; do sleep .2; done"
|
||||||
|
# Extend the partition and check if the device and mount units are still active.
|
||||||
|
# See https://bugzilla.redhat.com/show_bug.cgi?id=2158628
|
||||||
|
# Note, the test below may be unstable with LVM2 without the following patch:
|
||||||
|
# https://github.com/lvmteam/lvm2/pull/105
|
||||||
|
# But, to reproduce the issue, udevd must start to process the first 'change' uevent
|
||||||
|
# earlier than extending the volume has been finished, and in most case, the extension
|
||||||
|
# is hopefully fast.
|
||||||
|
lvm lvextend -y --size 8M "/dev/$vgroup/mypart1"
|
||||||
|
udevadm wait --settle --timeout="$timeout" "/dev/disk/by-label/mylvpart1"
|
||||||
|
timeout 30 bash -c "while ! systemctl -q is-active '/dev/$vgroup/mypart1'; do sleep .2; done"
|
||||||
|
timeout 30 bash -c "while ! systemctl -q is-active /tmp/mypart1-mount-point; do sleep .2; done"
|
||||||
|
# Umount the partition, otherwise the underlying device unit will stay in
|
||||||
|
# the inactive state and not be collected, and helper_check_device_units() will fail.
|
||||||
|
systemctl show /tmp/mypart1-mount-point
|
||||||
|
umount /tmp/mypart1-mount-point
|
||||||
|
|
||||||
# Rename partitions (see issue #24518)
|
# Rename partitions (see issue #24518)
|
||||||
lvm lvrename "/dev/$vgroup/mypart1" renamed1
|
lvm lvrename "/dev/$vgroup/mypart1" renamed1
|
||||||
lvm lvrename "/dev/$vgroup/mypart2" renamed2
|
lvm lvrename "/dev/$vgroup/mypart2" renamed2
|
||||||
|
Loading…
Reference in New Issue
Block a user