qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Amit Shah <amit.shah@redhat.com>,
	qemu-devel@nongnu.org, Juan Quintela <quintela@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v4 10/28] migration: add reporting of errors for outgoing migration
Date: Tue, 15 Mar 2016 10:01:37 +0000	[thread overview]
Message-ID: <20160315100137.GA3168@redhat.com> (raw)
In-Reply-To: <20160314195724.GB15150@work-vm>

On Mon, Mar 14, 2016 at 07:57:25PM +0000, Dr. David Alan Gilbert wrote:
> * Daniel P. Berrange (berrange@redhat.com) wrote:
> > 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"
> >     }
> >   }
> > 
> > Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> > ---
> >  hmp.c                         | 13 ++++++++++++-
> >  include/migration/migration.h |  5 ++++-
> >  include/qapi/error.h          |  2 +-
> >  migration/migration.c         | 15 ++++++++++++---
> >  migration/rdma.c              | 10 +++-------
> >  migration/tcp.c               |  2 +-
> >  migration/unix.c              |  2 +-
> >  qapi-schema.json              |  7 ++++++-
> >  trace-events                  |  2 +-
> >  util/error.c                  |  2 +-
> >  10 files changed, 42 insertions(+), 18 deletions(-)
> > 
> > diff --git a/hmp.c b/hmp.c
> > index 5b6084a..7126f17 100644
> > --- a/hmp.c
> > +++ b/hmp.c
> > @@ -34,6 +34,7 @@
> >  #include "ui/console.h"
> >  #include "block/qapi.h"
> >  #include "qemu-io.h"
> > +#include "qemu/error-report.h"
> >  
> >  #ifdef CONFIG_SPICE
> >  #include <spice/enums.h>
> > @@ -167,8 +168,15 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict)
> >      }
> >  
> >      if (info->has_status) {
> > -        monitor_printf(mon, "Migration status: %s\n",
> > +        monitor_printf(mon, "Migration status: %s",
> >                         MigrationStatus_lookup[info->status]);
> > +        if (info->status == MIGRATION_STATUS_FAILED &&
> > +            info->has_error_desc) {
> > +            monitor_printf(mon, " (%s)\n", info->error_desc);
> > +        } else {
> > +            monitor_printf(mon, "\n");
> > +        }
> > +
> >          monitor_printf(mon, "total time: %" PRIu64 " milliseconds\n",
> >                         info->total_time);
> >          if (info->has_expected_downtime) {
> > @@ -1532,6 +1540,9 @@ static void hmp_migrate_status_cb(void *opaque)
> >          if (status->is_block_migration) {
> >              monitor_printf(status->mon, "\n");
> >          }
> > +        if (info->has_error_desc) {
> > +            error_report("%s", info->error_desc);
> > +        }
> >          monitor_resume(status->mon);
> >          timer_del(status->timer);
> >          g_free(status);
> > diff --git a/include/migration/migration.h b/include/migration/migration.h
> > index e335380..46c1bbe 100644
> > --- a/include/migration/migration.h
> > +++ b/include/migration/migration.h
> > @@ -171,6 +171,9 @@ struct MigrationState
> >      QSIMPLEQ_HEAD(src_page_requests, MigrationSrcPageRequest) src_page_requests;
> >      /* The RAMBlock used in the last src_page_request */
> >      RAMBlock *last_req_rb;
> > +
> > +    /* The last error that occurred */
> > +    Error *error;
> 
> Note that's now 'first error', but other than that comment:
> 
> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> 
> When you merge this, what will happen with existing libvirt; at the
> moment I think something tries to extract the error message out
> of the qemu log - but I don't think this ends up in any log
> unless something does the query-migrate/info migrate;   will that
> happen now, or does it mean we lose diagnostics until libvirt learns
> about it?

I've not removed any lines which printed to stderr, so libvirt should
be no worse off than today.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

  reply	other threads:[~2016-03-15 10:01 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-11 16:37 [Qemu-devel] [PATCH v4 00/28] Convert migration to QIOChannel & support TLS Daniel P. Berrange
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 01/28] s390: use FILE instead of QEMUFile for creating text file Daniel P. Berrange
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 02/28] io: avoid double-free when closing QIOChannelBuffer Daniel P. Berrange
2016-03-14 19:43   ` Dr. David Alan Gilbert
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 03/28] migration: remove use of qemu_bufopen from vmstate tests Daniel P. Berrange
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 04/28] migration: ensure qemu_fflush() always writes full data amount Daniel P. Berrange
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 05/28] migration: split migration hooks out of QEMUFileOps Daniel P. Berrange
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 06/28] migration: introduce set_blocking function in QEMUFileOps Daniel P. Berrange
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 07/28] migration: force QEMUFile to blocking mode for outgoing migration Daniel P. Berrange
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 08/28] migration: introduce a new QEMUFile impl based on QIOChannel Daniel P. Berrange
2016-03-18 12:06   ` Dr. David Alan Gilbert
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 09/28] migration: add helpers for creating QEMUFile from a QIOChannel Daniel P. Berrange
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 10/28] migration: add reporting of errors for outgoing migration Daniel P. Berrange
2016-03-14 19:57   ` Dr. David Alan Gilbert
2016-03-15 10:01     ` Daniel P. Berrange [this message]
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 11/28] migration: convert post-copy to use QIOChannelBuffer Daniel P. Berrange
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 12/28] migration: convert unix socket protocol to use QIOChannel Daniel P. Berrange
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 13/28] migration: rename unix.c to socket.c Daniel P. Berrange
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 14/28] migration: convert tcp socket protocol to use QIOChannel Daniel P. Berrange
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 15/28] migration: convert fd " Daniel P. Berrange
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 16/28] migration: convert exec " Daniel P. Berrange
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 17/28] migration: convert RDMA to use QIOChannel interface Daniel P. Berrange
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 18/28] migration: convert savevm to use QIOChannel for writing to files Daniel P. Berrange
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 19/28] migration: delete QEMUFile buffer implementation Daniel P. Berrange
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 20/28] migration: delete QEMUSizedBuffer struct Daniel P. Berrange
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 21/28] migration: delete QEMUFile sockets implementation Daniel P. Berrange
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 22/28] migration: delete QEMUFile stdio implementation Daniel P. Berrange
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 23/28] migration: move definition of struct QEMUFile back into qemu-file.c Daniel P. Berrange
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 24/28] migration: don't use an array for storing migrate parameters Daniel P. Berrange
2016-03-11 16:37 ` [Qemu-devel] [PATCH v4 25/28] migration: define 'tls-creds' and 'tls-hostname' migration parameters Daniel P. Berrange
2016-03-18 12:22   ` Dr. David Alan Gilbert
2016-03-11 16:38 ` [Qemu-devel] [PATCH v4 26/28] migration: add support for encrypting data with TLS Daniel P. Berrange
2016-03-11 16:38 ` [Qemu-devel] [PATCH v4 27/28] migration: remove support for non-iovec based write handlers Daniel P. Berrange
2016-03-11 16:38 ` [Qemu-devel] [PATCH v4 28/28] migration: remove qemu_get_fd method from QEMUFile Daniel P. Berrange

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=20160315100137.GA3168@redhat.com \
    --to=berrange@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=dgilbert@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).