~ubuntu-branches/debian/sid/lvm2/sid

« back to all changes in this revision

Viewing changes to test/shell/lvextend-snapshot-policy.sh

  • Committer: Package Import Robot
  • Author(s): Bastian Blank
  • Date: 2013-03-03 12:33:47 UTC
  • mfrom: (1.1.15)
  • Revision ID: package-import@ubuntu.com-20130303123347-smfwei6dodkdth55
Tags: 2.02.98-1
New upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/bash
 
1
#!/bin/sh
2
2
# Copyright (C) 2010 Red Hat, Inc. All rights reserved.
3
3
#
4
4
# This copyrighted material is made available to anyone wishing to use,
11
11
 
12
12
. lib/test
13
13
 
 
14
which mkfs.ext2 || skip
 
15
 
14
16
extend() {
15
 
        lvextend --use-policies --config "activation { snapshot_extend_threshold = $1 }" $vg/snap
 
17
        lvextend --use-policies --config "activation { snapshot_autoextend_threshold = $1 }" $vg/snap
16
18
}
17
19
 
18
20
write() {
19
 
        mount $DM_DEV_DIR/$vg/snap mnt
20
 
        dd if=/dev/zero of=mnt/file$1 bs=1k count=$2
 
21
        mount "$DM_DEV_DIR/$vg/snap" mnt
 
22
        dd if=/dev/zero of="mnt/file$1" bs=1k count=$2
21
23
        umount mnt
22
24
}
23
25
 
24
26
percent() {
25
 
        lvs $vg/snap -o snap_percent --noheadings | cut -c4- | cut -d. -f1
 
27
        get lv_field $vg/snap snap_percent | cut -d. -f1
26
28
}
27
29
 
28
 
which mkfs.ext2 || exit 200
29
 
 
 
30
aux prepare_dmeventd
30
31
aux prepare_vg 2
 
32
 
31
33
lvcreate -l 8 -n base $vg
32
 
mkfs.ext2 $DM_DEV_DIR/$vg/base
 
34
mkfs.ext2 "$DM_DEV_DIR/$vg/base"
33
35
 
34
36
lvcreate -s -l 4 -n snap $vg/base
35
37
mkdir mnt
36
38
 
37
39
write 1 4096
38
 
pre=`percent`
 
40
pre=$(percent)
39
41
extend 50
40
 
post=`percent`
 
42
test $pre -eq $(percent)
41
43
 
42
 
test $pre = $post
43
44
write 2 4096
44
 
pre=`percent`
 
45
pre=$(percent)
45
46
extend 50
46
 
post=`percent`
47
 
test $pre -gt $post
 
47
test $pre -gt $(percent)
 
48
 
 
49
vgremove -f $vg