1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

tests: snasphot merging

This commit is contained in:
Zdenek Kabelac 2017-11-05 22:59:43 +01:00
parent 0c9e3e8df2
commit e822a9f38d
2 changed files with 18 additions and 4 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Copyright (C) 2010-2012 Red Hat, Inc. All rights reserved.
# Copyright (C) 2010-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
@ -106,6 +106,14 @@ setup_merge_ $vg $lv1 1
lvconvert --merge "$vg/$(snap_lv_name_ "$lv1")"
lvremove -f $vg/$lv1
# test merging cannot start on already merging origin
setup_merge_ $vg $lv1 3
lvchange -an $vg
lvs -a $vg
lvconvert --merge "$vg/$(snap_lv_name_ "$lv1")"
not lvconvert --merge "$vg/$(snap_lv_name_ "$lv1")_1" 2>&1 | tee err
grep "Cannot merge snapshot" err
lvremove -f $vg/$lv1
# test merging multiple snapshots that share the same tag
setup_merge_ $vg $lv1

View File

@ -45,9 +45,15 @@ touch mntsnap/test_snap
lvs -o+tags,thin_id $vg
lvcreate -s -n snap1 $vg/$lv1
lvconvert --merge $vg/snap &>out
grep "Merging of thin snapshot $vg/snap will occur on next activation of $vg/${lv1}." out
# Can't merge another snapshot while "snap" is still being 'merged'.
not lvconvert --merge $vg/snap1 &>out
grep "Cannot merge snapshot" out
umount mnt
# Merge cannot happen
@ -111,13 +117,13 @@ check lv_not_exists $vg oldsnapof_${lv1}
lvcreate -s -L10 -n oldsnapof_snap $vg/snap
lvconvert --merge $vg/snap
lvremove -f $vg/oldsnapof_snap
check lv_field $vg/$lv1 thin_id "3"
check lv_field $vg/$lv1 thin_id "4"
# Check --mergethin
lvcreate -s -n snap $vg/$lv1
check lv_field $vg/snap thin_id "4"
check lv_field $vg/snap thin_id "5"
lvconvert --mergethin $vg/snap &>out
grep "Volume $vg/snap replaced origin $vg/${lv1}." out
check lv_field $vg/$lv1 thin_id "4"
check lv_field $vg/$lv1 thin_id "5"
vgremove -ff $vg