aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/qemu_test/utils.py
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2024-12-13 17:02:59 +0100
committerThomas Huth <thuth@redhat.com>2024-12-17 20:33:29 +0100
commit9fa4fc23e34114971f7ee81acb9b5f4ab0017c7a (patch)
tree35b649c7f98d529ba5cacdfce89b8f834ec9071b /tests/functional/qemu_test/utils.py
parenta44b318fc45d59c0904c887957fb24421bf4ddd4 (diff)
downloadqemu-9fa4fc23e34114971f7ee81acb9b5f4ab0017c7a.zip
qemu-9fa4fc23e34114971f7ee81acb9b5f4ab0017c7a.tar.gz
qemu-9fa4fc23e34114971f7ee81acb9b5f4ab0017c7a.tar.bz2
tests/functional: Add a helper function for retrieving the hostfwd port
It's just a wrapper around get_info_usernet_hostfwd_port from the qemu module that is also calling the right monitor command for retrieving the information from QEMU. Message-ID: <20241217121550.141072-2-thuth@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/functional/qemu_test/utils.py')
-rw-r--r--tests/functional/qemu_test/utils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/functional/qemu_test/utils.py b/tests/functional/qemu_test/utils.py
index 43853b4..e7c8de8 100644
--- a/tests/functional/qemu_test/utils.py
+++ b/tests/functional/qemu_test/utils.py
@@ -10,6 +10,13 @@
import os
+from qemu.utils import get_info_usernet_hostfwd_port
+
+
+def get_usernet_hostfwd_port(vm):
+ res = vm.cmd('human-monitor-command', command_line='info usernet')
+ return get_info_usernet_hostfwd_port(res)
+
"""
Round up to next power of 2
"""