summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorDan Mick <dan.mick@inktank.com>2012-11-26 13:43:13 -0800
committerJosh Durgin <josh.durgin@inktank.com>2013-02-25 18:17:40 -0800
commitccdafa067afed74b209537ae45ff8b49bb5fab3b (patch)
treeb2d6da7da2070959c81e905c5837094ad27e91b0 /qa
parent1f1427415c24ce9943d0f18cd566d305832bf316 (diff)
downloadceph-ccdafa067afed74b209537ae45ff8b49bb5fab3b.tar.gz
test_lock_fence.sh, rbdrw.py: rbd lock/fence test
qa/workunits/rbd/test_lock_fence.sh runs using test/rbdrw.py rbdrw.py creates an image, locks it, and runs an I/O loop; test_lock_fence.sh runs it, waits, and then blacklists that client, which causes rbdrw.py to get ESHUTDOWN on operations thereafter. Currently doesn't work with rbd caching enabled. rbd.py gets new exception type for ESHUTDOWN Fixes: #3190 Signed-off-by: Dan Mick <dan.mick@inktank.com> Signed-off-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'qa')
-rwxr-xr-xqa/workunits/rbd/test_lock_fence.sh49
1 files changed, 49 insertions, 0 deletions
diff --git a/qa/workunits/rbd/test_lock_fence.sh b/qa/workunits/rbd/test_lock_fence.sh
new file mode 100755
index 00000000000..ee015043fbd
--- /dev/null
+++ b/qa/workunits/rbd/test_lock_fence.sh
@@ -0,0 +1,49 @@
+#!/bin/bash -x
+# can't use -e because of background process
+
+IMAGE=rbdrw-image
+LOCKID=rbdrw
+RBDRW=rbdrw.py
+CEPH_REF=${CEPH_REF:-master}
+
+wget -O $RBDRW "https://ceph.com/git/?p=ceph.git;a=blob_plain;hb=$CEPH_REF;f=src/test/librbd/rbdrw.py"
+
+rbd create $IMAGE --size 10 --image-format 2 || exit 1
+
+# rbdrw loops doing I/O to $IMAGE after locking with lockid $LOCKID
+python $RBDRW $IMAGE $LOCKID &
+iochild=$!
+
+# give client time to lock and start reading/writing
+LOCKS='{}'
+while [ "$LOCKS" == "{}" ]
+do
+ LOCKS=$(rbd lock list $IMAGE --format json)
+ sleep 1
+done
+
+clientaddr=$(rbd lock list $IMAGE | tail -1 | awk '{print $NF;}')
+clientid=$(rbd lock list $IMAGE | tail -1 | awk '{print $1;}')
+echo "clientaddr: $clientaddr"
+echo "clientid: $clientid"
+
+ceph osd blacklist add $clientaddr || exit 1
+
+wait $iochild
+rbdrw_exitcode=$?
+if [ $rbdrw_exitcode != 108 ]
+then
+ echo "wrong exitcode from rbdrw: $rbdrw_exitcode"
+ exit 1
+else
+ echo "rbdrw stopped with ESHUTDOWN"
+fi
+
+set -e
+ceph osd blacklist rm $clientaddr
+rbd lock remove $IMAGE $LOCKID "$clientid"
+# rbdrw will have exited with an existing watch, so, until #3527 is fixed,
+# hang out until the watch expires
+sleep 30
+rbd rm $IMAGE
+echo OK