From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org, berrange@redhat.com
Cc: quintela@redhat.com, peterx@redhat.com
Subject: [Qemu-devel] [PATCH 1/2] migration: Allow migrate_fd_connect to take an Error *
Date: Fri, 15 Dec 2017 17:16:54 +0000 [thread overview]
Message-ID: <20171215171655.7818-2-dgilbert@redhat.com> (raw)
In-Reply-To: <20171215171655.7818-1-dgilbert@redhat.com>
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Allow whatever is performing the connection to pass migrate_fd_connect
an error to indicate there was a problem during connection, an allow
us to clean up.
The caller must free the error.
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
migration/channel.c | 2 +-
migration/migration.c | 7 ++++++-
migration/migration.h | 2 +-
migration/rdma.c | 2 +-
4 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/migration/channel.c b/migration/channel.c
index 70ec7ea3b7..fdb7ddbd17 100644
--- a/migration/channel.c
+++ b/migration/channel.c
@@ -78,6 +78,6 @@ void migration_channel_connect(MigrationState *s,
s->to_dst_file = f;
- migrate_fd_connect(s);
+ migrate_fd_connect(s, NULL);
}
}
diff --git a/migration/migration.c b/migration/migration.c
index 4de3b551fe..10a4260f27 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -2333,10 +2333,15 @@ static void *migration_thread(void *opaque)
return NULL;
}
-void migrate_fd_connect(MigrationState *s)
+void migrate_fd_connect(MigrationState *s, Error *error_in)
{
s->expected_downtime = s->parameters.downtime_limit;
s->cleanup_bh = qemu_bh_new(migrate_fd_cleanup, s);
+ if (error_in) {
+ migrate_fd_error(s, error_in);
+ migrate_fd_cleanup(s);
+ return;
+ }
qemu_file_set_blocking(s->to_dst_file, true);
qemu_file_set_rate_limit(s->to_dst_file,
diff --git a/migration/migration.h b/migration/migration.h
index 663415fe48..e67e5e87c2 100644
--- a/migration/migration.h
+++ b/migration/migration.h
@@ -168,7 +168,7 @@ uint64_t migrate_max_downtime(void);
void migrate_set_error(MigrationState *s, const Error *error);
void migrate_fd_error(MigrationState *s, const Error *error);
-void migrate_fd_connect(MigrationState *s);
+void migrate_fd_connect(MigrationState *s, Error *error_in);
MigrationState *migrate_init(void);
bool migration_is_blocked(Error **errp);
diff --git a/migration/rdma.c b/migration/rdma.c
index ca56594328..cc7049c594 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -3758,7 +3758,7 @@ void rdma_start_outgoing_migration(void *opaque,
trace_rdma_start_outgoing_migration_after_rdma_connect();
s->to_dst_file = qemu_fopen_rdma(rdma, "wb");
- migrate_fd_connect(s);
+ migrate_fd_connect(s, NULL);
return;
err:
g_free(rdma);
--
2.14.3
next prev parent reply other threads:[~2017-12-15 17:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-15 17:16 [Qemu-devel] [PATCH 0/2] migration/channel errors and cancelling Dr. David Alan Gilbert (git)
2017-12-15 17:16 ` Dr. David Alan Gilbert (git) [this message]
2018-01-28 18:53 ` [Qemu-devel] [PATCH 1/2] migration: Allow migrate_fd_connect to take an Error * Juan Quintela
2017-12-15 17:16 ` [Qemu-devel] [PATCH 2/2] migration: Route errors down through migration_channel_connect Dr. David Alan Gilbert (git)
2018-01-28 18:53 ` Juan Quintela
2017-12-19 5:16 ` [Qemu-devel] [PATCH 0/2] migration/channel errors and cancelling Peter Xu
2017-12-19 10:14 ` Dr. David Alan Gilbert
2017-12-19 11:21 ` Peter Xu
2017-12-19 11:33 ` Dr. David Alan Gilbert
2017-12-20 3:10 ` Peter Xu
2017-12-20 18:15 ` Dr. David Alan Gilbert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171215171655.7818-2-dgilbert@redhat.com \
--to=dgilbert@redhat.com \
--cc=berrange@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).