]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Preserve error in qemuMigrationDstFinish
authorJiri Denemark <jdenemar@redhat.com>
Tue, 10 May 2022 13:20:25 +0000 (15:20 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 7 Jun 2022 15:40:20 +0000 (17:40 +0200)
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@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
src/qemu/qemu_migration.c

index 4b2a313c991650bfe03901dcda7289c918ebcfa8..8894a9c2629ce2de80c5e461f182331208e38518 100644 (file)
@@ -5966,11 +5966,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
@@ -6043,6 +6038,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,