From 9c495f8fcb843fbdbd9fdad6769bf8f9522d392b Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Mon, 23 May 2022 16:31:51 +0200 Subject: [PATCH] qemu: Do not return NULL when qemuMigrationSrcBegin succeeds 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 Reviewed-by: Michal Privoznik --- 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; }