|
From: | Gerd Hoffmann |
Subject: | [Qemu-devel] Re: [RFC 0/7] QError v1 |
Date: | Fri, 30 Oct 2009 13:56:01 +0100 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Lightning/1.0pre Thunderbird/3.0b4 |
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);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.
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.
cheers, Gerd
[Prev in Thread] | Current Thread | [Next in Thread] |