[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v5 13/15] libxl_qmp: Store advertised QEMU version in libxl__ev_qmp
This will be used in a later patch. Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx> --- Notes: v5: initialise qemu_version struct in libxl__ev_qmp_init tools/libxl/libxl_internal.h | 7 +++++++ tools/libxl/libxl_qmp.c | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index bde34a3ac1..0631ab1a03 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -434,6 +434,13 @@ struct libxl__ev_qmp { libxl__ev_qmp_callback *callback; libxl__carefd *cfd; /* set to send a fd with the command, NULL otherwise */ + /* read-only when Connected */ + struct { + int major; + int minor; + int micro; + } qemu_version; + /* remaining fields are private to libxl_ev_qmp_* */ int id; libxl__carefd *qmp_cfd; diff --git a/tools/libxl/libxl_qmp.c b/tools/libxl/libxl_qmp.c index 90308b1598..77380a869c 100644 --- a/tools/libxl/libxl_qmp.c +++ b/tools/libxl/libxl_qmp.c @@ -1440,12 +1440,28 @@ static int qmp_ev_handle_message(libxl__egc *egc, const libxl__json_object *resp) { EGC_GC; + const libxl__json_object *o; libxl__qmp_message_type type = qmp_response_type(resp); switch (type) { case LIBXL__QMP_MESSAGE_TYPE_QMP: /* greeting message */ assert(ev->qmp_state == qmp_state_connecting); + + /* Store advertised QEMU version */ + o = libxl__json_map_get("QMP", resp, JSON_MAP); + o = libxl__json_map_get("version", o, JSON_MAP); + o = libxl__json_map_get("qemu", o, JSON_MAP); + ev->qemu_version.major = libxl__json_object_get_integer( + libxl__json_map_get("major", o, JSON_INTEGER)); + ev->qemu_version.minor = libxl__json_object_get_integer( + libxl__json_map_get("minor", o, JSON_INTEGER)); + ev->qemu_version.micro = libxl__json_object_get_integer( + libxl__json_map_get("micro", o, JSON_INTEGER)); + LOGD(DEBUG, ev->domid, "QEMU version: %d.%d.%d", + ev->qemu_version.major, ev->qemu_version.minor, + ev->qemu_version.micro); + ev->qmp_state = qmp_state_greeting; /* Allow qmp_ev_callback_writable to be called in order to send * qmp_capabilities */ @@ -1722,6 +1738,10 @@ out: void libxl__ev_qmp_init(libxl__ev_qmp *ev) { + ev->qemu_version.major = -1; + ev->qemu_version.minor = -1; + ev->qemu_version.micro = -1; + ev->id = -1; ev->qmp_cfd = NULL; -- Anthony PERARD _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |