diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2018-10-16 23:46:50 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2018-10-16 23:49:35 +0200 |
commit | 015231b11ffedc8e44d74ef3a5204f1e99fc6813 (patch) | |
tree | 5c21f76d15d0b7b12a9d7af1375b2094d8b40490 | |
parent | 32f1afbe36f6cc804a8f4e669af7c90639389811 (diff) | |
download | lvm2-015231b11ffedc8e44d74ef3a5204f1e99fc6813.tar.gz |
tests: better support for /var/run
-rw-r--r-- | test/shell/pvscan-autoactivate.sh | 52 | ||||
-rw-r--r-- | test/shell/pvscan-nomda-bg.sh | 8 |
2 files changed, 36 insertions, 24 deletions
diff --git a/test/shell/pvscan-autoactivate.sh b/test/shell/pvscan-autoactivate.sh index 85a08cff7..5c5a3c651 100644 --- a/test/shell/pvscan-autoactivate.sh +++ b/test/shell/pvscan-autoactivate.sh @@ -19,11 +19,13 @@ aux prepare_pvs 2 vgcreate $vg1 "$dev1" "$dev2" lvcreate -n $lv1 -l 4 -a n $vg1 -mkdir /run/lvm/pvs_online || true +RUNDIR="/run" +test -d "$RUNDIR" || RUNDIR="/var/run" -# the first pvscan scans all devs - -rm /run/lvm/pvs_online/* +# the first pvscan scans all devs +# FIXME: kills logic for running system +rm -rf "$RUNDIR/lvm/pvs_online" +mkdir "$RUNDIR/lvm/pvs_online" || true pvscan --cache -aay check lv_field $vg1/$lv1 lv_active "active" @@ -32,7 +34,8 @@ lvchange -an $vg1 # the first pvscan scans all devs even when # only one device is specified -rm /run/lvm/pvs_online/* +# FIXME: kills logic for running system +rm "$RUNDIR/lvm/pvs_online/*" pvscan --cache -aay "$dev1" check lv_field $vg1/$lv1 lv_active "active" @@ -41,8 +44,9 @@ lvchange -an $vg1 # touch foo to disable first-pvscan case, # then check pvscan with no args scans all -rm /run/lvm/pvs_online/* -touch /run/lvm/pvs_online/foo +# FIXME: kills logic for running system +rm "$RUNDIR/lvm/pvs_online/*" +touch "$RUNDIR/lvm/pvs_online/foo" pvscan --cache -aay check lv_field $vg1/$lv1 lv_active "active" @@ -52,8 +56,9 @@ lvchange -an $vg1 # then check that vg is activated only after # both devs appear separately -rm /run/lvm/pvs_online/* -touch /run/lvm/pvs_online/foo +# FIXME: kills logic for running system +rm "$RUNDIR/lvm/pvs_online/*" +touch "$RUNDIR/lvm/pvs_online/foo" pvscan --cache -aay "$dev1" check lv_field $vg1/$lv1 lv_active "" @@ -65,8 +70,9 @@ lvchange -an $vg1 # then check that vg is activated when both # devs appear together -rm /run/lvm/pvs_online/* -touch /run/lvm/pvs_online/foo +# FIXME: kills logic for running system +rm "$RUNDIR/lvm/pvs_online/*" +touch "$RUNDIR/lvm/pvs_online/foo" pvscan --cache -aay "$dev1" "$dev2" check lv_field $vg1/$lv1 lv_active "active" @@ -86,8 +92,9 @@ lvcreate -n $lv1 -l 4 -a n $vg1 # touch foo to disable first-pvscan case, # test case where dev with metadata appears first -rm /run/lvm/pvs_online/* -touch /run/lvm/pvs_online/foo +# FIXME: kills logic for running system +rm "$RUNDIR/lvm/pvs_online/*" +touch "$RUNDIR/lvm/pvs_online/foo" pvscan --cache -aay "$dev2" check lv_field $vg1/$lv1 lv_active "" @@ -99,8 +106,9 @@ lvchange -an $vg1 # test case where dev without metadata # appears first which triggers scanning all -rm /run/lvm/pvs_online/* -touch /run/lvm/pvs_online/foo +# FIXME: kills logic for running system +rm "$RUNDIR/lvm/pvs_online/*" +touch "$RUNDIR/lvm/pvs_online/foo" pvscan --cache -aay "$dev1" check lv_field $vg1/$lv1 lv_active "active" @@ -111,7 +119,8 @@ lvchange -an $vg1 # dev without metadata is scanned, but # first-pvscan case scans all devs -rm /run/lvm/pvs_online/* +# FIXME: kills logic for running system +rm "$RUNDIR/lvm/pvs_online/*" pvscan --cache -aay "$dev1" check lv_field $vg1/$lv1 lv_active "active" @@ -121,8 +130,9 @@ lvchange -an $vg1 # is online without the -aay option to # activate until after they are online -rm /run/lvm/pvs_online/* -touch /run/lvm/pvs_online/foo +# FIXME: kills logic for running system +rm "$RUNDIR/lvm/pvs_online/*" +touch "$RUNDIR/lvm/pvs_online/foo" pvscan --cache "$dev1" check lv_field $vg1/$lv1 lv_active "" @@ -134,12 +144,12 @@ lvchange -an $vg1 # like previous -rm /run/lvm/pvs_online/* -touch /run/lvm/pvs_online/foo +# FIXME: kills logic for running system +rm "$RUNDIR/lvm/pvs_online/*" +touch "$RUNDIR/lvm/pvs_online/foo" pvscan --cache "$dev1" check lv_field $vg1/$lv1 lv_active "" pvscan --cache -aay "$dev2" check lv_field $vg1/$lv1 lv_active "active" lvchange -an $vg1 - diff --git a/test/shell/pvscan-nomda-bg.sh b/test/shell/pvscan-nomda-bg.sh index d73f3daa2..1b6a176eb 100644 --- a/test/shell/pvscan-nomda-bg.sh +++ b/test/shell/pvscan-nomda-bg.sh @@ -24,10 +24,12 @@ lvcreate -n foo -l 1 -an --zero n $vg1 check inactive $vg1 foo +RUNDIR="/run" +test -d "$RUNDIR" || RUNDIR="/var/run" # create a file in pvs_online to disable the pvscan init # case which scans everything when the first dev appears. -mkdir /run/lvm/pvs_online || true -touch /run/lvm/pvs_online/foo +mkdir "$RUNDIR/lvm/pvs_online" || true +touch "$RUNDIR/lvm/pvs_online/foo" pvscan --cache --background "$dev2" -aay @@ -37,5 +39,5 @@ pvscan --cache --background "$dev1" -aay check active $vg1 foo -rm /run/lvm/pvs_online/foo +rm "$RUNDIR/lvm/pvs_online/foo" vgremove -ff $vg1 |