mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
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: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20210205163720.887197-8-vsementsov@virtuozzo.com> Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
46bd6f8c36
commit
3f7db418d1
1 changed files with 5 additions and 1 deletions
|
@ -296,7 +296,9 @@ def qemu_nbd_list_log(*args: str) -> str:
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def qemu_nbd_popen(*args):
|
def qemu_nbd_popen(*args):
|
||||||
'''Context manager running qemu-nbd within the context'''
|
'''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 = list(qemu_nbd_args)
|
||||||
cmd.extend(('--persistent', '--pid-file', pid_file))
|
cmd.extend(('--persistent', '--pid-file', pid_file))
|
||||||
|
@ -314,6 +316,8 @@ def qemu_nbd_popen(*args):
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
yield
|
yield
|
||||||
finally:
|
finally:
|
||||||
|
if os.path.exists(pid_file):
|
||||||
|
os.remove(pid_file)
|
||||||
log('Kill NBD server')
|
log('Kill NBD server')
|
||||||
p.kill()
|
p.kill()
|
||||||
p.wait()
|
p.wait()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue