qemu-e2k/util
Daniel P. Berrange d59ce6f344 migration: add reporting of errors for outgoing migration
Currently if an application initiates an outgoing migration,
it may or may not, get an error reported back on failure. If
the error occurs synchronously to the 'migrate' command
execution, the client app will see the error message. This
is the case for DNS lookup failures. If the error occurs
asynchronously to the monitor command though, the error
will be thrown away and the client left guessing about
what went wrong. This is the case for failure to connect
to the TCP server (eg due to wrong port, or firewall
rules, or other similar errors).

In the future we'll be adding more scope for errors to
happen asynchronously with the TLS protocol handshake.
TLS errors are hard to diagnose even when they are well
reported, so discarding errors entirely will make it
impossible to debug TLS connection problems.

Management apps which do migration are already using
'query-migrate' / 'info migrate' to check up on progress
of background migration operations and to see their end
status. This is a fine place to also include the error
message when things go wrong.

This patch thus adds an 'error-desc' field to the
MigrationInfo struct, which will be populated when
the 'status' is set to 'failed':

(qemu) migrate -d tcp:localhost:9001
(qemu) info migrate
capabilities: xbzrle: off rdma-pin-all: off auto-converge: off zero-blocks: off compress: off events: off x-postcopy-ram: off
Migration status: failed (Error connecting to socket: Connection refused)
total time: 0 milliseconds

In the HMP, when doing non-detached migration, it is
also possible to display this error message directly
to the app.

(qemu) migrate tcp:localhost:9001
Error connecting to socket: Connection refused

Or with QMP

  {
    "execute": "query-migrate",
    "arguments": {}
  }
  {
    "return": {
      "status": "failed",
      "error-desc": "address resolution failed for myhost:9000: No address associated with hostname"
    }
  }

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Message-Id: <1461751518-12128-11-git-send-email-berrange@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
2016-05-26 11:31:30 +05:30
..
Makefile.objs log: move qemu-log.c into util/ directory 2016-02-03 09:19:10 +00:00
acl.c util: Clean up includes 2016-02-04 17:01:04 +00:00
base64.c include/qemu/osdep.h: Don't include qapi/error.h 2016-03-22 22:20:15 +01:00
bitmap.c util: Clean up includes 2016-02-04 17:01:04 +00:00
bitops.c util: Clean up includes 2016-02-04 17:01:04 +00:00
buffer.c qemu-common: stop including qemu/host-utils.h from qemu-common.h 2016-05-19 16:42:28 +02:00
compatfd.c util: Clean up includes 2016-02-04 17:01:04 +00:00
coroutine-gthread.c util: Clean up includes 2016-02-04 17:01:04 +00:00
coroutine-sigaltstack.c Remove unneeded include statements for setjmp.h 2016-03-22 19:11:15 +01:00
coroutine-ucontext.c Remove unneeded include statements for setjmp.h 2016-03-22 19:11:15 +01:00
coroutine-win32.c util: Clean up includes 2016-02-04 17:01:04 +00:00
crc32c.c util: Clean up includes 2016-02-04 17:01:04 +00:00
cutils.c util: move declarations out of qemu-common.h 2016-03-22 22:20:17 +01:00
envlist.c util: Clean up includes 2016-02-04 17:01:04 +00:00
error.c migration: add reporting of errors for outgoing migration 2016-05-26 11:31:30 +05:30
event_notifier-posix.c event-notifier: Add "is_external" parameter 2016-04-22 16:43:56 +02:00
event_notifier-win32.c event-notifier: Add "is_external" parameter 2016-04-22 16:43:56 +02:00
fifo8.c util: Clean up includes 2016-02-04 17:01:04 +00:00
getauxval.c util: Clean up includes 2016-02-04 17:01:04 +00:00
hbitmap.c util: Clean up includes 2016-02-04 17:01:04 +00:00
hexdump.c util: Improved qemu_hexmap() to include an ascii dump of the buffer 2016-04-06 09:52:07 +08:00
host-utils.c util: Clean up includes 2016-02-04 17:01:04 +00:00
id.c util: move declarations out of qemu-common.h 2016-03-22 22:20:17 +01:00
iov.c util: move declarations out of qemu-common.h 2016-03-22 22:20:17 +01:00
log.c log: do not use CONFIG_USER_ONLY 2016-05-19 13:08:04 +02:00
memfd.c vhost: add migration block if memfd failed 2015-10-22 14:34:49 +03:00
mmap-alloc.c util: Clean up includes 2016-02-04 17:01:04 +00:00
module.c util: Clean up includes 2016-02-04 17:01:04 +00:00
notify.c util: Clean up includes 2016-02-04 17:01:04 +00:00
osdep.c osdep: Move default qemu_hw_version() value to a macro 2016-05-23 13:19:36 -03:00
oslib-posix.c exec.c: Ensure right alignment also for file backed ram 2016-05-23 16:53:42 +02:00
oslib-win32.c util: move declarations out of qemu-common.h 2016-03-22 22:20:17 +01:00
path.c util: move declarations out of qemu-common.h 2016-03-22 22:20:17 +01:00
qemu-config.c util: Clean up includes 2016-02-04 17:01:04 +00:00
qemu-coroutine-io.c osdep: remove use of socket_error() from all code 2016-03-10 17:19:34 +00:00
qemu-coroutine-lock.c util: Clean up includes 2016-02-04 17:01:04 +00:00
qemu-coroutine-sleep.c util: Clean up includes 2016-02-04 17:01:04 +00:00
qemu-coroutine.c util: Clean up includes 2016-02-04 17:01:04 +00:00
qemu-error.c util: Clean up includes 2016-02-04 17:01:04 +00:00
qemu-openpty.c util: Clean up includes 2016-02-04 17:01:04 +00:00
qemu-option.c QemuOpts: Fix qemu_opts_foreach() dangling location regression 2016-04-28 08:18:56 +02:00
qemu-progress.c util: Clean up includes 2016-02-04 17:01:04 +00:00
qemu-sockets.c util: fix comment typos 2016-05-18 15:04:27 +03:00
qemu-thread-posix.c util: Clean up includes 2016-02-04 17:01:04 +00:00
qemu-thread-win32.c util: Clean up includes 2016-02-04 17:01:04 +00:00
qemu-timer-common.c util: Clean up includes 2016-02-04 17:01:04 +00:00
rcu.c util: Clean up includes 2016-02-04 17:01:04 +00:00
readline.c util: move declarations out of qemu-common.h 2016-03-22 22:20:17 +01:00
rfifolock.c rfifolock: no need to get thread identifier when nesting 2016-05-16 15:29:44 -07:00
throttle.c include/qemu/osdep.h: Don't include qapi/error.h 2016-03-22 22:20:15 +01:00
timed-average.c Fix some typos found by codespell 2016-05-18 15:04:27 +03:00
unicode.c util: move declarations out of qemu-common.h 2016-03-22 22:20:17 +01:00
uri.c util: Clean up includes 2016-02-04 17:01:04 +00:00