]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: notification slave needs to wait for master 7220/head
authorJason Dillaman <dillaman@redhat.com>
Wed, 13 Jan 2016 17:44:01 +0000 (12:44 -0500)
committerJason Dillaman <dillaman@redhat.com>
Wed, 13 Jan 2016 17:45:53 +0000 (12:45 -0500)
If the slave instance starts before the master, race
conditions are possible.

Fixes: #13810
Backport: infernalis, hammer
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/test/librbd/test_notify.py

index 4d3a7713fa5889f2b6816b751d22d96f3c8a5c92..d6f9c537e29208658a7a928527069c2cb2aab768 100755 (executable)
@@ -66,6 +66,7 @@ def master(ioctx):
         while offset < IMG_SIZE:
             image.write(data, offset)
             offset += (1 << IMG_ORDER)
+        image.write('1', IMG_SIZE - 1)
         assert(image.is_exclusive_lock_owner())
 
         print("waiting for slave to complete")
@@ -82,7 +83,8 @@ def slave(ioctx):
     while True:
         try:
             with Image(ioctx, CLONE_IMG_NAME) as image:
-                if image.list_lockers() != []:
+                if (image.list_lockers() != [] and
+                    image.read(IMG_SIZE - 1, 1) == '1'):
                     break
         except Exception:
             pass