qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	kraxel@redhat.com, Hollis Blanchard <hollisb@us.ibm.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Re: [PATCH 6/9] QError: Add qdev not found error
Date: Mon, 19 Oct 2009 13:42:13 +0100	[thread overview]
Message-ID: <20091019124213.GJ27871@redhat.com> (raw)
In-Reply-To: <20091019102817.03a3c843@doriath>

On Mon, Oct 19, 2009 at 10:28:17AM -0200, Luiz Capitulino wrote:
> On Mon, 19 Oct 2009 11:25:19 +0100
> "Daniel P. Berrange" <berrange@redhat.com> wrote:
> 
> > On Fri, Oct 16, 2009 at 10:05:44AM -0300, Luiz Capitulino wrote:
> > > On Fri, 16 Oct 2009 10:06:10 +0200
> > > Paolo Bonzini <pbonzini@redhat.com> wrote:
> > > 
> > > > On 10/16/2009 12:44 AM, Hollis Blanchard wrote:
> > > > > How about this (basically what Paolo suggested):
> > > > >
> > > > > { "error": { "code": 12,
> > > > >               "desc": "device %{bus}:%{address} already open",
> > > > >               "data": { "bus": 0, "address": 12 } } }
> > > > >
> > > > > 'desc'*may*  be used by the client, or may be replaced with a localized
> > > > > version.
> > > > 
> > > > I would say that desc need not go on the wire too.  The client might not 
> > > > even want to show the same string to the user, for example they may want 
> > > > to say "mouse already" open.
> > > > 
> > > > The "device %{bus}:%{address} already open" would be strictly inside 
> > > > QEMU, for consumption of the monitor interface.  Of course since the 
> > > > server is in QEMU too it makes sense to consolidate it in the same 
> > > > struct, but this does not mean that everything in the struct needs to go 
> > > > on the wire.
> > > 
> > >  This is what my current proposal does, "desc" goes on the wire
> > > because it's a simple description but messages for users consumption
> > > are printed by .user_print.
> > > 
> > >  I think we could make this very simple if we use a solution along
> > > the lines suggested by Hollis and do _not_ allow variable information
> > > (ie. 'handler data') to go on the wire.
> > > 
> > >  I mean, we could let current errors as they are but add error codes
> > > and new error descriptions to be used by the protocol only.
> > > 
> > >  For example, a call to:
> > > 
> > > monitor_printf(mon, "husb: host usb device %d.%d is already open\n",
> > >                       bus_num, addr);
> > > 
> > >  Would become:
> > > 
> > > qemu_error_structed(404, "husb: host usb device %d.%d is already open\n",
> > >                           bus_num, addr);
> > > 
> > >  When in user protocol the message is printed normally, when in protocol
> > > mode the error code is used to index the error table and on the wire
> > > we emit:
> > > 
> > > { "error": { "code": 404, "desc": "device already open" } }
> > > 
> > >  Now I need to know if it's ok to have such simple error information
> > > on the wire.
> > 
> > In so much as its providing an error code + message I think that is
> > sufficient, but I think we should take care to ensure that the error
> > description contains enough information to allow useful troubleshooting.
> > As such doing a simple index lookup from error code -> message is not
> > sufficient, because it would be throwing away potentially important
> > error data.
> 
>  Yes, it's going to throw away important info. We could have a big enough
> table with all possible errors, but this seems insane at first.
> 
>  Another solution could be to change the semantics of the error data,
> instead of passing to it information which is already there we could pass
> additional info which is not part of the original message.
> 
>  On the other hand, I think this will make the usage of qemu_error_structed()
> a bit confusing.

Why not include all of it, the error code, the generic string for the
error code, and then the formatted specific error string the monitor
currently has. eg

  { "error": { "code": 404,
               "desc": "device already open",
               "detail": "husb: host usb device 001.003 is already open" } }

