From nobody Mon Feb 9 18:19:00 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1519632031591204.40452918386302; Mon, 26 Feb 2018 00:00:31 -0800 (PST) Received: from localhost ([::1]:57601 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqDhy-0001dG-HR for importer@patchew.org; Mon, 26 Feb 2018 03:00:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqDge-0000zF-FX for qemu-devel@nongnu.org; Mon, 26 Feb 2018 02:59:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqDgd-0002WR-Nr for qemu-devel@nongnu.org; Mon, 26 Feb 2018 02:59:04 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:52482 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eqDgd-0002WL-JC for qemu-devel@nongnu.org; Mon, 26 Feb 2018 02:59:03 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 113BF40FB648; Mon, 26 Feb 2018 07:59:03 +0000 (UTC) Received: from lemon.usersys.redhat.com (ovpn-12-79.pek2.redhat.com [10.72.12.79]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15DD52024CA2; Mon, 26 Feb 2018 07:58:59 +0000 (UTC) From: Fam Zheng To: qemu-devel@nongnu.org Date: Mon, 26 Feb 2018 15:58:46 +0800 Message-Id: <20180226075846.20307-3-famz@redhat.com> In-Reply-To: <20180226075846.20307-1-famz@redhat.com> References: <20180226075846.20307-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 26 Feb 2018 07:59:03 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 26 Feb 2018 07:59:03 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'famz@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH v2 2/2] tests: Use query-usernet instead of 'info usernet' X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Jason Wang , Markus Armbruster , Samuel Thibault Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Fam Zheng Reviewed-by: Eric Blake --- 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 686d88decf..f51604e0ab 100755 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -101,7 +101,7 @@ class BaseVM(object): "-o", "StrictHostKeyChecking=3Dno", "-o", "UserKnownHostsFile=3D" + os.devnull, "-o", "ConnectTimeout=3D1", - "-p", self.ssh_port, "-i", self._ssh_key_file] + "-p", str(self.ssh_port), "-i", self._ssh_key_file] if interactive: ssh_cmd +=3D ['-t'] assert not isinstance(cmd, str) @@ -166,13 +166,13 @@ class BaseVM(object): raise atexit.register(self.shutdown) self._guest =3D guest - usernet_info =3D guest.qmp("human-monitor-command", - command_line=3D"info usernet") + usernet_info =3D guest.qmp("query-usernet") self.ssh_port =3D None - for l in usernet_info["return"].splitlines(): - fields =3D l.split() - if "TCP[HOST_FORWARD]" in fields and "22" in fields: - self.ssh_port =3D l.split()[3] + for i in usernet_info["return"]: + if i.get("id") !=3D "vnet": + continue + self.ssh_port =3D i["connections"][0]["src_port"] + break if not self.ssh_port: raise Exception("Cannot find ssh port from 'info usernet':\n%s= " % \ usernet_info) --=20 2.14.3