2024-05-27 19:44:09 +03:00
#!/usr/bin/env bash
2024-05-22 23:32:17 +03:00
# Copyright (C) 2020 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
test_description = 'devices file'
SKIP_WITH_LVMPOLLD = 1
. lib/inittest
aux prepare_devs 1
# The tests run with system dir of "/etc" but lvm when running
# normally has cmd->system_dir set to "/etc/lvm".
DFDIR = " $LVM_SYSTEM_DIR /devices "
mkdir -p " $DFDIR " || true
DF = " $DFDIR /system.devices "
2024-05-27 19:44:09 +03:00
aux lvmconf 'devices/use_devicesfile = 1' \
'devices/scan_lvs = 1'
2024-05-22 23:32:17 +03:00
rm -f " $DF "
touch " $DF "
vgcreate $vg1 " $dev1 "
lvcreate -n $lv1 -L 8M $vg1
lvcreate -n $lv2 -L 8M $vg1
2024-05-27 22:29:58 +03:00
pvcreate " $DM_DEV_DIR / $vg1 / $lv1 "
pvcreate " $DM_DEV_DIR / $vg1 / $lv2 "
vgcreate $vg2 " $DM_DEV_DIR / $vg1 / $lv1 " " $DM_DEV_DIR / $vg1 / $lv2 "
2024-05-22 23:32:17 +03:00
2024-05-27 22:29:58 +03:00
pvs " $DM_DEV_DIR / $vg1 / $lv1 "
pvs " $DM_DEV_DIR / $vg1 / $lv2 "
2024-05-22 23:32:17 +03:00
grep " $dev1 " " $DF "
2024-05-27 22:29:58 +03:00
grep " $DM_DEV_DIR / $vg1 / $lv1 " " $DF " | tee out1
2024-05-22 23:32:17 +03:00
grep "IDTYPE=lvmlv_uuid" out1
grep "IDNAME=LVM-" out1
2024-05-27 22:29:58 +03:00
grep " $DM_DEV_DIR / $vg1 / $lv2 " " $DF " | tee out2
2024-05-22 23:32:17 +03:00
grep "IDTYPE=lvmlv_uuid" out2
grep "IDNAME=LVM-" out2
lvremove -y $vg1 /$lv1
2024-05-27 22:29:58 +03:00
not grep " $DM_DEV_DIR / $vg1 / $lv1 " " $DF "
2024-05-22 23:32:17 +03:00
lvremove -y $vg1 /$lv2
2024-05-27 22:29:58 +03:00
not grep " $DM_DEV_DIR / $vg1 / $lv2 " " $DF "
2024-05-22 23:32:17 +03:00
grep " $dev1 " " $DF "
not grep "IDTYPE=lvmlv_uuid" " $DF "
not grep "IDNAME=LVM-" " $DF "
vgremove -y $vg1