~ubuntu-branches/ubuntu/vivid/lvm2/vivid

« back to all changes in this revision

Viewing changes to test/shell/lock-blocking.sh

  • Committer: Package Import Robot
  • Author(s): Bastian Blank
  • Date: 2012-05-01 20:27:50 UTC
  • mto: (3.1.23 sid)
  • mto: This revision was merged to the branch mainline in revision 72.
  • Revision ID: package-import@ubuntu.com-20120501202750-gljjjtblowwq9mw8
Tags: upstream-2.02.95
ImportĀ upstreamĀ versionĀ 2.02.95

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# Copyright (C) 2008 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_description='test some blocking / non-blocking multi-vg operations'
 
13
 
 
14
. lib/test
 
15
 
 
16
aux prepare_devs 3
 
17
test -e LOCAL_CLVMD && exit 200
 
18
pvcreate $dev1 $dev2
 
19
vgcreate $vg $dev1 $dev2
 
20
 
 
21
# if wait_for_locks set, vgremove should wait for orphan lock
 
22
# flock process should have exited by the time first vgremove completes
 
23
flock -w 5 $TESTDIR/var/lock/lvm/P_orphans -c "sleep 10" &
 
24
while ! test -f $TESTDIR/var/lock/lvm/P_orphans ; do sleep .1 ; done
 
25
 
 
26
vgremove --config 'global { wait_for_locks = 1 }' $vg
 
27
not vgremove --config 'global { wait_for_locks = 1 }' $vg
 
28
 
 
29
test ! -f $TESTDIR/var/lock/lvm/P_orphans
 
30
 
 
31
# if wait_for_locks not set, vgremove should fail on non-blocking lock
 
32
# we must wait for flock process at the end - vgremove won't wait
 
33
vgcreate $vg $dev1 $dev2
 
34
flock -w 5 $TESTDIR/var/lock/lvm/P_orphans -c "sleep 10" &
 
35
 
 
36
while ! test -f $TESTDIR/var/lock/lvm/P_orphans ; do sleep .1 ; done
 
37
flock_pid=`jobs -p`
 
38
 
 
39
not vgremove --config 'global { wait_for_locks = 0 }' $vg
 
40
test -f $TESTDIR/var/lock/lvm/P_orphans # still running
 
41
kill $flock_pid