~ubuntu-branches/ubuntu/saucy/lvm2/saucy

« back to all changes in this revision

Viewing changes to test/t-pvcreate-operation.sh

  • Committer: Package Import Robot
  • Author(s): Dmitrijs Ledkovs
  • Date: 2012-08-14 14:35:57 UTC
  • mfrom: (3.1.25 sid)
  • Revision ID: package-import@ubuntu.com-20120814143557-93aill2tp3kf3o30
Tags: 2.02.95-4ubuntu1
* Merge from Debian unstable, remaining changes:
  - debian/patches/avoid-dev-block.patch: Prefer any other device name over
    names in /dev/block/ since lvm.conf won't handle this.
  - debian/rules:
    - copy .po file to .pot file for Rosetta (Ubuntu specific).
  - debian/{dmsetup,lvm2}-udeb.install:
    - install initramfs and udev hooks in udebs (Debian bug 504341).
  - auto-start VGs as their PVs are discovered (Ubuntu specific):
    - add debian/tree/lvm2/lib/udev/rules.d/85-lvm2.rules: use watershed plus
      the sledgehammer of vgscan/vgchange to turn on VGs as they come online.
    - debian/tree/lvm2/usr/share/initramfs-tools/scripts/hooks/lvm2:
      - add 85-lvm2.rules to the list of udev rules to copy.
      - depend on udev.
    - debian/control:
      - add versioned Depend on watershed in lvm2 for udev rules.
      - add Depends on watershed-udeb in lvm2-udeb for udev rules.
      - add versioned Depend/Breaks on udev in dmsetup for udev rules.
      - add Depend on initramfs-tools in dmsetup so system is not potentially
        rendered unbootable by out-of-order dpkg configuration.
    - debian/rules:
      - do not install local-top scripts since Ubuntu mounts root using udev.
      - do not install init scripts for lvm2, since udev starts LVM.
    - debian/lvm2.postinst: handle missing lvm2 init script.
    - debian/tree/dmsetup/lib/udev/rules.d/60-persistent-storage-dm.rules:
      watch dm devices for changes with inotify
  - add mountroot failure hooks to help fix bad boots (Debian bug 468115):
    - debian/tree/lvm2/usr/share/initramfs-tools/scripts/init-premount/lvm2
  - remaining changes to upstream event manager packages (Debian bug 514706):
    - debian/rules:
      - enable dmeventd during configure.
    - debian/dmeventd.{8,manpages}: install dmeventd files.
  - rename debian/clvm.defaults to debian/clvm.default so it is installed
    correctly.
  - debian/control: add dmsetup-udeb to libdevmapper1.02.1-udeb recommends.
  - debian/rules: make sure dmsetup and lvm2 initramfs-tools scripts are
    executable.  When the Ubuntu-specific ones are added with a patch,
    they may lose their executable bit.
  - Add and install clvmd resource agent
  - Add dependency on libudev-dev to libdevmapper-dev so that the .pc file
    works.
  - debian/{clvmd.ra,clvm.init}:
    - create /run/lvm if it doesn't exist.
  - debian/clvm.init:
    - exit 3 if not running on status action.
  - Call dh_installman so that our dmeventd manpage actually gets installed
  - Install the missing fsadm manpage.

 * libdevmapper-dev:
  - move .so symlinks and pkgconfig files to multiarched locations.
  - mark libdevmapper-dev M-A: same

 * libdevmapper-event1.02.1:
  - Add Breaks: dmeventd (<< 2.02.95-4ubuntu1) due to debian symbol rename

 * debian/lvm2.{preinst,postinst,postrm}:
  - Implement removal of obsolete /etc/init.d/lvm2 conffile, which
    should not have been re-introduced in Quantal.

 * Dropped Changes, included in Debian:
  - Mostly included packages for upstream event manager (Debian bug 514706).
  - debian/patches/rules-subdir.patch: removed as reordering will cause
    build failure with dmeventd.
  - debian/patches/libdm-event-static.patch: removed as other static libs
    aren't being built anymore either.
  - Update symbols for libdevmapper-event.
  - Update libdevmapper-event, dmeventd descriptions to match Debian
    boilerplate.

 * Disappeared Changes:
  - Don't install documentation in udebs. No diff found, but no docs are
    installed into udebs either.

 * Resurected Changes:
  - corrected dropping the wrong init script. Now clvm.init is shipped
    and lvm2.init is dropped in favor of udev rules as per original
    intention (LP: #1037033).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2008 Red Hat, Inc. All rights reserved.
2
 
#
3
 
# This copyrighted material is made available to anyone wishing to use,
4
 
# modify, copy, or redistribute it subject to the terms and conditions
5
 
# of the GNU General Public License v.2.
6
 
#
7
 
# You should have received a copy of the GNU General Public License
8
 
# along with this program; if not, write to the Free Software Foundation,
9
 
# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
10
 
 
11
 
. lib/test
12
 
 
13
 
aux prepare_devs 4
14
 
 
15
 
for mdatype in 1 2
16
 
do
17
 
# pvcreate (lvm$mdatype) refuses to overwrite an mounted filesystem (bz168330)
18
 
        test ! -d $TESTDIR/mnt && mkdir $TESTDIR/mnt
19
 
        if mke2fs $dev1; then
20
 
                mount $dev1 $TESTDIR/mnt
21
 
                not pvcreate -M$mdatype $dev1 2>err
22
 
                grep "Can't open $dev1 exclusively.  Mounted filesystem?" err
23
 
                umount $dev1
24
 
        fi
25
 
 
26
 
# pvcreate (lvm$mdatype) succeeds when run repeatedly (pv not in a vg) (bz178216)
27
 
    pvcreate -M$mdatype $dev1
28
 
    pvcreate -M$mdatype $dev1
29
 
    pvremove -f $dev1
30
 
 
31
 
# pvcreate (lvm$mdatype) fails when PV belongs to VG" \
32
 
    pvcreate -M$mdatype $dev1
33
 
    vgcreate -M$mdatype $vg1 $dev1
34
 
    not pvcreate -M$mdatype $dev1
35
 
 
36
 
    vgremove -f $vg1
37
 
    pvremove -f $dev1
38
 
 
39
 
# pvcreate (lvm$mdatype) fails when PV1 does and PV2 does not belong to VG
40
 
    pvcreate -M$mdatype $dev1
41
 
    pvcreate -M$mdatype $dev2
42
 
    vgcreate -M$mdatype $vg1 $dev1
43
 
 
44
 
# pvcreate a second time on $dev2 and $dev1
45
 
    not pvcreate -M$mdatype $dev2 $dev1
46
 
 
47
 
    vgremove -f $vg1
48
 
    pvremove -f $dev2
49
 
    pvremove -f $dev1
50
 
 
51
 
# NOTE: Force pvcreate after test completion to ensure clean device
52
 
#test_expect_success \
53
 
#  "pvcreate (lvm$mdatype) fails on md component device" \
54
 
#  'mdadm -C -l raid0 -n 2 /dev/md0 $dev1 $dev2 &&
55
 
#   pvcreate -M$mdatype $dev1;
56
 
#   status=$?; echo status=$status; test $status != 0 &&
57
 
#   mdadm --stop /dev/md0 &&
58
 
#   pvcreate -ff -y -M$mdatype $dev1 $dev2 &&
59
 
#   pvremove -f $dev1 $dev2'
60
 
done
61
 
 
62
 
# pvcreate (lvm2) fails without -ff when PV with metadatacopies=0 belongs to VG
63
 
pvcreate --metadatacopies 0 $dev1
64
 
pvcreate --metadatacopies 1 $dev2
65
 
vgcreate $vg1 $dev1 $dev2
66
 
not pvcreate $dev1
67
 
vgremove -f $vg1
68
 
pvremove -f $dev2
69
 
pvremove -f $dev1
70
 
 
71
 
# pvcreate (lvm2) succeeds with -ff when PV with metadatacopies=0 belongs to VG
72
 
pvcreate --metadatacopies 0 $dev1 
73
 
pvcreate --metadatacopies 1 $dev2
74
 
vgcreate $vg1 $dev1 $dev2 
75
 
pvcreate -ff -y $dev1 
76
 
vgreduce --removemissing $vg1 
77
 
vgremove -ff $vg1 
78
 
pvremove -f $dev2 
79
 
pvremove -f $dev1
80
 
 
81
 
for i in 0 1 2 3
82
 
do
83
 
# pvcreate (lvm2) succeeds writing LVM label at sector $i
84
 
    pvcreate --labelsector $i $dev1
85
 
    dd if=$dev1 bs=512 skip=$i count=1 2>/dev/null | strings | grep LABELONE >/dev/null
86
 
    pvremove -f $dev1
87
 
done
88
 
 
89
 
# pvcreate (lvm2) fails writing LVM label at sector 4
90
 
not pvcreate --labelsector 4 $dev1
91
 
 
92
 
backupfile=$PREFIX.mybackupfile
93
 
uuid1=freddy-fred-fred-fred-fred-fred-freddy
94
 
uuid2=freddy-fred-fred-fred-fred-fred-fredie
95
 
bogusuuid=fred
96
 
 
97
 
# pvcreate rejects uuid option with less than 32 characters
98
 
not pvcreate --norestorefile --uuid $bogusuuid $dev1
99
 
 
100
 
# pvcreate rejects uuid option without restorefile
101
 
not pvcreate --uuid $uuid1 $dev1
102
 
 
103
 
# pvcreate rejects uuid already in use
104
 
pvcreate --norestorefile --uuid $uuid1 $dev1
105
 
not pvcreate --norestorefile --uuid $uuid1 $dev2
106
 
 
107
 
# pvcreate rejects non-existent file given with restorefile
108
 
not pvcreate --uuid $uuid1 --restorefile $backupfile $dev1
109
 
 
110
 
# pvcreate rejects restorefile with uuid not found in file
111
 
pvcreate --norestorefile --uuid $uuid1 $dev1
112
 
vgcfgbackup -f $backupfile
113
 
not pvcreate --uuid $uuid2 --restorefile $backupfile $dev2
114
 
 
115
 
# pvcreate wipes swap signature when forced
116
 
dd if=/dev/zero of=$dev1 bs=1024 count=64
117
 
mkswap $dev1
118
 
blkid -c /dev/null $dev1 | grep "swap"
119
 
pvcreate -f $dev1
120
 
# blkid cannot make up its mind whether not finding anything it knows is a failure or not
121
 
(blkid -c /dev/null $dev1 || true) | not grep "swap"