Copy 'id' from request to reply dict. This can be done earlier, such as done currently by the monitor (because the qemu monitor.c 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. Later patches will remove "id" manipulation from monitor.c.
Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> --- 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 d5c8670a4f..b6b0aed1b8 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -202,7 +202,8 @@ void qmp_dispatch(QmpClient *client, QObject *request, QDict *rsp) { Error *err = NULL; QmpReturn *qret = g_new0(QmpReturn, 1); - QObject *ret; + QObject *ret, *id; + QDict *req; assert(client); @@ -210,6 +211,13 @@ void qmp_dispatch(QmpClient *client, QObject *request, QDict *rsp) qret->client = client; QLIST_INSERT_HEAD(&client->pending, qret, link); + req = qobject_to_qdict(request); + id = qdict_get(req, "id"); + if (id) { + qobject_incref(id); + qdict_put_obj(qret->rsp, "id", id); + } + ret = do_qmp_dispatch(request, qret, &err); if (err) { -- 2.11.0.295.gd7dffce1c