]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Assume QEMU_CAPS_QUERY_CURRENT_MACHINE
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 7 Nov 2022 13:55:04 +0000 (14:55 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 8 Nov 2022 11:10:50 +0000 (12:10 +0100)
Introduced in QEMU's commit of v4.0.0-rc0~202^2~3 the
query-current-machine command is always available for all QEMU
versions we support (4.2.0, currently). Therefore, we can assume
the capability is always set and thus doesn't need to be checked
for.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_driver.c

index bcdd55b089ba7c34fb061b860ae8c5d1805c117e..d10283f2ea16cd3c4c624314b8a752259369e829 100644 (file)
@@ -16307,12 +16307,8 @@ static int
 qemuDomainQueryWakeupSuspendSupport(virDomainObj *vm,
                                     bool *wakeupSupported)
 {
-    qemuDomainObjPrivate *priv = vm->privateData;
     int ret = -1;
 
-    if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QUERY_CURRENT_MACHINE))
-        return -1;
-
     if (virDomainObjBeginJob(vm, VIR_JOB_QUERY) < 0)
         return -1;
 
@@ -16389,19 +16385,13 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom,
     if (!qemuDomainAgentAvailable(vm, true))
         goto cleanup;
 
-    /*
-     * The case we want to handle here is when QEMU has the API (i.e.
-     * QEMU_CAPS_QUERY_CURRENT_MACHINE is set). Otherwise, do not interfere
-     * with the suspend process. This means that existing running domains,
-     * that don't know about this cap, will keep their old behavior of
-     * suspending 'in the dark'.
-     */
-    if (qemuDomainQueryWakeupSuspendSupport(vm, &wakeupSupported) == 0) {
-        if (!wakeupSupported) {
-            virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
-                           _("Domain does not have suspend support"));
-            goto cleanup;
-        }
+    if (qemuDomainQueryWakeupSuspendSupport(vm, &wakeupSupported) < 0)
+        goto cleanup;
+
+    if (!wakeupSupported) {
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                       _("Domain does not have suspend support"));
+        goto cleanup;
     }
 
     if (vm->def->pm.s3 || vm->def->pm.s4) {