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>
(cherry picked from commit 3992d6f)
  • Loading branch information
Jason Dillaman committed Jan 14, 2016
1 parent e1b9208 commit 447ab1d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/test/librbd/test_notify.py
Expand Up @@ -65,6 +65,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 @@ -81,7 +82,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 447ab1d

Please sign in to comment.