Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.5:Update
xen.22544
libxl.Add-a-version-check-of-QEMU-for-QMP-comma...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libxl.Add-a-version-check-of-QEMU-for-QMP-commands.patch of Package xen.22544
From: Anthony PERARD <anthony.perard@citrix.com> Date: Tue, 13 Mar 2018 11:13:17 +0000 Subject: libxl: Add a version check of QEMU for QMP commands Git-commit: ab73254b9ac3febe0c512e21af567fa536c20ad4 On connection to QEMU via QMP, the version of QEMU is provided, store it for later use. Add a function qmp_qemu_check_version that can be used to check if QEMU is new enough for certain fonctionnality. This will be used in a moment. As it's a static function, it is commented out until first use, which is in the next patch. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Acked-by: Wei Liu <wei.liu2@citrix.com> --- tools/libxl/libxl_qmp.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) --- a/tools/libxl/libxl_qmp.c +++ b/tools/libxl/libxl_qmp.c @@ -75,6 +75,11 @@ struct libxl__qmp_handler { int last_id_used; LIBXL_STAILQ_HEAD(callback_list, callback_id_pair) callback_list; + struct { + int major; + int minor; + int micro; + } version; }; static int qmp_send(libxl__qmp_handler *qmp, @@ -296,9 +301,22 @@ static int qmp_handle_response(libxl__gc LOGD(DEBUG, qmp->domid, "message type: %s", libxl__qmp_message_type_to_string(type)); switch (type) { - case LIBXL__QMP_MESSAGE_TYPE_QMP: + case LIBXL__QMP_MESSAGE_TYPE_QMP: { + const libxl__json_object *o; + 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); + qmp->version.major = libxl__json_object_get_integer( + libxl__json_map_get("major", o, JSON_INTEGER)); + qmp->version.minor = libxl__json_object_get_integer( + libxl__json_map_get("minor", o, JSON_INTEGER)); + qmp->version.micro = libxl__json_object_get_integer( + libxl__json_map_get("micro", o, JSON_INTEGER)); + LOGD(DEBUG, qmp->domid, "QEMU version: %d.%d.%d", + qmp->version.major, qmp->version.minor, qmp->version.micro); /* On the greeting message from the server, enable QMP capabilities */ return enable_qmp_capabilities(qmp); + } case LIBXL__QMP_MESSAGE_TYPE_RETURN: { callback_id_pair *pp = qmp_get_callback_from_id(qmp, resp); @@ -332,6 +350,17 @@ static int qmp_handle_response(libxl__gc return 0; } +#if 0 +static bool qmp_qemu_check_version(libxl__qmp_handler *qmp, int major, + int minor, int micro) +{ + return qmp->version.major > major || + (qmp->version.major == major && + (qmp->version.minor > minor || + (qmp->version.minor == minor && qmp->version.micro >= micro))); +} +#endif + /* * Handler functions */
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor