From: Michal Privoznik Date: Thu, 21 Oct 2021 08:50:09 +0000 (+0200) Subject: qemuMonitorJSONGetMemoryDeviceInfo: Don't return early on CommandNotFound X-Git-Tag: v7.9.0-rc1~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c1d40915a13dca2253a925f18b70790d6f9bb99;p=thirdparty%2Flibvirt.git qemuMonitorJSONGetMemoryDeviceInfo: Don't return early on CommandNotFound The qemuMonitorJSONGetMemoryDeviceInfo() command executes 'query-memory-devices' command and returns early if QEMU doesn't know the command. Well, the command was introduced in QEMU release 2.1 (specifically in commit v2.1.0-rc0~41^2~9) and since the minimum required version is 2.11.0 we can be sure that command will always exist. Signed-off-by: Michal Privoznik Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 1bd3730281..e719c7b8c7 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8154,10 +8154,6 @@ qemuDomainUpdateMemoryDeviceInfo(virQEMUDriver *driver, return -1; } - /* if qemu doesn't support the info request, just carry on */ - if (rc == -2) - return 0; - if (rc < 0) return -1; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 65b5fc04a6..6b6d6cd613 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4079,9 +4079,8 @@ qemuMonitorSetIOThread(qemuMonitor *mon, * Retrieve state and addresses of frontend memory devices present in * the guest. * - * Returns 0 on success and fills @info with a newly allocated struct; if the - * data can't be retrieved due to lack of support in qemu, returns -2. On - * other errors returns -1. + * Returns: 0 on success and fills @info with a newly allocated struct, + * -1 otherwise. */ int qemuMonitorGetMemoryDeviceInfo(qemuMonitor *mon, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 70e3c70441..586b30763b 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -7788,11 +7788,6 @@ qemuMonitorJSONGetMemoryDeviceInfo(qemuMonitor *mon, if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) goto cleanup; - if (qemuMonitorJSONHasError(reply, "CommandNotFound")) { - ret = -2; - goto cleanup; - } - if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_ARRAY) < 0) goto cleanup;