[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 29/31] iotests: Introduce qemu_nbd_list_log()
From: |
Kevin Wolf |
Subject: |
[PATCH v2 29/31] iotests: Introduce qemu_nbd_list_log() |
Date: |
Thu, 24 Sep 2020 17:27:15 +0200 |
Add a function to list the NBD exports offered by an NBD server.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
tests/qemu-iotests/iotests.py | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 81edf8adbf..cb9f90f737 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -67,7 +67,8 @@ if os.environ.get('QEMU_IO_OPTIONS_NO_FMT'):
qemu_io_args_no_fmt += \
os.environ['QEMU_IO_OPTIONS_NO_FMT'].strip().split(' ')
-qemu_nbd_args = [os.environ.get('QEMU_NBD_PROG', 'qemu-nbd')]
+qemu_nbd_prog = os.environ.get('QEMU_NBD_PROG', 'qemu-nbd')
+qemu_nbd_args = [qemu_nbd_prog]
if os.environ.get('QEMU_NBD_OPTIONS'):
qemu_nbd_args += os.environ['QEMU_NBD_OPTIONS'].strip().split(' ')
@@ -282,6 +283,13 @@ def qemu_nbd_early_pipe(*args: str) -> Tuple[int, str]:
connect_stderr=False)
return returncode, output if returncode else ''
+def qemu_nbd_list_log(*args: str) -> str:
+ '''Run qemu-nbd to list remote exports'''
+ full_args = [qemu_nbd_prog, '-L'] + list(args)
+ output, _ = qemu_tool_pipe_and_status('qemu-nbd', full_args)
+ log(output, filters=[filter_testfiles, filter_nbd_exports])
+ return output
+
@contextmanager
def qemu_nbd_popen(*args):
'''Context manager running qemu-nbd within the context'''
@@ -415,6 +423,9 @@ def filter_qmp_imgfmt(qmsg):
return value
return filter_qmp(qmsg, _filter)
+def filter_nbd_exports(output: str) -> str:
+ return re.sub(r'((min|opt|max) block): [0-9]+', r'\1: XXX', output)
+
Msg = TypeVar('Msg', Dict[str, Any], List[Any], str)
--
2.25.4
- [PATCH v2 25/31] block/export: Move writable to BlockExportOptions, (continued)
- [PATCH v2 25/31] block/export: Move writable to BlockExportOptions, Kevin Wolf, 2020/09/24
- [PATCH v2 26/31] nbd: Merge nbd_export_new() and nbd_export_create(), Kevin Wolf, 2020/09/24
- [PATCH v2 30/31] iotests: Allow supported and unsupported formats at the same time, Kevin Wolf, 2020/09/24
- [PATCH v2 28/31] iotests: Factor out qemu_tool_pipe_and_status(), Kevin Wolf, 2020/09/24
- [PATCH v2 23/31] block/export: Create BlockBackend in blk_exp_add(), Kevin Wolf, 2020/09/24
- [PATCH v2 31/31] iotests: Test block-export-* QMP interface, Kevin Wolf, 2020/09/24
- [PATCH v2 29/31] iotests: Introduce qemu_nbd_list_log(),
Kevin Wolf <=
- [PATCH v2 27/31] nbd: Deprecate nbd-server-add/remove, Kevin Wolf, 2020/09/24
- Re: [PATCH v2 00/31] block/export: Add infrastructure and QAPI for block exports, no-reply, 2020/09/24
- Re: [PATCH v2 00/31] block/export: Add infrastructure and QAPI for block exports, Stefan Hajnoczi, 2020/09/25
- Re: [PATCH v2 00/31] block/export: Add infrastructure and QAPI for block exports, Kevin Wolf, 2020/09/28