From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Alex Bennée" <alex.bennee@linaro.org>,
"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 v5 2/2] tests: Use query-usernet instead of 'info usernet'
Date: Thu, 3 May 2018 09:25:46 +0800 [thread overview]
Message-ID: <20180503012546.2170-3-famz@redhat.com> (raw)
In-Reply-To: <20180503012546.2170-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
prev parent reply other threads:[~2018-05-03 1:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-03 1:25 [Qemu-devel] [PATCH v5 0/2] slirp: Add query-usernet QMP command Fam Zheng
2018-05-03 1:25 ` [Qemu-devel] [PATCH v5 1/2] slirp: Add "query-usernet" " Fam Zheng
2018-05-03 9:12 ` Daniel P. Berrangé
2018-05-03 9:27 ` Fam Zheng
2018-05-03 14:53 ` Eric Blake
2018-05-03 17:29 ` Markus Armbruster
2018-05-03 1:25 ` Fam Zheng [this message]
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=20180503012546.2170-3-famz@redhat.com \
--to=famz@redhat.com \
--cc=alex.bennee@linaro.org \
--cc=armbru@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).