qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com, avi@redhat.com
Subject: [Qemu-devel] [RFC 0/5] Monitor handlers convertion to QObject
Date: Thu,  3 Sep 2009 11:24:14 -0300	[thread overview]
Message-ID: <1251987859-20254-1-git-send-email-lcapitulino@redhat.com> (raw)

Hi There,

 This is a RFC for the next phase of the QEMU Monitor Protocol project,
in this phase handlers will get fully "structurized".

 I was waiting for the first phase to be merged before sending this, but
as it's already in staging and as this is just a RFC, I've decided to send.

 This series adds the infrastructure needed to accommodate the new style
handlers and ports do_info_balloon() and do_balloon() to QObject style.

 Please, note that I've chosen to stay simple. I already have patches for
QList and advanced stuff (like the 'ninja action' suggested by Anthony) but
for now let's concentrate on design decisions that will impact the protocol
format.

 Besides the 'user_print' approach, it's very important to discuss the
following:

1. Return data
--------------

 For do_info_balloon() I'm always returning a QString. The 'actual' info
could be something else (QDict?), but I think QString is good, because it's
simple.

 Choosing the best set of data types to return is an issue and I don't
think we can have a general rule for this, the solution will be to review
*each* command handler port and be sure we are doing the right thing.

 I hope people don't get bored in reviewing.

2. Return code
--------------

 All handlers will have a return code. For this series they return 0
for success and -1 for error.

 My current plan is that the procotol will *always* emit something like:

 { "__result__": 0, "__data__": { ... } }

 Where the standard keys 'result' and 'data' will be pushed by common
code (monitor_handle_command(), in this case).

 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.

 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.

 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.

 Suggestions?

             reply	other threads:[~2009-09-03 14:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-03 14:24 Luiz Capitulino [this message]
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 ` [Qemu-devel] [RFC 0/5] Monitor handlers convertion " Gerd Hoffmann
2009-09-03 22:12   ` 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=1251987859-20254-1-git-send-email-lcapitulino@redhat.com \
    --to=lcapitulino@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=avi@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).