From: "Michael S. Tsirkin" <mst@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH RFC 00/48] Convert device_add to QObject / QError
Date: Thu, 25 Feb 2010 13:59:09 +0200 [thread overview]
Message-ID: <20100225115909.GE9116@redhat.com> (raw)
In-Reply-To: <1267034160-3517-1-git-send-email-armbru@redhat.com>
On Wed, Feb 24, 2010 at 06:55:12PM +0100, Markus Armbruster wrote:
> Why this is such a big job? There are two issues with a naive
> conversion:
>
> * Error message degradation
>
> The error messages are worded for -device. They aren't so hot to
> begin with: we typically have many -device options, and to which one
> a message applies is often not obvious.
>
> Now, QMP wants relatively generic errors. For instance, "-device:
> no driver specified" becomes "Parameter 'driver' is missing".
> Emitting such an error with our lengthy command lines is just too
> mean to users.
>
> However, if you know *where* the parameter is missing, the generic
> message is perfectly adequate: "-device a=b: Parameter 'driver' is
> missing". In fact, it's even superior to our current message.
>
> So the first part of the patch series is about error locations. I
> feel it's very useful all by itself. I can split it off into its
> own patch series. But then the rest of this series depends on it,
> so I'm not sure splitting is all that useful.
>
> We may still encounter cases where a generic message is not adequate
> even with precise location information. Let's solve that problem
> when we actually encounter it.
>
> * String argument with option syntax, i.e. NAME=VALUE,...
>
> QMP uses JSON to encode collections of name/value pairs. Adding a
> second encoding for the same thing would be a mistake, in my
> opinion.
>
> Note that we already have two competing encodings in our code: QDict
> and QemuOpts. But we should not permit that to leak into an
> external interface like QMP.
>
> QemuOpts originated in the command line and spread from there into a
> few monitor commands, including device_add, and a few internal
> interfaces.
>
> QDict originated in the monitor. It sits right at the interface
> between monitor core and command handlers.
>
> My proposed solution is modest and pragmatic:
>
> * Lift the parsing of arguments into QemuOpts from monitor handlers
> up into the human monitor core. This removes QemuOpts from the
> handler interface, and thus avoids leaking it into QMP. It's
> exactly what we did for other argument types with syntax
> inappropriate for QMP, such as arguments of migrate_set_speed and
> migrate_set_downtime (commits 9da92c49..b0fbf7d3).
>
> * Monitor handlers that need to pass their arguments in
> QemuOpts-form to internal interfaces use a converter function to
> translate from QDict to QemuOpts.
>
> This is what the last part of the patch series is about. If you'd
> prefer a different solution, let's talk.
>
> I can split this part off into its own patch series if that helps.
> However, the patches before it aren't all that useful without it, so
> I'm not sure splitting buys us much.
>
> A possible alternative is to add the concept of optional named
> arguments to the monitor. Instead of encoding multiple optional
> named arguments in a single positional argument, we encode them as
> multiple named arguments. For instance, "device_add
> ide-drive,drive=hda,bus=ide.0,unit=0" becomes "device_add ide-drive
> drive=hda bus=ide.0 unit=0".
>
> Of course, if you think that adding a second encoding for
> collections of name/value pairs to QMP is fine, then this last part
> can be dropped.
>
> So, the series starts with error locations (part I), and ends with
> keeping QemuOpts out of QMP (part III). Wedged in between is the
> conversion of device_add to QError (part II). In more detail:
>
> Part I: Error Locations
>
> [01-07] Preliminary cleanup & fixes
> [08] Separate "default monitor" and "current monitor" cleanly
> [09-16] More cleanup
> [17-21] Error Locations
>
> Part II: Convert device_add to QError
>
> [22-25] Preliminary qdev cleanup & fixes
> [26-42] Convert device_add to QError
>
> Part III
>
> [43] Conversions between QDict and QemuOpts
> [44-46] New monitor argument type O
> [47-48] Convert device_add to QObject
>
> I cut a few corners clearly marked in commit messages and code. I'll
> fix them up for the non-RFC submit.
I only read the patches in parts I and II, these look very good.
There are some FIXME's there, but you know that yourself.
--
MST
next prev parent reply other threads:[~2010-02-25 12:02 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-24 17:55 [Qemu-devel] [PATCH RFC 00/48] Convert device_add to QObject / QError Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 01/48] monitor: Factor monitor_set_error() out of qemu_error_internal() Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 02/48] error: Move qemu_error() & friends from monitor.c to own file Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 03/48] usb: Remove disabled monitor_printf() in usb_read_file() Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 04/48] savevm: Fix -loadvm to report errors to stderr, not the monitor Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 05/48] pc: Fix error reporting for -boot once Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 06/48] pc: Factor common code out of pc_boot_set() and cmos_init() Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 07/48] tools: Remove unused cur_mon from qemu-tool.c Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 08/48] monitor: Separate "default monitor" and "current monitor" cleanly Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 09/48] block: Simplify usb_msd_initfn() test for "can read bdrv key" Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 10/48] error: Simplify error sink setup Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 11/48] error: Move qemu_error & friends into their own header Markus Armbruster
2010-02-26 19:43 ` Luiz Capitulino
2010-03-01 8:48 ` Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 12/48] error: New error_printf() and error_vprintf() Markus Armbruster
2010-02-26 19:43 ` Luiz Capitulino
2010-03-01 8:54 ` Markus Armbruster
2010-03-01 12:45 ` [Qemu-devel] " Paolo Bonzini
2010-03-01 16:09 ` [Qemu-devel] " Luiz Capitulino
2010-03-02 8:33 ` Markus Armbruster
2010-03-02 12:37 ` [Qemu-devel] " Paolo Bonzini
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 13/48] error: Make qemu_error() add a newline, strip it from arguments Markus Armbruster
2010-02-26 19:44 ` Luiz Capitulino
2010-03-01 8:55 ` Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 14/48] error: Don't abuse qemu_error() for non-error in scsi_hot_add() Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 15/48] error: Don't abuse qemu_error() for non-error in qdev_device_help() Markus Armbruster
2010-02-26 19:44 ` Luiz Capitulino
2010-03-01 9:05 ` Markus Armbruster
2010-03-01 16:11 ` Luiz Capitulino
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 16/48] error: Don't abuse qemu_error() for non-error in qbus_find() Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 17/48] error: Infrastructure to track locations for error reporting Markus Armbruster
2010-02-26 19:45 ` Luiz Capitulino
2010-03-01 9:19 ` Markus Armbruster
2010-03-01 16:15 ` Luiz Capitulino
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 18/48] error: Include the program name in error messages to stderr Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 19/48] error: Track locations in configuration files Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 20/48] QemuOpts: Fix qemu_config_parse() to catch file read errors Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 21/48] error: Track locations on command line Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 22/48] qdev: Fix -device and device_add to handle unsuitable bus gracefully Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 23/48] qdev: Factor qdev_create_from_info() out of qdev_create() Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 24/48] qdev: Hide "no_user" devices from users Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 25/48] qdev: Hide "ptr" properties " Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 26/48] error: Polish human-readable error descriptions Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 27/48] error: New QERR_PROPERTY_NOT_FOUND Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 28/48] error: New QERR_PROPERTY_VALUE_BAD Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 29/48] qdev: convert setting device properties to QError Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 30/48] qdev: Relax parsing of bus option Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 31/48] error: New QERR_BUS_NOT_FOUND Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 32/48] error: New QERR_DEVICE_MULTIPLE_BUSSES Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 33/48] error: New QERR_DEVICE_NO_BUS Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 34/48] qdev: Convert qbus_find() to QError Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 35/48] monitor: New in_qmp_mon() Markus Armbruster
2010-02-26 19:46 ` Luiz Capitulino
2010-03-01 9:19 ` Markus Armbruster
2010-03-01 16:18 ` Luiz Capitulino
2010-03-02 8:53 ` Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 36/48] error: New error_printf_unless_qmp() Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 37/48] error: New QERR_BAD_BUS_FOR_DEVICE Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 38/48] error: New QERR_BUS_NO_HOTPLUG Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 39/48] error: New QERR_DEVICE_INIT_FAILED Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 40/48] error: New QERR_NO_BUS_FOR_DEVICE Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 41/48] Revert "qdev: Use QError for 'device not found' error" Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 42/48] error: Convert do_device_add() to QError Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 43/48] qemu-option: Functions to convert to/from QDict Markus Armbruster
2010-02-26 19:46 ` Luiz Capitulino
2010-03-01 9:24 ` Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 44/48] qemu-option: Move the implied first name into QemuOptsList Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 45/48] qemu-option: Rename find_list() to qemu_find_opts() & external linkage Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 46/48] monitor: New argument type 'O' Markus Armbruster
2010-02-24 17:55 ` [Qemu-devel] [PATCH RFC 47/48] monitor: Use argument type 'O' for device_add Markus Armbruster
2010-02-24 17:56 ` [Qemu-devel] [PATCH RFC 48/48] monitor: convert do_device_add() to QObject Markus Armbruster
2010-02-26 19:47 ` Luiz Capitulino
2010-03-01 9:25 ` Markus Armbruster
2010-02-25 11:59 ` Michael S. Tsirkin [this message]
2010-02-26 19:43 ` [Qemu-devel] [PATCH RFC 00/48] Convert device_add to QObject / QError Luiz Capitulino
2010-03-01 7:59 ` Markus Armbruster
2010-03-01 15:52 ` 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=20100225115909.GE9116@redhat.com \
--to=mst@redhat.com \
--cc=armbru@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).