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.c | |
parent | e08c95ce8d66276198704f21ed9df6d99b3477e0 (diff) | |
download | qemu-f37afb5ab1921f42043b5527a517eef95c36acf8.zip qemu-f37afb5ab1921f42043b5527a517eef95c36acf8.tar.gz qemu-f37afb5ab1921f42043b5527a517eef95c36acf8.tar.bz2 |
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.c')
-rw-r--r-- | migration.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/migration.c b/migration.c index e631f18..ef171d2 100644 --- a/migration.c +++ b/migration.c @@ -487,7 +487,6 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, MigrationState *s = migrate_get_current(); MigrationParams params; const char *p; - int ret; params.blk = blk; params.shared = inc; @@ -509,27 +508,23 @@ void qmp_migrate(const char *uri, bool has_blk, bool blk, s = migrate_init(¶ms); if (strstart(uri, "tcp:", &p)) { - ret = tcp_start_outgoing_migration(s, p, &local_err); + tcp_start_outgoing_migration(s, p, &local_err); #if !defined(WIN32) } else if (strstart(uri, "exec:", &p)) { - ret = exec_start_outgoing_migration(s, p); + exec_start_outgoing_migration(s, p, &local_err); } else if (strstart(uri, "unix:", &p)) { - ret = unix_start_outgoing_migration(s, p, &local_err); + unix_start_outgoing_migration(s, p, &local_err); } else if (strstart(uri, "fd:", &p)) { - ret = fd_start_outgoing_migration(s, p); + fd_start_outgoing_migration(s, p, &local_err); #endif } else { error_set(errp, QERR_INVALID_PARAMETER_VALUE, "uri", "a valid migration protocol"); return; } - if (ret < 0 || local_err) { + if (local_err) { migrate_fd_error(s); - if (!local_err) { - error_set_errno(errp, -ret, QERR_UNDEFINED_ERROR); - } else { - error_propagate(errp, local_err); - } + error_propagate(errp, local_err); return; } |