Received: from eggs.gnu.org ([2001:4830:134:3::10]:56404) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btWoA-0002K9-Bj for qemu-devel@nongnu.org; Mon, 10 Oct 2016 05:23:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1btWo5-0003Ey-SD for qemu-devel@nongnu.org; Mon, 10 Oct 2016 05:23:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60050) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btWo5-0003Ee-MY for qemu-devel@nongnu.org; Mon, 10 Oct 2016 05:23:37 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 43D54C0567A1 for ; Mon, 10 Oct 2016 09:23:37 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 10 Oct 2016 13:22:46 +0400 Message-Id: <20161010092301.14974-10-marcandre.lureau@redhat.com> In-Reply-To: <20161010092301.14974-1-marcandre.lureau@redhat.com> References: <20161010092301.14974-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH 09/24] qmp: take 'id' from request List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: eblake@redhat.com, berrange@redhat.com, armbru@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Copy 'id' from request to reply dict. This can be done earlier, such as done by the monitor (because the qemu monitor may reply directly without qmp_dispatch), but is now done as well in qmp_dispatch() as convenience for other users such as QGA and tests. Signed-off-by: Marc-Andr=C3=A9 Lureau --- qapi/qmp-dispatch.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index 1fedc97..c42fb87 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -199,7 +199,8 @@ void qmp_dispatch(QmpClient *client, QObject *request= , QDict *rsp) { Error *err =3D NULL; QmpReturn *qret =3D g_new0(QmpReturn, 1); - QObject *ret; + QObject *ret, *id; + QDict *req; =20 assert(client); =20 @@ -207,6 +208,13 @@ void qmp_dispatch(QmpClient *client, QObject *reques= t, QDict *rsp) qret->client =3D client; QLIST_INSERT_HEAD(&client->pending, qret, link); =20 + req =3D qobject_to_qdict(request); + id =3D qdict_get(req, "id"); + if (id) { + qobject_incref(id); + qdict_put_obj(qret->rsp, "id", id); + } + ret =3D do_qmp_dispatch(request, qret, &err); =20 if (err) { --=20 2.10.0