2 # can't use -e because of background process
6 RELPATH=$(dirname $0)/../../../src/test/librbd
7 RBDRW=$RELPATH/rbdrw.py
9 rbd create $IMAGE --size 10 --image-format 2 --image-shared || exit 1
11 # rbdrw loops doing I/O to $IMAGE after locking with lockid $LOCKID
12 python $RBDRW $IMAGE $LOCKID &
15 # give client time to lock and start reading/writing
17 while [ "$LOCKS" == "{}" ]
19 LOCKS=$(rbd lock list $IMAGE --format json)
23 clientaddr=$(rbd lock list $IMAGE | tail -1 | awk '{print $NF;}')
24 clientid=$(rbd lock list $IMAGE | tail -1 | awk '{print $1;}')
25 echo "clientaddr: $clientaddr"
26 echo "clientid: $clientid"
28 ceph osd blacklist add $clientaddr || exit 1
32 if [ $rbdrw_exitcode != 108 ]
34 echo "wrong exitcode from rbdrw: $rbdrw_exitcode"
37 echo "rbdrw stopped with ESHUTDOWN"
41 ceph osd blacklist rm $clientaddr
42 rbd lock remove $IMAGE $LOCKID "$clientid"
43 # rbdrw will have exited with an existing watch, so, until #3527 is fixed,
44 # hang out until the watch expires