From: Markus Armbruster <armbru@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Anthony Liguori <aliguori@us.ibm.com>,
qemu-devel@nongnu.org, Luiz Capitulino <lcapitulino@redhat.com>
Subject: Re: [Qemu-devel] Adding errno to QMP errors
Date: Mon, 18 Jun 2012 17:41:21 +0200 [thread overview]
Message-ID: <m3aa00eify.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <20120615170350.GO16777@redhat.com> (Daniel P. Berrange's message of "Fri, 15 Jun 2012 18:03:50 +0100")
"Daniel P. Berrange" <berrange@redhat.com> writes:
> On Fri, Jun 15, 2012 at 11:52:57AM -0500, Anthony Liguori wrote:
>> On 06/13/2012 12:49 PM, Luiz Capitulino wrote:
>> No, you're confusing things I think. { 'error': 'NoSpace' } is bad.
>> errno is not an intrinsically bad thing but errno critically relies
>> on the *caller* to understand the context that the error has
>> occurred in. Just returning { 'error': 'NoSpace' } is not good
>> enough in QMP because the caller doesn't know the context. What was
>> the command doing such that that error was returning?
>>
>> In many cases, errno has different meanings depending on the
>> context. EINVAL is a good example of this.
>>
>> The devil is in the details here. Having an error like:
>>
>> { 'error': 'OpenFileFailed', 'file': 'filename', 'mode': 'r/w',
>> 'os_error': 'enospc' }
>>
>> is actually pretty reasonable for something like a memory dump
>> command where the user specifies a file.
>
> I can't help thinking that we're still over-engineering the error
> reporting for QMP, and that really all we need is a reasonably
> coarse error code/class, and an informal string.
>
> eg,
>
> { 'error': "SystemError", msg = "failed to open file '/foo/bar' for writing: no space on device" }
>
> { 'error': "DNSError", msg = "unable to resolve hostname 'foo': cannot reach nameserver"}
>
> etc
>
> In libvirt we started with a ridiculously complicated virErrorPtr
> struct, which no one ever remembered to fill our details in, or
> filledout details inconsistently. These days we only ever bother
> with a coarse error class, and a string, and in the case of a
> system error, we also include the raw errno value.
Good match for real-world error handling, which is usually a minor
variation of
if (didn't work)
if (retry might fix it)
retry
else if (I got a plan B to try)
try plan B
else
punt to human
Error information used:
1. whether it failed
2. whether a failure is transient or permanent
3. a description of the failure fit for human consumption
> Pretty much all common APIs / languages focus primarily on just
> an error code/class and a informal string too, with the odd
> exception eg Python's OSException provides you the errno value
> too
>
> Are any users of QMP actually asking for this kind of advanced
> error reporting ? From libvirt's POV we're perfectly content
> with just an error class & string.
Real users, please, not theoretical ones.
next prev parent reply other threads:[~2012-06-18 15:41 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1338387301-10074-1-git-send-email-lcapitulino@redhat.com>
[not found] ` <1338387301-10074-3-git-send-email-lcapitulino@redhat.com>
[not found] ` <4FC74B1A.8080700@redhat.com>
[not found] ` <20120531110608.4dc3fe22@doriath.home>
[not found] ` <4FC77F6C.8000008@redhat.com>
[not found] ` <20120531113127.1c8aa213@doriath.home>
[not found] ` <4FC78637.4040605@redhat.com>
[not found] ` <20120531124411.659ed161@doriath.home>
[not found] ` <4FC79316.6080603@redhat.com>
[not found] ` <20120531130814.5779aae9@doriath.home>
2012-06-01 12:40 ` [Qemu-devel] [PATCH 02/14] qerror: add new errors Kevin Wolf
2012-06-13 17:49 ` [Qemu-devel] Adding errno to QMP errors Luiz Capitulino
2012-06-15 14:46 ` Luiz Capitulino
2012-06-15 16:52 ` Anthony Liguori
2012-06-15 16:55 ` Paolo Bonzini
2012-06-15 17:48 ` Anthony Liguori
2012-06-15 19:11 ` Paolo Bonzini
2012-06-15 17:02 ` Luiz Capitulino
2012-06-15 17:23 ` Kevin Wolf
2012-06-15 17:03 ` Daniel P. Berrange
2012-06-18 15:41 ` Markus Armbruster [this message]
2012-06-18 18:31 ` Anthony Liguori
2012-06-19 7:39 ` Kevin Wolf
2012-06-19 9:20 ` Daniel P. Berrange
2012-06-19 9:31 ` Kevin Wolf
2012-06-19 13:12 ` Luiz Capitulino
2012-06-20 17:48 ` [Qemu-devel] [RFC] Fixing the error failure Luiz Capitulino
2012-06-20 18:46 ` Anthony Liguori
2012-06-20 19:40 ` Luiz Capitulino
2012-06-20 19:47 ` Anthony Liguori
2012-06-20 20:13 ` Luiz Capitulino
2012-06-21 12:42 ` Daniel P. Berrange
[not found] ` <20120625165651.31f9e0bd@doriath.home>
[not found] ` <m34npyld8y.fsf@blackfin.pond.sub.org>
[not found] ` <20120626093511.GD14451@redhat.com>
[not found] ` <m3hatyco9g.fsf@blackfin.pond.sub.org>
[not found] ` <4FE9E275.40303@codemonkey.ws>
[not found] ` <m3txxvq3i3.fsf@blackfin.pond.sub.org>
2012-07-02 12:47 ` Anthony Liguori
2012-07-02 13:47 ` Luiz Capitulino
2012-07-02 8:03 ` Paolo Bonzini
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=m3aa00eify.fsf@blackfin.pond.sub.org \
--to=armbru@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=berrange@redhat.com \
--cc=kwolf@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).