From: Jason Dillaman Date: Tue, 15 Mar 2016 13:57:37 +0000 (-0400) Subject: qa/workunits/rbd: handle exception thrown from close during lock test X-Git-Tag: v10.1.0~83^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2ae1be4259c503465e08697f1a8d1a9c88018033;p=ceph.git qa/workunits/rbd: handle exception thrown from close during lock test Signed-off-by: Jason Dillaman --- diff --git a/src/test/librbd/rbdrw.py b/src/test/librbd/rbdrw.py old mode 100755 new mode 100644 index 6034ad055cf3..717955110b48 --- a/src/test/librbd/rbdrw.py +++ b/src/test/librbd/rbdrw.py @@ -18,14 +18,13 @@ import rados, rbd, sys with rados.Rados(conffile='') as r: with r.open_ioctx('rbd') as ioctx: - with rbd.Image(ioctx, sys.argv[1]) as image: - image.lock_exclusive(sys.argv[2]) - while True: - try: + try: + with rbd.Image(ioctx, sys.argv[1]) as image: + image.lock_exclusive(sys.argv[2]) + while True: image.write('A' * 4096, 0) r = image.read(0, 4096) - except rbd.ConnectionShutdown: - # it so happens that the errno here is 108, but - # anything recognizable would do - exit(108) - + except rbd.ConnectionShutdown: + # it so happens that the errno here is 108, but + # anything recognizable would do + exit(108)