[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 08/29] migration (outgoing): add error propagati
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH 08/29] migration (outgoing): add error propagation for all protocols |
Date: |
Mon, 22 Oct 2012 17:52:04 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) |
Paolo Bonzini <address@hidden> writes:
> 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
[...]
> diff --git a/migration-fd.c b/migration-fd.c
> index 7335167..a7c800a 100644
> --- a/migration-fd.c
> +++ b/migration-fd.c
> @@ -73,30 +73,19 @@ static int fd_close(MigrationState *s)
> return 0;
> }
>
> -int fd_start_outgoing_migration(MigrationState *s, const char *fdname)
> +void fd_start_outgoing_migration(MigrationState *s, const char *fdname,
> Error **errp)
> {
> - s->fd = monitor_get_fd(cur_mon, fdname, NULL);
> + s->fd = monitor_get_fd(cur_mon, fdname, errp);
> if (s->fd == -1) {
> - DPRINTF("fd_migration: invalid file descriptor identifier\n");
> - goto err_after_get_fd;
> - }
> -
> - if (fcntl(s->fd, F_SETFL, O_NONBLOCK) == -1) {
> - DPRINTF("Unable to set nonblocking mode on file descriptor\n");
> - goto err_after_open;
> + return;
> }
>
> + fcntl(s->fd, F_SETFL, O_NONBLOCK);
Sure this can't fail?
> s->get_error = fd_errno;
> s->write = fd_write;
> s->close = fd_close;
>
> migrate_fd_connect(s);
> - return 0;
> -
> -err_after_open:
> - close(s->fd);
> -err_after_get_fd:
> - return -1;
> }
>
> static void fd_accept_incoming_migration(void *opaque)
[...]
- [Qemu-devel] [PATCH 04/29] qemu-sockets: add nonblocking connect for Unix sockets, (continued)
- [Qemu-devel] [PATCH 04/29] qemu-sockets: add nonblocking connect for Unix sockets, Paolo Bonzini, 2012/10/19
- [Qemu-devel] [PATCH 03/29] qemu-sockets: unix_listen and unix_connect are portable, Paolo Bonzini, 2012/10/19
- [Qemu-devel] [PATCH 05/29] migration: avoid using error_is_set and thus relying on errp != NULL, Paolo Bonzini, 2012/10/19
- [Qemu-devel] [PATCH 07/29] migration: use qemu-sockets to establish Unix sockets, Paolo Bonzini, 2012/10/19
- [Qemu-devel] [PATCH 06/29] migration: centralize call to migrate_fd_error(), Paolo Bonzini, 2012/10/19
- [Qemu-devel] [PATCH 11/29] nbd: ask and print error information from qemu-sockets, Paolo Bonzini, 2012/10/19
- [Qemu-devel] [PATCH 15/29] vnc: reorganize code for reverse mode, Paolo Bonzini, 2012/10/19
- [Qemu-devel] [PATCH 16/29] vnc: add error propagation to vnc_display_open, Paolo Bonzini, 2012/10/19
- [Qemu-devel] [PATCH 08/29] migration (outgoing): add error propagation for all protocols, Paolo Bonzini, 2012/10/19
- Re: [Qemu-devel] [PATCH 08/29] migration (outgoing): add error propagation for all protocols,
Markus Armbruster <=
- [Qemu-devel] [PATCH 20/29] qemu-sockets: add error propagation to inet_parse, Paolo Bonzini, 2012/10/19
- [Qemu-devel] [PATCH 19/29] qemu-sockets: add error propagation to inet_dgram_opts, Paolo Bonzini, 2012/10/19
- [Qemu-devel] [PATCH 14/29] vnc: introduce a single label for error returns, Paolo Bonzini, 2012/10/19
- [Qemu-devel] [PATCH 21/29] qemu-sockets: add error propagation to Unix socket functions, Paolo Bonzini, 2012/10/19
- [Qemu-devel] [PATCH 23/29] build: add QAPI files to the tools, Paolo Bonzini, 2012/10/19
- [Qemu-devel] [PATCH 25/29] qemu-sockets: return InetSocketAddress from inet_parse, Paolo Bonzini, 2012/10/19
- [Qemu-devel] [PATCH 27/29] block: prepare code for adding block notifiers, Paolo Bonzini, 2012/10/19