]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuMonitorJSONGetMemoryDeviceInfo: Don't return early on CommandNotFound
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 21 Oct 2021 08:50:09 +0000 (10:50 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 22 Oct 2021 05:00:44 +0000 (07:00 +0200)
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 <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_domain.c
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor_json.c

index 1bd37302814ca23a48e654529bb7f4adccf03586..e719c7b8c7705589c2f0a091517da3acf4ab75ae 100644 (file)
@@ -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;
 
index 65b5fc04a6e57ffe1c635a9b5420ae73afa19aae..6b6d6cd613dcd55a1854de737cc529d5a4cfb51b 100644 (file)
@@ -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,
index 70e3c70441f1aa11de64ab7e9cb6907bb8c2197d..586b30763bd4e5498e6e0118e796413971813904 100644 (file)
@@ -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;