2017-07-02 22:38:32 +03:00
#!/usr/bin/env bash
2013-08-23 00:32:04 +04:00
# Copyright (C) 2008-2013 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.
test_description = 'Test the vg name for an lv from env var'
2018-05-24 17:49:48 +03:00
2015-10-27 17:10:06 +03:00
SKIP_WITH_LVMPOLLD = 1
2013-08-23 00:32:04 +04:00
2014-06-06 19:40:04 +04:00
. lib/inittest
2013-08-23 00:32:04 +04:00
aux prepare_devs 2
2014-03-20 02:32:25 +04:00
pvcreate " $dev1 "
pvcreate " $dev2 "
2013-08-23 00:32:04 +04:00
2018-05-24 17:49:48 +03:00
vgcreate $SHARED $vg1 " $dev1 "
vgcreate $SHARED $vg2 " $dev2 "
2013-08-23 00:32:04 +04:00
export LVM_VG_NAME = $vg1
# should use env
lvcreate -n $lv1 -l 2
lvcreate -n $lv3 -l 2
lvcreate -n $lv2 -l 2 $vg2
lvcreate -n $lv4 -l 2 $vg2
lvs >err
grep $lv1 err
grep $lv3 err
grep $lv2 err
grep $lv4 err
not lvs $vg1 >err
not grep $lv1 err
not grep $lv3 err
not grep $lv2 err
not grep $lv4 err
not lvs $vg2 >err
not grep $lv1 err
not grep $lv3 err
not grep $lv2 err
not grep $lv4 err
lvs $lv1 >err
grep $lv1 err
not grep $lv3 err
not grep $lv2 err
not grep $lv4 err
lvs $lv1 $lv3 >err
grep $lv1 err
grep $lv3 err
not grep $lv2 err
not grep $lv4 err
# should use env and fail to fine lv4 in vg1
not lvs $lv4 >err
not grep $lv1 err
not grep $lv3 err
not grep $lv2 err
not grep $lv4 err
lvs $vg2 /$lv4 >err
not grep $lv1 err
not grep $lv3 err
not grep $lv2 err
grep $lv4 err
lvs $vg2 /$lv2 $vg2 /$lv4 >err
not grep $lv1 err
not grep $lv3 err
grep $lv2 err
grep $lv4 err
# should use env
lvchange -an $lv3
lvremove $lv3
not lvremove $lv4
lvs >err
grep $lv1 err
not grep $lv3 err
grep $lv2 err
grep $lv4 err
# should use env
lvcreate -n $lv3 -l 2
lvchange --addtag foo $lv3
lvchange -an $lv3
# lvremove by tag should apply to all vgs, not env vg
lvchange --addtag foo $vg2 /$lv4
lvchange -an $vg2 /$lv4
lvremove @foo
lvs >err
grep $lv1 err
not grep $lv3 err
grep $lv2 err
not grep $lv4 err
2014-02-27 02:25:30 +04:00
vgremove -ff $vg1 $vg2