From: Anthony PERARD <anthony.perard@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Anthony PERARD <anthony.perard@citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Wei Liu <wei.liu2@citrix.com>
Subject: [PATCH v7 12/14] libxl_qmp: Store advertised QEMU version in libxl__ev_qmp
Date: Fri, 23 Nov 2018 13:53:53 +0000 [thread overview]
Message-ID: <20181123135355.6001-13-anthony.perard@citrix.com> (raw)
In-Reply-To: <20181123135355.6001-1-anthony.perard@citrix.com>
This will be used in a later patch.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
Notes:
v7:
Add do{}while around the MACRO.
formating nits changes.
v6:
new local macro GRAB_VERSION
better definition of qemu_version field in libxl_internal.h
v5:
initialise qemu_version struct in libxl__ev_qmp_init
tools/libxl/libxl_internal.h | 8 ++++++++
tools/libxl/libxl_qmp.c | 25 +++++++++++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 7c2e0edff8..64732bd16a 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -433,6 +433,14 @@ struct libxl__ev_qmp {
libxl__ev_qmp_callback *callback;
int payload_fd; /* set to send a fd with the command, -1 otherwise */
+ /* read-only when Connected
+ * and not to be accessed by the caller otherwise */
+ struct {
+ int major;
+ int minor;
+ int micro;
+ } qemu_version;
+
/*
* remaining fields are private to libxl_ev_qmp_*
*/
diff --git a/tools/libxl/libxl_qmp.c b/tools/libxl/libxl_qmp.c
index 3c2545922e..6954a909e5 100644
--- a/tools/libxl/libxl_qmp.c
+++ b/tools/libxl/libxl_qmp.c
@@ -1869,6 +1869,27 @@ static int qmp_ev_handle_message(libxl__egc *egc,
return ERROR_PROTOCOL_ERROR_QMP;
}
+ /*
+ * Store advertised QEMU version
+ * { "QMP": { "version": {
+ * "qemu": { "major": int, "minor": int, "micro": int } } } }
+ */
+ 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);
+#define GRAB_VERSION(level) do { \
+ ev->qemu_version.level = libxl__json_object_get_integer( \
+ libxl__json_map_get(#level, o, JSON_INTEGER)); \
+ } while (0)
+ GRAB_VERSION(major);
+ GRAB_VERSION(minor);
+ GRAB_VERSION(micro);
+#undef GRAB_VERSION
+ LOGD(DEBUG, ev->domid, "QEMU version: %d.%d.%d",
+ ev->qemu_version.major,
+ ev->qemu_version.minor,
+ ev->qemu_version.micro);
+
/* Prepare next message to send */
assert(!ev->tx_buf);
ev->id = ev->next_id++;
@@ -1988,6 +2009,10 @@ void libxl__ev_qmp_init(libxl__ev_qmp *ev)
ev->msg = NULL;
ev->msg_id = 0;
+
+ ev->qemu_version.major = -1;
+ ev->qemu_version.minor = -1;
+ ev->qemu_version.micro = -1;
}
int libxl__ev_qmp_send(libxl__gc *gc, libxl__ev_qmp *ev,
--
Anthony PERARD
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-11-23 13:58 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-23 13:53 [PATCH v7 00/14] libxl: Enable save/restore/migration of a restricted QEMU + libxl__ev_qmp_* Anthony PERARD
2018-11-23 13:53 ` [PATCH v7 01/14] libxl: Enhance libxl__sendmsg_fds to deal with EINTR and EWOULDBLOCK Anthony PERARD
2018-12-21 14:30 ` Ian Jackson
2019-01-04 12:07 ` Anthony PERARD
2019-01-04 15:58 ` Ian Jackson
2018-11-23 13:53 ` [PATCH v7 02/14] libxl_qmp: Separate QMP message generation from qmp_send_prepare Anthony PERARD
2018-12-21 14:32 ` Ian Jackson
2018-11-23 13:53 ` [PATCH v7 03/14] libxl_qmp: Change qmp_qemu_check_version to compare version Anthony PERARD
2018-11-23 13:53 ` [PATCH v7 04/14] libxl: Add wrapper around libxl__json_object_to_json JSON Anthony PERARD
2018-12-21 14:33 ` Ian Jackson
2018-11-23 13:53 ` [PATCH v7 05/14] libxl: Design of an async API to issue QMP commands to QEMU Anthony PERARD
2018-11-23 13:53 ` [PATCH v7 06/14] libxl_qmp: Implementation of libxl__ev_qmp_* Anthony PERARD
2018-12-21 15:36 ` Ian Jackson
2018-12-21 15:59 ` Ian Jackson
2019-01-03 12:40 ` Anthony PERARD
2019-01-04 11:14 ` Anthony PERARD
2019-01-04 11:21 ` Ian Jackson
2019-01-04 11:41 ` Anthony PERARD
2018-11-23 13:53 ` [PATCH v7 07/14] libxl_exec: Add libxl__spawn_initiate_failure Anthony PERARD
2018-12-21 15:57 ` Ian Jackson
2018-11-23 13:53 ` [PATCH v7 08/14] libxl: Add init/dispose of for libxl__domain_build_state Anthony PERARD
2018-12-21 16:00 ` Ian Jackson
2018-11-23 13:53 ` [PATCH v7 09/14] libxl_dm: Pre-open QMP socket for QEMU Anthony PERARD
2018-12-21 16:01 ` Ian Jackson
2018-11-23 13:53 ` [PATCH v7 10/14] libxl: Add dmss_init/dispose for libxl__dm_spawn_state Anthony PERARD
2018-11-23 13:53 ` [PATCH v7 11/14] libxl: QEMU startup sync based on QMP Anthony PERARD
2018-12-21 16:03 ` Ian Jackson
2018-11-23 13:53 ` Anthony PERARD [this message]
2018-12-21 16:05 ` [PATCH v7 12/14] libxl_qmp: Store advertised QEMU version in libxl__ev_qmp Ian Jackson
2018-11-23 13:53 ` [PATCH v7 13/14] libxl: Change libxl__domain_suspend_device_model() to be async Anthony PERARD
2018-12-21 16:09 ` Ian Jackson
2018-11-23 13:53 ` [PATCH v7 14/14] libxl: Re-implement domain_suspend_device_model using libxl__ev_qmp Anthony PERARD
2018-12-21 16:12 ` Ian Jackson
2018-11-23 13:57 ` [PATCH v7 00/14] libxl: Enable save/restore/migration of a restricted QEMU + libxl__ev_qmp_* Anthony PERARD
2018-12-21 16:13 ` Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181123135355.6001-13-anthony.perard@citrix.com \
--to=anthony.perard@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.