From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [RFC 0/5] Monitor handlers convertion to QObject
Date: Thu, 03 Sep 2009 22:30:08 +0200 [thread overview]
Message-ID: <4AA02750.8000005@redhat.com> (raw)
In-Reply-To: <1251987859-20254-1-git-send-email-lcapitulino@redhat.com>
Hi,
> Some people have suggested us to define errors codes, but I dislike this
> because I have the impression we will end up defining errors per-handlers,
> which is a lot of work and more protocol definitions to maintain.
What about error messages?
I've recently added some infrastructure for error messages:
qemu_error() + friends. Intention is to direct error messages to the
correct place, especially for code which can be called from multiple
paths. Device creation for example can be triggered by command line
(errors should go to stderr) or via hotplug monitor commands (errors
should go to the monitor).
You might want to add a third error sink which stuffs error messages
into a Qstring, so you can pass them along as Qobject without the code
emitting the error message knowing anything about it.
> Another issue in this subject is that sometimes we will have to do
> a not so small refactor to get the proper error code. I mean, sometimes
> the functions which the handlers call return void, and those functions in
> turn call other functions which also return void. This seem to be the
> case of do_balloon(), for example.
There are also a few places which call exit(1) on error. Which is ok
when something goes wrong while creating the virtual machine, but not
when some monitor command failed ...
> A possible solution is to only return error when it's easy, otherwise we
> could always return 0 (which is what we have today), the problem though
> is that changing this in the future will cause trouble.
Serious code audit is more work initially, but I think we well be very
happy we did it in the long run ...
cheers,
Gerd
next prev parent reply other threads:[~2009-09-03 20:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-03 14:24 [Qemu-devel] [RFC 0/5] Monitor handlers convertion to QObject Luiz Capitulino
2009-09-03 14:24 ` [Qemu-devel] [PATCH 1/5] monitor: Add user_print() to mon_cmd_t Luiz Capitulino
2009-09-03 18:55 ` [Qemu-devel] " Juan Quintela
2009-09-03 18:59 ` Luiz Capitulino
2009-09-03 14:24 ` [Qemu-devel] [PATCH 2/5] monitor: Handle new and old style handlers Luiz Capitulino
2009-09-03 14:24 ` [Qemu-devel] [PATCH 3/5] monitor: Port do_info() to QObject Luiz Capitulino
2009-09-03 14:24 ` [Qemu-devel] [PATCH 4/5] monitor: Port do_info_balloon() " Luiz Capitulino
2009-09-23 15:49 ` Markus Armbruster
2009-09-23 16:09 ` Luiz Capitulino
2009-09-03 14:24 ` [Qemu-devel] [PATCH 5/5] monitor: Port do_balloon() " Luiz Capitulino
2009-09-03 20:30 ` Gerd Hoffmann [this message]
2009-09-03 22:12 ` [Qemu-devel] [RFC 0/5] Monitor handlers convertion " 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=4AA02750.8000005@redhat.com \
--to=kraxel@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).