[libvirt PATCH 55/80] qmeu: Refactor qemuMigrationSrcPerformPhase

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To make the code flow a bit more sensible.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/qemu/qemu_migration.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 99b1d4b88b..dd18a4ad63 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -5819,29 +5819,27 @@ qemuMigrationSrcPerformPhase(virQEMUDriver *driver,
     }
 
     if (qemuMigrationJobStartPhase(vm, QEMU_MIGRATION_PHASE_PERFORM3) < 0)
-        goto endjob;
+        goto cleanup;
 
     virCloseCallbacksUnset(driver->closeCallbacks, vm,
                            qemuMigrationSrcCleanup);
 
-    ret = qemuMigrationSrcPerformNative(driver, vm, persist_xml, uri, cookiein, cookieinlen,
-                                        cookieout, cookieoutlen,
-                                        flags, resource, NULL, graphicsuri,
-                                        nmigrate_disks, migrate_disks, migParams, nbdURI);
-
-    if (ret < 0) {
-        qemuMigrationSrcRestoreDomainState(driver, vm);
-        goto endjob;
-    }
-
-    ignore_value(qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_PERFORM3_DONE));
+    if (qemuMigrationSrcPerformNative(driver, vm, persist_xml, uri, cookiein, cookieinlen,
+                                      cookieout, cookieoutlen,
+                                      flags, resource, NULL, graphicsuri,
+                                      nmigrate_disks, migrate_disks, migParams, nbdURI) < 0)
+        goto cleanup;
 
     if (virCloseCallbacksSet(driver->closeCallbacks, vm, conn,
                              qemuMigrationSrcCleanup) < 0)
-        goto endjob;
+        goto cleanup;
 
- endjob:
+    ignore_value(qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_PERFORM3_DONE));
+    ret = 0;
+
+ cleanup:
     if (ret < 0 && !virDomainObjIsFailedPostcopy(vm)) {
+        qemuMigrationSrcRestoreDomainState(driver, vm);
         qemuMigrationParamsReset(driver, vm, VIR_ASYNC_JOB_MIGRATION_OUT,
                                  jobPriv->migParams, priv->job.apiFlags);
         qemuMigrationJobFinish(vm);
-- 
2.35.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux