thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone

Blame SOURCES/kvm-hmp-Fix-loadvm-to-resume-the-VM-on-success-instead-o.patch

a83cc2
From 3347d61ff783d05f41f03097551460dc5825b301 Mon Sep 17 00:00:00 2001
a83cc2
From: Kevin Wolf <kwolf@redhat.com>
a83cc2
Date: Thu, 29 Jul 2021 07:42:14 -0400
a83cc2
Subject: [PATCH 11/39] hmp: Fix loadvm to resume the VM on success instead of
a83cc2
 failure
a83cc2
a83cc2
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
a83cc2
RH-MergeRequest: 32: Synchronize with RHEL-AV 8.5 release 27 to RHEL 9
a83cc2
RH-Commit: [3/15] 492cfb8ef252805b988a256abe73628605f630e9 (mrezanin/centos-src-qemu-kvm)
a83cc2
RH-Bugzilla: 1957194
a83cc2
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
a83cc2
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
a83cc2
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
a83cc2
RH-Acked-by: Andrew Jones <drjones@redhat.com>
a83cc2
a83cc2
Commit f61fe11aa6f broke hmp_loadvm() by adding an incorrect negation
a83cc2
when converting from 0/-errno return values to a bool value. The result
a83cc2
is that loadvm resumes the VM now if it failed and keeps it stopped if
a83cc2
it failed. Fix it to restore the old behaviour and do it the other way
a83cc2
around.
a83cc2
a83cc2
Fixes: f61fe11aa6f7f8f0ffe4ddaa56a8108f3ab57854
a83cc2
Cc: qemu-stable@nongnu.org
a83cc2
Reported-by: Yanhui Ma <yama@redhat.com>
a83cc2
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
a83cc2
Message-Id: <20210511163151.45167-1-kwolf@redhat.com>
a83cc2
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
a83cc2
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
a83cc2
(cherry picked from commit c53cd04e70641fdf9410aac40c617d074047b3e1)
a83cc2
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
a83cc2
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
a83cc2
---
a83cc2
 monitor/hmp-cmds.c | 2 +-
a83cc2
 1 file changed, 1 insertion(+), 1 deletion(-)
a83cc2
a83cc2
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
a83cc2
index 0ad5b77477..cc15d9b6ee 100644
a83cc2
--- a/monitor/hmp-cmds.c
a83cc2
+++ b/monitor/hmp-cmds.c
a83cc2
@@ -1133,7 +1133,7 @@ void hmp_loadvm(Monitor *mon, const QDict *qdict)
a83cc2
 
a83cc2
     vm_stop(RUN_STATE_RESTORE_VM);
a83cc2
 
a83cc2
-    if (!load_snapshot(name, NULL, false, NULL, &err) && saved_vm_running) {
a83cc2
+    if (load_snapshot(name, NULL, false, NULL, &err) && saved_vm_running) {
a83cc2
         vm_start();
a83cc2
     }
a83cc2
     hmp_handle_error(mon, err);
a83cc2
-- 
a83cc2
2.27.0
a83cc2