qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Re: [PATCH 6/9] QError: Add qdev not found error


From: Luiz Capitulino
Subject: [Qemu-devel] Re: [PATCH 6/9] QError: Add qdev not found error
Date: Fri, 16 Oct 2009 10:05:44 -0300

On Fri, 16 Oct 2009 10:06:10 +0200
Paolo Bonzini <address@hidden> 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.




reply via email to

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