Skip to contentSkip to conversation

master - tests: snapshot conversions

PATCH Zdenek Kabelac 1 participant 1 message Oct 25, 2017

lore
Share & tools
lore
#0 lore raw
Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f32ef63b6c97fbf95568fee88aad8ef92e732c5a
Commit:        f32ef63b6c97fbf95568fee88aad8ef92e732c5a
Parent:        0a0cc696cafd36ee5cd69e15bb4502eb1be22b86
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Wed Oct 25 21:56:39 2017 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Wed Oct 25 22:02:24 2017 +0200

tests: snapshot conversions

Add missing tests for snapshost conversions.

---
 test/shell/lvconvert-snapshot-cache.sh  |   78 +++++++++++++++++++++++++++++++
 test/shell/lvconvert-snapshot-mirror.sh |   60 +++++++++++++++++++++++
 test/shell/lvconvert-snapshot-raid.sh   |   62 ++++++++++++++++++++++++
 test/shell/lvconvert-snapshot-thin.sh   |   73 +++++++++++++++++++++++++++++
 4 files changed, 273 insertions(+), 0 deletions(-)
test/shell/lvconvert-snapshot-cache.sh new file +78 -0
new file mode 100644
index 0000000..396f431
@@ -0,0 +1,78 @@
+#!/usr/bin/env bash
+
+# Copyright (C) 2017 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 various supported conversion of snapshot with cache
+
+SKIP_WITH_LVMLOCKD=1
+SKIP_WITH_LVMPOLLD=1
+
+export LVM_TEST_THIN_REPAIR_CMD=${LVM_TEST_THIN_REPAIR_CMD-/bin/false}
+
+. lib/inittest
+
+aux have_cache 1 3 0 || skip
+
+aux prepare_vg 1
+
+vgchange -s 16k $vg
+
+lvcreate -L1 -n cow $vg
+
+# Thin and snapshot conversion
+lvcreate -L1 -n ch $vg
+lvcreate -H -L1 -n cpool $vg/ch
+
+# Cannot create snapshot of cpool
+not lvcreate -s -L1 $vg/cpool 2>&1 | tee err
+grep "not supported" err
+
+# Cannot create snapshot of cpool's meta
+not lvcreate -s -L1 $vg/cpool_cmeta 2>&1 | tee err
+grep "not supported" err
+
+# Cannot create snapshot of cpool's data
+not lvcreate -s -L1 $vg/cpool_cdata 2>&1 | tee err
+grep "not supported" err
+
+# Cannot use cache-type as COW
+not lvconvert --yes --type snapshot $vg/cow $vg/ch 2>&1 | tee err
+grep "not accept" err
+
+not lvconvert --yes --type snapshot $vg/cow $vg/cpool 2>&1 | tee err
+grep "not accept" err
+
+not lvconvert --yes --type snapshot $vg/cow $vg/cpool_cdata 2>&1 | tee err
+grep "lv_is_visible" err
+
+not lvconvert --yes --type snapshot $vg/cow $vg/cpool_cmeta 2>&1 | tee err
+grep "lv_is_visible" err
+
+# Cannot use thin-pool, _tdata, _tmeta as origin
+not lvconvert --yes --type snapshot $vg/cpool $vg/cow 2>&1 | tee err
+grep "invalid" err
+
+not lvconvert --yes --type snapshot $vg/cpool_cdata $vg/cow 2>&1 | tee err
+grep "invalid" err
+
+not lvconvert --yes --type snapshot $vg/cpool_cmeta $vg/cow 2>&1 | tee err
+grep "invalid" err
+
+lvconvert --yes -s $vg/ch $vg/cow
+
+check lv_field $vg/ch segtype cache
+check lv_field $vg/cow segtype linear
+check lv_attr_bit type $vg/cow "s"
+check lv_attr_bit type $vg/ch "o"
+
+lvs -a -o+lv_role,lv_layout $vg
+
+vgremove -f $vg
test/shell/lvconvert-snapshot-mirror.sh new file +60 -0

60 lines not on this page · raw message

test/shell/lvconvert-snapshot-raid.sh new file +62 -0

62 lines not on this page · raw message

test/shell/lvconvert-snapshot-thin.sh new file +73 -0

73 lines not on this page · raw message