aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2021-02-05 19:37:17 +0300
committerEric Blake <eblake@redhat.com>2021-02-12 12:10:11 -0600
commit3f7db418d10ee7b48c2ef718f6b66bc3e28282a6 (patch)
tree27a6b3a4bf7b0d69a5498b9c3122be3343f0317a /tests
parent46bd6f8c364170d58f9b17a42fa9289872509f6b (diff)
downloadqemu-3f7db418d10ee7b48c2ef718f6b66bc3e28282a6.zip
qemu-3f7db418d10ee7b48c2ef718f6b66bc3e28282a6.tar.gz
qemu-3f7db418d10ee7b48c2ef718f6b66bc3e28282a6.tar.bz2
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>
Diffstat (limited to 'tests')
-rw-r--r--tests/qemu-iotests/iotests.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 00be68e..4e75830 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -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()