My recent commit v8.3.0-201-gc500955e95 tried to fix a regression which
would cause the function to return success even if virCloseCallbacksSet
failed. But due to a strange code flow in the function introduced an
opposite regression. The function would return NULL on success when
called without VIR_MIGRATE_CHANGE_PROTECTION flag.

Signed-off-by: Jiri Denemark <jdene...@redhat.com>
---
 src/qemu/qemu_migration.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 38596fa4de..6cc68a567a 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2534,23 +2534,23 @@ qemuMigrationSrcBegin(virConnectPtr conn,
         if (virCloseCallbacksSet(driver->closeCallbacks, vm, conn,
                                  qemuMigrationSrcCleanup) < 0)
             goto endjob;
-        qemuMigrationJobContinue(vm);
-    } else {
-        goto endjob;
     }
 
     ret = g_steal_pointer(&xml);
 
+ endjob:
+    if (flags & VIR_MIGRATE_CHANGE_PROTECTION) {
+        if (ret)
+            qemuMigrationJobContinue(vm);
+        else
+            qemuMigrationJobFinish(vm);
+    } else {
+        qemuDomainObjEndJob(vm);
+    }
+
  cleanup:
     virDomainObjEndAPI(&vm);
     return ret;
-
- endjob:
-    if (flags & VIR_MIGRATE_CHANGE_PROTECTION)
-        qemuMigrationJobFinish(vm);
-    else
-        qemuDomainObjEndJob(vm);
-    goto cleanup;
 }
 
 
-- 
2.35.1

Reply via email to