Skip to content
Snippets Groups Projects
Commit 3f7db418 authored by Vladimir Sementsov-Ogievskiy's avatar Vladimir Sementsov-Ogievskiy Committed by Eric Blake
Browse files

iotests.py: qemu_nbd_popen: remove pid file after use


To not interfere with other qemu_nbd_popen() calls in same test.

Signed-off-by: default avatarVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Message-Id: <20210205163720.887197-8-vsementsov@virtuozzo.com>
Signed-off-by: default avatarEric Blake <eblake@redhat.com>
parent 46bd6f8c
No related branches found
No related tags found
No related merge requests found
......@@ -296,7 +296,9 @@ def qemu_nbd_list_log(*args: str) -> str:
@contextmanager
def qemu_nbd_popen(*args):
'''Context manager running qemu-nbd within the context'''
pid_file = file_path("pid")
pid_file = file_path("qemu_nbd_popen-nbd-pid-file")
assert not os.path.exists(pid_file)
cmd = list(qemu_nbd_args)
cmd.extend(('--persistent', '--pid-file', pid_file))
......@@ -314,6 +316,8 @@ def qemu_nbd_popen(*args):
time.sleep(0.01)
yield
finally:
if os.path.exists(pid_file):
os.remove(pid_file)
log('Kill NBD server')
p.kill()
p.wait()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment