From: Jason Dillaman Date: Mon, 2 Mar 2015 21:24:17 +0000 (-0500) Subject: qa/workunits/rbd/copy.sh: remove all image locks X-Git-Tag: v0.94~68^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6cff494e18611f8d3ac2b01901d5d02cf7f9b27a;p=ceph.git qa/workunits/rbd/copy.sh: remove all image locks If the exclusive lock feature is enabled, all locks need to be removed prior removing the image. Fixes: #10990 Signed-off-by: Jason Dillaman --- diff --git a/qa/workunits/rbd/copy.sh b/qa/workunits/rbd/copy.sh index 4aec5ab780f5..1fd63dc35e36 100755 --- a/qa/workunits/rbd/copy.sh +++ b/qa/workunits/rbd/copy.sh @@ -233,11 +233,15 @@ test_locking() { rbd lock list test1 | grep ' 2 ' rbd lock add test1 id2 --shared tag rbd lock list test1 | grep ' 3 ' - LOCKER=$(rbd lock list test1 | tail -n 1 | awk '{print $1;}') - ID=$(rbd lock list test1 | tail -n 1 | awk '{print $2;}') - rbd lock remove test1 $ID $LOCKER - # locks don't prevent you from removing an image, - # just from taking a lock + rbd lock list test1 | tail -n 1 | awk '{print $2, $1;}' | xargs rbd lock remove test1 + if rbd info test1 | grep -qE "features:.*exclusive" + then + # new locking functionality requires all locks to be released + while [ -n "$(rbd lock list test1)" ] + do + rbd lock list test1 | tail -n 1 | awk '{print $2, $1;}' | xargs rbd lock remove test1 + done + fi rbd rm test1 }