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é 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 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 = NULL; QmpReturn *qret = g_new0(QmpReturn, 1); - QObject *ret; + QObject *ret, *id; + QDict *req; assert(client); @@ -207,6 +208,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.10.0