From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
berrange@redhat.com, "Fam Zheng" <famz@redhat.com>,
"Jason Wang" <jasowang@redhat.com>,
"Eric Blake" <eblake@redhat.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Markus Armbruster" <armbru@redhat.com>,
"Jan Kiszka" <jan.kiszka@siemens.com>,
"Samuel Thibault" <samuel.thibault@ens-lyon.org>
Subject: [Qemu-devel] [PATCH v6 4/4] tests: Use query-usernet instead of 'info usernet'
Date: Fri, 4 May 2018 15:42:07 +0800 [thread overview]
Message-ID: <20180504074207.22634-5-famz@redhat.com> (raw)
In-Reply-To: <20180504074207.22634-1-famz@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
tests/vm/basevm.py | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 3a2d508c35..dcfa6597ad 100755
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -101,7 +101,7 @@ class BaseVM(object):
"-o", "StrictHostKeyChecking=no",
"-o", "UserKnownHostsFile=" + os.devnull,
"-o", "ConnectTimeout=1",
- "-p", self.ssh_port, "-i", self._ssh_key_file]
+ "-p", str(self.ssh_port), "-i", self._ssh_key_file]
if interactive:
ssh_cmd += ['-t']
assert not isinstance(cmd, str)
@@ -163,13 +163,13 @@ class BaseVM(object):
raise
atexit.register(self.shutdown)
self._guest = guest
- usernet_info = guest.qmp("human-monitor-command",
- command_line="info usernet")
+ usernet_info = guest.qmp("query-usernet")
self.ssh_port = None
- for l in usernet_info["return"].splitlines():
- fields = l.split()
- if "TCP[HOST_FORWARD]" in fields and "22" in fields:
- self.ssh_port = l.split()[3]
+ for i in usernet_info["return"]:
+ if i.get("id") != "vnet":
+ continue
+ self.ssh_port = i["connections"][0]["src_port"]
+ break
if not self.ssh_port:
raise Exception("Cannot find ssh port from 'info usernet':\n%s" % \
usernet_info)
--
2.14.3
next prev parent reply other threads:[~2018-05-04 7:42 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-04 7:42 [Qemu-devel] [PATCH v6 0/4] slirp: Add query-usernet QMP command Fam Zheng
2018-05-04 7:42 ` [Qemu-devel] [PATCH v6 1/4] qapi: Introduce UsernetTcpState Fam Zheng
2018-05-04 7:42 ` [Qemu-devel] [PATCH v6 2/4] slirp: Use QAPI enum to replace TCPS_* macros Fam Zheng
2018-05-16 6:59 ` Markus Armbruster
2018-05-04 7:42 ` [Qemu-devel] [PATCH v6 3/4] slirp: Add "query-usernet" QMP command Fam Zheng
2018-05-16 8:07 ` Markus Armbruster
2018-05-04 7:42 ` Fam Zheng [this message]
2018-05-04 7:49 ` [Qemu-devel] [PATCH v6 0/4] slirp: Add query-usernet " no-reply
2018-05-08 0:45 ` Fam Zheng
2018-05-16 2:30 ` Fam Zheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180504074207.22634-5-famz@redhat.com \
--to=famz@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=f4bug@amsat.org \
--cc=jan.kiszka@siemens.com \
--cc=jasowang@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=samuel.thibault@ens-lyon.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).