Skip to content

Commit

Permalink
tests: notification slave needs to wait for master
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jason Dillaman committed Jan 13, 2016
1 parent 67dfaeb commit 3992d6f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/test/librbd/test_notify.py
Expand Up @@ -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")
Expand All @@ -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
Expand Down

0 comments on commit 3992d6f

Please sign in to comment.