qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Adding errno to QMP errors


From: Luiz Capitulino
Subject: [Qemu-devel] Adding errno to QMP errors
Date: Wed, 13 Jun 2012 14:49:10 -0300

On Thu, 31 May 2012 16:54:47 +0200
Paolo Bonzini <address@hidden> wrote:

> Wait, I think you're conflating two things.
> 
> 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.

[...]

>     $ 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' }

This is not a new discussion and what we're doing today is to return errno
as a QError class name. So, for the example above we'd return something like:

 { 'error': 'NoSpace' }

It's possible to add new optional values if you need more information, but
I know that that's not what you're asking.

I mostly agree that your version would be better, the only problem I see
is that this is probably going to mess a bit more our API as we have been
doing like my example above for some time.

Anthony, the current design was mostly influenced by you and you had
objections on doing what Paolo and Kevin are suggesting. What do you think?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]