[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 33/37] iotests: Introduce qemu_nbd_list_log()
From: |
Kevin Wolf |
Subject: |
[PULL 33/37] iotests: Introduce qemu_nbd_list_log() |
Date: |
Fri, 2 Oct 2020 16:43:41 +0200 |
Add a function to list the NBD exports offered by an NBD server.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20200924152717.287415-30-kwolf@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
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 f7ad0c1395..9695c917e4 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -65,7 +65,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(' ')
@@ -280,6 +281,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'''
@@ -413,6 +421,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
- [PULL 22/37] block/export: Add 'id' option to block-export-add, (continued)
- [PULL 22/37] block/export: Add 'id' option to block-export-add, Kevin Wolf, 2020/10/02
- [PULL 25/37] block/export: Add BLOCK_EXPORT_DELETED event, Kevin Wolf, 2020/10/02
- [PULL 24/37] block/export: Add block-export-del, Kevin Wolf, 2020/10/02
- [PULL 26/37] block/export: Move blk to BlockExport, Kevin Wolf, 2020/10/02
- [PULL 23/37] block/export: Move strong user reference to block_exports, Kevin Wolf, 2020/10/02
- [PULL 28/37] block/export: Add query-block-exports, Kevin Wolf, 2020/10/02
- [PULL 30/37] nbd: Merge nbd_export_new() and nbd_export_create(), Kevin Wolf, 2020/10/02
- [PULL 27/37] block/export: Create BlockBackend in blk_exp_add(), Kevin Wolf, 2020/10/02
- [PULL 29/37] block/export: Move writable to BlockExportOptions, Kevin Wolf, 2020/10/02
- [PULL 31/37] nbd: Deprecate nbd-server-add/remove, Kevin Wolf, 2020/10/02
- [PULL 33/37] iotests: Introduce qemu_nbd_list_log(),
Kevin Wolf <=
- [PULL 34/37] iotests: Allow supported and unsupported formats at the same time, Kevin Wolf, 2020/10/02
- [PULL 36/37] qemu-storage-daemon: Fix help line for --export, Kevin Wolf, 2020/10/02
- [PULL 32/37] iotests: Factor out qemu_tool_pipe_and_status(), Kevin Wolf, 2020/10/02
- [PULL 37/37] qcow2: Use L1E_SIZE in qcow2_write_l1_entry(), Kevin Wolf, 2020/10/02
- [PULL 35/37] iotests: Test block-export-* QMP interface, Kevin Wolf, 2020/10/02
- Re: [PULL 00/37] Block layer patches, Peter Maydell, 2020/10/02