From: Eric Blake <eblake@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] qemu-char: add logfile facility to all chardev backends
Date: Wed, 23 Dec 2015 08:45:27 -0700 [thread overview]
Message-ID: <567AC197.3050002@redhat.com> (raw)
In-Reply-To: <20151223113214.GH20028@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3225 bytes --]
On 12/23/2015 04:32 AM, Daniel P. Berrange wrote:
> On Tue, Dec 22, 2015 at 12:07:03PM -0700, Eric Blake wrote:
>> On 12/22/2015 11:17 AM, Daniel P. Berrange wrote:
>>> Typically a UNIX guest OS will log boot messages to a serial
>>> port in addition to any graphical console. An admin user
>>> may also wish to use the serial port for an interactive
>>> console. A virtualization management system may wish to
>>> collect system boot messages by logging the serial port,
>>> but also wish to allow admins interactive access.
>>>
>>
>> [code review, if we go with this design; see my other message for 2
>> possible alternative qapi designs that may supersede this code review]
>>
>>> ##
>>> -{ 'struct': 'ChardevDummy', 'data': { } }
>>> +{ 'struct': 'ChardevDummy', 'data': { },
>>> + 'base': 'ChardevCommon' }
>>
>> Instead of changing ChardevDummy, you could have deleted this type and done:
>>
>>>
>>> { 'union': 'ChardevBackend', 'data': { 'file' : 'ChardevFile',
>>> 'serial' : 'ChardevHostdev',
>> ...
>> 'pty': 'ChardevCommon',
>> 'null': 'ChardevCommon',
>>
>> and so on. I don't know which is better.
>
> Yep, me neither. Given the name it felt like some kind of placeholder
> for future work, so I left it alone.
ChardevDummy exists because we have no way (yet) to represent an empty
type as a union branch. That is, since you can't do:
'pty': {},
we had to instead create a named empty type. But now that we have a
non-empty type, I see no real reason to keep the name, and no reason to
have a subclass that adds no additional fields; so dropping ChardevDummy
is my recommendation.
>>
>> The other thing we could do here is have qemu_chr_open_common() take a
>> ChardevCommon* instead of a ChardevBackend*. Then each caller would do
>> an appropriate upcast before calling the common code:
>>
>> ChardevCommon *common = qapi_ChardevDummy_base(backend->u.null);
>> if (qemu_chr_open_common(chr, common, errp) {
>
> Yep, I think this is the easiest thing todo, to avoid use of
> backend->u.data.
>
>> and so forth. That feels a bit more type-safe (and less reliant on qapi
>> layout guarantees) than trying to rely on the backend->u.data that I'm
>> trying to get rid of.
>
> Agreed
>
Okay, I think having each branch be a subclass of ChardevCommon (and not
ChardevBackend using ChardevCommon as a base) sounds like the way to go,
and now it's up to v3 to rework the clients to be a bit more typesafe.
>>> +++ b/qemu-options.hx
>>> @@ -2034,40 +2034,43 @@ The general form of a character device option is:
>>> ETEXI
>>>
>>> DEF("chardev", HAS_ARG, QEMU_OPTION_chardev,
>>> - "-chardev null,id=id[,mux=on|off]\n"
>>> + "-chardev null,id=id[,mux=on|off][,logfile=PATH][,logappend=on|off]\n"
>>
>> Do we want to allow logappend=on even when logfile is unspecified, or
>> should we make that an error?
>
> I figured it was harmless to just ignore it.
Works for me.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2015-12-23 15:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-22 18:17 [Qemu-devel] [PATCH v2] qemu-char: add logfile facility to all chardev backends Daniel P. Berrange
2015-12-22 18:45 ` Eric Blake
2015-12-23 11:24 ` Daniel P. Berrange
2015-12-23 15:41 ` Eric Blake
2015-12-22 19:07 ` Eric Blake
2015-12-23 11:32 ` Daniel P. Berrange
2015-12-23 15:45 ` Eric Blake [this message]
2015-12-23 11:34 ` Paolo Bonzini
2015-12-23 11:43 ` Daniel P. Berrange
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=567AC197.3050002@redhat.com \
--to=eblake@redhat.com \
--cc=berrange@redhat.com \
--cc=pbonzini@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.