Commit c309d05f authored by Apollon Oikonomopoulos's avatar Apollon Oikonomopoulos Committed by Thomas Thrainer
Browse files

QMP: keep greeting message version info

QMP will always report the QEMU version and package-specific string in
the greeting message, as per the QEMU Machine Protocol Specification. We
store this information and make it available to users of the monitor.
Signed-off-by: default avatarApollon Oikonomopoulos <>
Signed-off-by: default avatarThomas Thrainer <>
Reviewed-by: default avatarThomas Thrainer <>
parent 5d94ddf6
......@@ -195,6 +195,9 @@ class QmpConnection(MonitorSocket):
_ERROR_DESC_KEY = "desc"
_EXECUTE_KEY = "execute"
_ARGUMENTS_KEY = "arguments"
_VERSION_KEY = "version"
_PACKAGE_KEY = "package"
_QEMU_KEY = "qemu"
_CAPABILITIES_COMMAND = "qmp_capabilities"
_QUERY_COMMANDS = "query-commands"
......@@ -223,6 +226,15 @@ class QmpConnection(MonitorSocket):
raise errors.HypervisorError("kvm: QMP communication error (wrong"
" server greeting")
# Extract the version info from the greeting and make it available to users
# of the monitor.
version_info = greeting[self._FIRST_MESSAGE_KEY][self._VERSION_KEY]
self.version = (version_info[self._QEMU_KEY]["major"],
self.package = version_info[self._PACKAGE_KEY].strip()
# This is needed because QMP can return more than one greetings
# see
self._buf = ""
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment