[libvirt PATCH] qemu: Do not return NULL when qemuMigrationSrcBegin succeeds

Jiri Denemark posted 1 patch 1 year, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/3dffdae10568cc288051f68b547aa19b8bc081b6.1653317181.git.jdenemar@redhat.com
src/qemu/qemu_migration.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
[libvirt PATCH] qemu: Do not return NULL when qemuMigrationSrcBegin succeeds
Posted by Jiri Denemark 1 year, 11 months ago
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 <jdenemar@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
Re: [libvirt PATCH] qemu: Do not return NULL when qemuMigrationSrcBegin succeeds
Posted by Michal Prívozník 1 year, 11 months ago
On 5/23/22 16:46, Jiri Denemark wrote:
> 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 <jdenemar@redhat.com>
> ---
>  src/qemu/qemu_migration.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal