From 2ae1be4259c503465e08697f1a8d1a9c88018033 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Tue, 15 Mar 2016 09:57:37 -0400 Subject: [PATCH] qa/workunits/rbd: handle exception thrown from close during lock test Signed-off-by: Jason Dillaman --- src/test/librbd/rbdrw.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) mode change 100755 => 100644 src/test/librbd/rbdrw.py diff --git a/src/test/librbd/rbdrw.py b/src/test/librbd/rbdrw.py old mode 100755 new mode 100644 index 6034ad055cf..717955110b4 --- 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)