import source from lvm2 2.02.79
[external/device-mapper.git] / test / t-vgextend-restoremissing.sh
1 #!/bin/bash
2 # Copyright (C) 2010 Red Hat, Inc. All rights reserved.
3 #
4 # This copyrighted material is made available to anyone wishing to use,
5 # modify, copy, or redistribute it subject to the terms and conditions
6 # of the GNU General Public License v.2.
7 #
8 # You should have received a copy of the GNU General Public License
9 # along with this program; if not, write to the Free Software Foundation,
10 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
11
12 . ./test-utils.sh
13
14
15 aux prepare_vg 3
16 lvcreate -m 1 -l 1 -n mirror $vg
17 lvchange -a n $vg/mirror
18 lvcreate -l 1 -n lv1 $vg $dev1
19
20 # try to just change metadata; we expect the new version (with MISSING_PV set
21 # on the reappeared volume) to be written out to the previously missing PV
22 disable_dev $dev1
23 lvremove $vg/mirror
24 enable_dev $dev1
25 not vgck $vg 2>&1 | tee log
26 grep "missing 1 physical volume" log
27 not lvcreate -m 1 -l 1 -n mirror $vg # write operations fail
28 vgextend --restore $vg $dev1 # restore the missing device
29 vgck $vg
30 lvcreate -m 1 -l 1 -n mirror $vg