From: Luiz Capitulino <lcapitulino@redhat.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
hollisb@linux.vnet.ibm.com, Gerd Hoffmann <kraxel@redhat.com>,
qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [RFC 0/7] QError v1
Date: Fri, 30 Oct 2009 11:47:16 -0200 [thread overview]
Message-ID: <20091030114716.02d7ac3e@doriath> (raw)
In-Reply-To: <4AEAE56E.8040309@us.ibm.com>
(Added Daniel Berrange to the CC list)
On Fri, 30 Oct 2009 08:09:02 -0500
Anthony Liguori <aliguori@us.ibm.com> wrote:
> Gerd Hoffmann wrote:
> > On 10/30/09 13:28, Luiz Capitulino wrote:
> >>>> - qemu_error("Device \"%s\" not found. Try -device '?' for
> >>>> a list.\n",
> >>>> - driver);
> >>>> + qemu_error_structed(QERR_DEV_NFOUND, "{ 'name': %s }",
> >>>> driver);
> >>>
> >>> why not store the "{ 'name': %s }" in the qerror_table? I guess you
> >>> plan to have different fields in some cases?
> >>
> >> The main reason is to have syntax checking, we can declare it in a
> >> macro though, in case of generic errors which are going to be used in
> >> other places.
> >
> > I still feel the error reporting is too complex. IMHO there should be
> > no need to edit two places for error reporting, which means I'd go the
> > opposite direction: Zap qerror_table[], then have:
> >
> > qemu_error_structed(QERR_DEV_NFOUND, "device %{name}s not found",
> > "{ 'name': %s }", driver);
I'm ok with this.
> > Also I think the error codes should be more generic, so you don't need
> > a new one for each and every error. Ideally we'll have a reasonable
> > and stable set of error codes after the initial conversion, so you
> > don't have to touch the management apps just to add new codes as qemu
> > envolves. The error code must help the management app to decide how
> > to deal with the error, but it shouldn't carry details not needed for
> > that.
>
> Okay, let's get more clever then and do:
>
> #define QERR_DEV_NFOUND "{ 'code': 404, 'name': %s}"
>
> So we can do:
>
> qemu_error_structured(QERR_DEV_NFOUND, driver);
>
> Such that we still get printf style parameter checking.
Seems ok to me, but to make it harder to reuse existing error
codes we'd have to:
1. Make mandatory the use of a macro in the qemu_error_structed()
call
2. All macros would have to be defined in qerror.h
Btw, why are you calling it qemu_error_structured()? It's a long
name, let's call it qemu_erro_structed() or any better name.. I
thought about qemu_error_throw()..
> > Picking the balloon errors (other patch in this thread): You have
> > *two* error codes for ballooning not being available. I think a
> > generic "service not available" error code would work for both (and
> > for other error cases too) and would be good enougth. The management
> > app will figure it can't balloon down the VM. It will not know the
> > reason from the error code, but does it have to? I doubt it will
> > react in a different way. And for manual trouble-shooting the text
> > message which carries more information gets logged.
>
> I think the trouble is Luiz is trying to preserve today's error
> messages. Honestly, if we need to break those, I don't mind so much
> because I really doubt anyone is depending on the exact text of the
> error messages.
>
> I agree that a bit more generic error messages wouldn't be a bad thing.
I think we're back to the discussion regarding what information
an error should contain.
Daniel seems to want as most info as possible:
http://lists.gnu.org/archive/html/qemu-devel/2009-10/msg01640.html
In case we put only the error code and error data on the wire,
I think error codes should be *unique* and not generic. This way
clients are able to determine the exact error cause.
If we go with generic errors, then we would have to send the
user string along. This introduces the problem of localization
and can be a bit redundant, as the call above would be emitted
like:
{ "error": { "code": 404,
"desc": "driver foobar not found",
"data": { "name": foobar" } } }
next prev parent reply other threads:[~2009-10-30 13:47 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-29 18:42 [Qemu-devel] [RFC 0/7] QError v1 Luiz Capitulino
2009-10-29 18:42 ` [Qemu-devel] [PATCH 1/7] QJSon: Introduce qobject_from_json_va() Luiz Capitulino
2009-10-29 18:42 ` [Qemu-devel] [PATCH 2/7] Introduce QError Luiz Capitulino
2009-10-29 20:14 ` [Qemu-devel] " Anthony Liguori
2009-10-29 20:48 ` Luiz Capitulino
2009-10-29 22:08 ` Paolo Bonzini
2009-10-30 2:25 ` Jamie Lokier
2009-10-30 13:05 ` Anthony Liguori
2009-10-30 13:48 ` Luiz Capitulino
2009-10-29 18:42 ` [Qemu-devel] [PATCH 3/7] monitor: QError support Luiz Capitulino
2009-10-29 18:42 ` [Qemu-devel] [PATCH 4/7] QError: Add QERR_DEV_NFOUND Luiz Capitulino
2009-10-29 18:42 ` [Qemu-devel] [PATCH 5/7] qdev: Use QError for not found error Luiz Capitulino
2009-10-29 18:42 ` [Qemu-devel] [PATCH 6/7] QError: Add do_info_balloon() errors Luiz Capitulino
2009-10-29 18:42 ` [Qemu-devel] [PATCH 7/7] monitor: do_info_balloon(): use QError Luiz Capitulino
2009-10-29 22:12 ` [Qemu-devel] Re: [RFC 0/7] QError v1 Paolo Bonzini
2009-10-30 12:28 ` Luiz Capitulino
2009-10-30 12:56 ` Gerd Hoffmann
2009-10-30 13:09 ` Anthony Liguori
2009-10-30 13:45 ` Paolo Bonzini
2009-10-30 13:47 ` Luiz Capitulino [this message]
2009-10-30 13:59 ` Anthony Liguori
2009-10-30 14:46 ` Luiz Capitulino
2009-10-30 16:28 ` Jamie Lokier
2009-10-30 16:34 ` Paolo Bonzini
2009-10-30 17:15 ` Daniel P. Berrange
2009-10-30 17:33 ` Paolo Bonzini
2009-10-30 17:48 ` Anthony Liguori
2009-11-01 12:28 ` Vincent Hanquez
2009-10-30 17:40 ` Anthony Liguori
2009-10-30 18:09 ` Jamie Lokier
2009-10-30 18:10 ` Paolo Bonzini
2009-10-30 19:04 ` 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=20091030114716.02d7ac3e@doriath \
--to=lcapitulino@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=hollisb@linux.vnet.ibm.com \
--cc=kraxel@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).