[libvirt PATCH 31/80] qemu: Preserve error in qemuMigrationDstFinish

Jiri Denemark jdenemar at redhat.com
Tue May 10 15:20:52 UTC 2022


We want to prevent our error path that can potentially kill the domain
on the destination host from overwriting an error reported earlier, but
we were only doing so in one specific path when starting vCPUs fails.
Let's do it in all paths.

Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---
 src/qemu/qemu_migration.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index a6c8e53ac5..bbea2f6e0e 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -5997,11 +5997,6 @@ qemuMigrationDstFinish(virQEMUDriver *driver,
             if (virGetLastErrorCode() == VIR_ERR_OK)
                 virReportError(VIR_ERR_INTERNAL_ERROR,
                                "%s", _("resume operation failed"));
-            /* Need to save the current error, in case shutting
-             * down the process overwrites it
-             */
-            virErrorPreserveLast(&orig_err);
-
             /*
              * In v3 protocol, the source VM is still available to
              * restart during confirm() step, so we kill it off
@@ -6074,6 +6069,10 @@ qemuMigrationDstFinish(virQEMUDriver *driver,
     return dom;
 
  error:
+    /* Need to save the current error, in case shutting down the process
+     * overwrites it. */
+    virErrorPreserveLast(&orig_err);
+
     if (virDomainObjIsActive(vm)) {
         if (doKill) {
             qemuProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED,
-- 
2.35.1



More information about the libvir-list mailing list