summary refs log tree commit diff stats
path: root/migration/migration.c
diff options
context:
space:
mode:
authorSteve Sistare <steven.sistare@oracle.com>2024-02-22 09:28:34 -0800
committerPeter Xu <peterx@redhat.com>2024-02-28 11:31:28 +0800
commitbf78a046b917a92fa50a4c1b6631a3c4598d0235 (patch)
tree46a0556b18c3547c0978dcedcec7955349f637af /migration/migration.c
parent6835f5a1bc55cabd318cb20ded15a0e8de6d5833 (diff)
downloadfocaccia-qemu-bf78a046b917a92fa50a4c1b6631a3c4598d0235.tar.gz
focaccia-qemu-bf78a046b917a92fa50a4c1b6631a3c4598d0235.zip
migration: refactor migrate_fd_connect failures
Move common code for the error path in migrate_fd_connect to a shared
fail label.  No functional change.

Signed-off-by: Steve Sistare <steven.sistare@oracle.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Link: https://lore.kernel.org/r/1708622920-68779-9-git-send-email-steven.sistare@oracle.com
Signed-off-by: Peter Xu <peterx@redhat.com>
Diffstat (limited to 'migration/migration.c')
-rw-r--r--migration/migration.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/migration/migration.c b/migration/migration.c
index 925103b61a..6a115d28b8 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -3627,11 +3627,7 @@ void migrate_fd_connect(MigrationState *s, Error *error_in)
     if (migrate_postcopy_ram() || migrate_return_path()) {
         if (open_return_path_on_source(s)) {
             error_setg(&local_err, "Unable to open return-path for postcopy");
-            migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED);
-            migrate_set_error(s, local_err);
-            error_report_err(local_err);
-            migrate_fd_cleanup(s);
-            return;
+            goto fail;
         }
     }
 
@@ -3660,6 +3656,13 @@ void migrate_fd_connect(MigrationState *s, Error *error_in)
                 migration_thread, s, QEMU_THREAD_JOINABLE);
     }
     s->migration_thread_running = true;
+    return;
+
+fail:
+    migrate_set_error(s, local_err);
+    migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED);
+    error_report_err(local_err);
+    migrate_fd_cleanup(s);
 }
 
 static void migration_class_init(ObjectClass *klass, void *data)