From nobody Mon Feb 9 07:58:45 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@gnu.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@gnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506656916494641.7130737197033; Thu, 28 Sep 2017 20:48:36 -0700 (PDT) Received: from localhost ([::1]:33569 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxmHz-0004oL-Ns for importer@patchew.org; Thu, 28 Sep 2017 23:48:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxmAu-0007B5-Ui for qemu-devel@nongnu.org; Thu, 28 Sep 2017 23:41:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxmAp-0007mj-US for qemu-devel@nongnu.org; Thu, 28 Sep 2017 23:41:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32802) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dxmAp-0007m5-OB for qemu-devel@nongnu.org; Thu, 28 Sep 2017 23:41:11 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 64AD83680A; Fri, 29 Sep 2017 03:41:10 +0000 (UTC) Received: from pxdev.xzpeter.org.com (ovpn-12-70.pek2.redhat.com [10.72.12.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id 671FA18947; Fri, 29 Sep 2017 03:41:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 64AD83680A Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=peterx@redhat.com From: Peter Xu To: qemu-devel@nongnu.org Date: Fri, 29 Sep 2017 11:38:43 +0800 Message-Id: <20170929033844.26935-22-peterx@redhat.com> In-Reply-To: <20170929033844.26935-1-peterx@redhat.com> References: <20170929033844.26935-1-peterx@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 29 Sep 2017 03:41:10 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC v2 21/22] qmp: introduce QMPCapability X-BeenThere: qemu-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Fam Zheng , Juan Quintela , Markus Armbruster , peterx@redhat.com, mdroth@linux.vnet.ibm.com, Stefan Hajnoczi , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Paolo Bonzini , "Dr . David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@gnu.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" There was no QMP capabilities defined. Define the first "oob" as capability to allow out-of-band messages. Signed-off-by: Peter Xu --- monitor.c | 15 +++++++++++++-- qapi-schema.json | 13 +++++++++++++ tests/qmp-test.c | 2 +- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/monitor.c b/monitor.c index 649491a2ce..e33f7fa069 100644 --- a/monitor.c +++ b/monitor.c @@ -4160,12 +4160,23 @@ void monitor_resume(Monitor *mon) =20 static QObject *get_qmp_greeting(void) { + QDict *result =3D qdict_new(), *qmp =3D qdict_new(); + QList *cap_list =3D qlist_new(); QObject *ver =3D NULL; + QMPCapability cap; + + qdict_put(result, "QMP", qmp); =20 qmp_marshal_query_version(NULL, &ver, NULL); + qdict_put_obj(qmp, "version", ver); + + for (cap =3D 0; cap < QMP_CAPABILITY__MAX; cap++) { + qlist_append(cap_list, qstring_from_str( + QMPCapability_str(cap))); + } + qdict_put(qmp, "capabilities", cap_list); =20 - return qobject_from_jsonf("{'QMP': {'version': %p, 'capabilities': []}= }", - ver); + return QOBJECT(result); } =20 static void monitor_qmp_event(void *opaque, int event) diff --git a/qapi-schema.json b/qapi-schema.json index 0b04e06a4c..82122986d9 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -119,6 +119,19 @@ { 'command': 'qmp_capabilities' } =20 ## +# @QMPCapability: +# +# QMP supported capabilities to be broadcasted to the clients. +# +# @oob: QMP ability to support Out-Of-Band requests. +# +# Since: 2.11 +# +## +{ 'enum': 'QMPCapability', + 'data': [ 'oob' ] } + +## # @VersionTriple: # # A three-part version number. diff --git a/tests/qmp-test.c b/tests/qmp-test.c index c5a5c10b41..91049ab215 100644 --- a/tests/qmp-test.c +++ b/tests/qmp-test.c @@ -84,7 +84,7 @@ static void test_qmp_protocol(void) g_assert(q); test_version(qdict_get(q, "version")); capabilities =3D qdict_get_qlist(q, "capabilities"); - g_assert(capabilities && qlist_empty(capabilities)); + g_assert(capabilities); QDECREF(resp); =20 /* Test valid command before handshake */ --=20 2.13.5