diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-10-02 10:02:46 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-10-23 13:54:56 +0200 |
commit | f37afb5ab1921f42043b5527a517eef95c36acf8 (patch) | |
tree | 19e1c5119272e95f86a51180997532ec37ba3ab8 /migration-tcp.c | |
parent | e08c95ce8d66276198704f21ed9df6d99b3477e0 (diff) |
migration (outgoing): add error propagation for all protocols
Error propagation is already there for socket backends. Add it to other
protocols, simplifying code that tests for errors that will never happen.
With all protocols understanding Error, the code can be simplified
further by removing the return value.
Unfortunately, the quality of error messages varies depending
on where the error is detected, because no Error is passed to the
NonBlockingConnectHandler. Thus, the exact error message still cannot
be sent to the user if the OS reports it asynchronously via SO_ERROR.
If NonBlockingConnectHandler received an Error**, we could for
example report the error class and/or message via a new field of the
query-migration command even if it is reported asynchronously.
Before:
(qemu) migrate fd:ffff
migrate: An undefined error has occurred
(qemu) info migrate
(qemu)
After:
(qemu) migrate fd:ffff
migrate: File descriptor named 'ffff' has not been found
(qemu) info migrate
capabilities: xbzrle: off
Migration status: failed
total time: 0 milliseconds
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'migration-tcp.c')
-rw-r--r-- | migration-tcp.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/migration-tcp.c b/migration-tcp.c index e8bc76acc6..5e54e68360 100644 --- a/migration-tcp.c +++ b/migration-tcp.c @@ -68,22 +68,13 @@ static void tcp_wait_for_connect(int fd, void *opaque) } } -int tcp_start_outgoing_migration(MigrationState *s, const char *host_port, - Error **errp) +void tcp_start_outgoing_migration(MigrationState *s, const char *host_port, Error **errp) { - Error *local_err = NULL; - s->get_error = socket_errno; s->write = socket_write; s->close = tcp_close; - s->fd = inet_nonblocking_connect(host_port, tcp_wait_for_connect, s, &local_err); - if (local_err != NULL) { - error_propagate(errp, local_err); - return -1; - } - - return 0; + s->fd = inet_nonblocking_connect(host_port, tcp_wait_for_connect, s, errp); } static void tcp_accept_incoming_migration(void *opaque) |