From: Kevin Wolf <kwolf@redhat.com>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
aliguori@us.ibm.com, alevy@redhat.com, qemu-devel@nongnu.org,
armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH 02/14] qerror: add new errors
Date: Fri, 01 Jun 2012 14:40:31 +0200 [thread overview]
Message-ID: <4FC8B83F.2000505@redhat.com> (raw)
In-Reply-To: <20120531130814.5779aae9@doriath.home>
Am 31.05.2012 18:08, schrieb Luiz Capitulino:
> On Thu, 31 May 2012 17:49:42 +0200
> Paolo Bonzini <pbonzini@redhat.com> wrote:
>
>> Il 31/05/2012 17:44, Luiz Capitulino ha scritto:
>>>> One is "do not shoehorn errors into errno values". So for QOM invalid values we
>>>> have PropertyValueBad, not a generic InvalidArgument value. We convert everything
>>>> to Error rather than returning negative errno values and then returning generic
>>>> error codes, because those would be ugly and non-descriptive. I agree with that.
>>>>
>>>> The other is "when errors come straight from the OS, _do_ use errno values".
>>>> This is for OpenFileFailed, for the new socket errors and so on. This is what
>>>> I am proposing.
>>>>
>>>> These two rules together match what most other programs do.
>>>>
>>>> $ echo | sed p > /dev/full
>>>> sed: couldn't flush stdout: No space left on device
>>>> ^^^^^^^^^^^^^^ error type
>>>> ^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^ arguments
>>>>
>>>> That would become, in JSON:
>>>>
>>>> { 'error': 'FlushFailed',
>>>> 'file': 'stdout',
>>>> 'os_error': 'enospc' }
>>>
>>> Actually, I did propose something similar in the past but Anthony objected.
>>
>> Looks like in the meanwhile we moved closer to this mechanism
>> (OpenFileFailed, Sock*, etc.), except we have no clear way to identify
>> _what_ error actually happened rather than _where_.
>
> In fact, it's the other way around. OpenFileFailed, for example, is an old
> error. We thought it would be ok to have it that way (also because of shallow
> QMP conversion, as it would take ages to convert all possible errors). But today
> it's clear it's bad and we're trying to move away from it.
It's not all that clear for me. Or actually, it is rather clear that
it's basically the right thing, but some additional information is required.
> The socket ones repeat this, but it's probably because people usually go
> for the generic error first because having detailed errors with qerror is
> cumbersome. I have some ideas to improve it that could _mitigate_ that problem,
> like having a schema file qapi-errors.json:
>
> { 'error': 'InvalidParameter', 'data': { 'name': 'str' } }
Errors that are as simple as that are useless if they are all you get.
Even for InvalidParameter this is true when you have more than a flat
arguments dict.
Maybe what is required in order to fully describe an error is a whole
chain of error objects that describe which error caused which other
action to fail:
{ 'error': 'TransactionCommandFailed', 'data': {
'command': 'blockdev-snapshot-sync',
'cause': {
'error': 'FileOpenFailed', 'data' : {
'filename': '/tmp/foo.img',
'cause': {
'error': 'PermissionDenied', 'data': {}
}
}
}
}
Not sure if that would be easy to process for a QMP client, though...
Kevin
next parent reply other threads:[~2012-06-01 12:40 UTC|newest]
Thread overview: 26+ 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 ` Kevin Wolf [this message]
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
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
2012-05-25 19:41 [Qemu-devel] [PATCH qmp-next 00/14]: qapi: convert screendump Luiz Capitulino
2012-05-25 19:41 ` [Qemu-devel] [PATCH 02/14] qerror: add new errors Luiz Capitulino
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=4FC8B83F.2000505@redhat.com \
--to=kwolf@redhat.com \
--cc=alevy@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=armbru@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).