Since the latter error messages all already exist, it should make it easier
to adapt, and allow clients flexibility in how they report/handle the 
errors whether to show the detail error to users, or just the generic msg

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

  reply	other threads:[~2009-10-19 12:42 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-13 16:56 [Qemu-devel] [PATCH v0 0/9] QError Luiz Capitulino
2009-10-13 16:56 ` [Qemu-devel] [PATCH 1/9] QDict: Introduce qdict_iter() Luiz Capitulino
2009-10-13 16:56 ` [Qemu-devel] [PATCH 2/9] check-qdict: Add test for qdict_iter() Luiz Capitulino
2009-10-13 16:57 ` [Qemu-devel] [PATCH 3/9] qmisc: Introduce qobject_from_va() Luiz Capitulino
2009-10-13 21:52   ` Markus Armbruster
2009-10-14 13:40     ` Luiz Capitulino
2009-10-14 14:27       ` [Qemu-devel] " Paolo Bonzini
2009-10-13 16:57 ` [Qemu-devel] [PATCH 4/9] Introduce QError Luiz Capitulino
2009-10-13 16:57 ` [Qemu-devel] [PATCH 5/9] monitor: QError support Luiz Capitulino
2009-10-13 21:59   ` Markus Armbruster
2009-10-14 13:14     ` [Qemu-devel] " Paolo Bonzini
2009-10-14 14:07       ` Markus Armbruster
2009-10-13 16:57 ` [Qemu-devel] [PATCH 6/9] QError: Add qdev not found error Luiz Capitulino
2009-10-14 23:02   ` Hollis Blanchard
2009-10-15 13:34     ` Luiz Capitulino
2009-10-15 17:16       ` Hollis Blanchard
2009-10-15 17:52         ` Luiz Capitulino
2009-10-15 18:13           ` Hollis Blanchard
2009-10-15 19:08             ` Luiz Capitulino
2009-10-15 20:13               ` Hollis Blanchard
2009-10-15 20:57                 ` Anthony Liguori
2009-10-15 21:18                   ` Hollis Blanchard
2009-10-15 21:27                     ` Anthony Liguori
2009-10-15 22:44                       ` Hollis Blanchard
2009-10-16  8:06                         ` [Qemu-devel] " Paolo Bonzini
2009-10-16 13:05                           ` Luiz Capitulino
2009-10-19 10:25                             ` Daniel P. Berrange
2009-10-19 12:28                               ` Luiz Capitulino
2009-10-19 12:42                                 ` Daniel P. Berrange [this message]
2009-10-16 13:39                           ` Anthony Liguori
2009-10-18  4:25                       ` [Qemu-devel] " Jamie Lokier
2009-10-18 12:17                         ` [Qemu-devel] " Paolo Bonzini
2009-10-19 16:50                           ` Hollis Blanchard
2009-10-19 21:16                             ` Paolo Bonzini
2009-10-16  7:30               ` [Qemu-devel] " Gerd Hoffmann
2009-10-16 12:39                 ` Luiz Capitulino
2009-10-16 13:34                   ` [Qemu-devel] " Paolo Bonzini
2009-10-16 13:37                 ` [Qemu-devel] " Anthony Liguori
2009-10-16 14:17                   ` Luiz Capitulino
2009-10-16 17:28                     ` [Qemu-devel] " Paolo Bonzini
2009-10-16 17:47                       ` Anthony Liguori
2009-10-16  8:02               ` Paolo Bonzini
2009-10-18  4:28                 ` Jamie Lokier
2009-10-18  4:34                   ` Jamie Lokier
2009-10-13 16:57 ` [Qemu-devel] [PATCH 7/9] qdev: Use QError for " Luiz Capitulino
2009-10-13 22:34   ` Markus Armbruster
2009-10-14 13:29     ` [Qemu-devel] " Paolo Bonzini
2009-10-14 16:42       ` Luiz Capitulino
2009-10-14 14:51     ` [Qemu-devel] " Luiz Capitulino
2009-10-19 10:12     ` Daniel P. Berrange
2009-10-19 10:40       ` Gerd Hoffmann
2009-10-19 10:47         ` Daniel P. Berrange
2009-10-19 11:22         ` [Qemu-devel] " Paolo Bonzini
2009-10-19 14:00       ` [Qemu-devel] " Anthony Liguori
2009-10-19 15:21         ` Daniel P. Berrange
2009-10-19 15:27           ` Anthony Liguori
2009-10-19 15:39             ` Daniel P. Berrange
2009-10-13 16:57 ` [Qemu-devel] [PATCH 8/9] QError: Add do_info_balloon() errors Luiz Capitulino
2009-10-13 16:57 ` [Qemu-devel] [PATCH 9/9] monitor: do_info_balloon(): use QError Luiz Capitulino
2009-10-15 19:24 ` [Qemu-devel] [PATCH v0 0/9] QError Anthony Liguori
2009-10-15 19:37   ` Luiz Capitulino
2009-10-19 13:13 ` Markus Armbruster
2009-10-19 14:11   ` Anthony Liguori

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=20091019124213.GJ27871@redhat.com \
    --to=berrange@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=hollisb@us.ibm.com \
    --cc=kraxel@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).