qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Luiz Capitulino <lcapitulino@redhat.com>
Cc: aliguori@us.ibm.com, fred.konrad@greensocs.com,
	kraxel@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com
Subject: Re: [Qemu-devel] [PATCH 3/4] hmp: human-monitor-command: stop using the Memory chardev driver
Date: Tue, 02 Apr 2013 14:44:44 -0600	[thread overview]
Message-ID: <515B433C.7090709@redhat.com> (raw)
In-Reply-To: <1364933897-25803-4-git-send-email-lcapitulino@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2893 bytes --]

On 04/02/2013 02:18 PM, Luiz Capitulino wrote:
> The Memory chardev driver was added because, as the Monitor's output
> buffer was static, we needed a way to accumulate the output of an
> HMP commmand when ran by human-monitor-command.
> 
> However, the Monitor's output buffer is now dynamic, so it's possible
> for the human-monitor-command to use it instead of the Memory chardev
> driver.
> 
> This commit does that change, but there are two important
> obversations about it:

s/obversations/observations/

> 
>  1. We need a way to signal to the Monitor that it shouldn't call
>     chardev functions when flushing its output. This is done
>     by adding a new flag to the Monitor object called skip_flush
> 	(which is set to true by qmp_human_monitor_command())
> 
>  2. The current code has buffered semantics: QMP clients will
>     only see a command's output if it flushes its output with
> 	a new-line character. This commit changes this to unbuffered,
> 	which means that QMP clients will see a command's output
> 	whenever the command prints anything.

Ultimately, libvirt will still buffer until it has a complete JSON
reply, even if portions of that reply are being sent unbuffered now
where they were previously buffered until newlines.  At any rate, I
guess you could do some testing with libvirt, such as:

virsh qemu-monitor-command $dom --hmp info

and checking that libvirt isn't confused by the new output timing behavior.

> 
> 	I don't think this will matter in practice though, as I believe
> 	all HMP commands print the new-line character anyway.

Just looking at it from libvirt's point of view, the few HMP commands
that libvirt.so relies on when talking to qemu 1.4 are:

set_cpu
drive_add
drive_del
savevm
loadvm
delvm
inject-nmi
sendkey

[libvirt-qemu.so exposes human-monitor-command as a development aid, via
'virsh qemu-monitor-command', but this is explicitly unsupported and
relegated to a separate library instead of libvirt.so for a reason]

I chose to look at 'delvm'; that command always has a newline ending any
error message, but on the success case, it looked like there was no
output at all.  But once again, since the command is only being used via
the QMP 'human-monitor-command' wrapper, and libvirt is only checking
for known errors and declaring success if none of the error strings are
present, I think it will still work.  I haven't actually tested it, though.

> 
> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
> ---
>  monitor.c | 17 ++++++++---------
>  1 file changed, 8 insertions(+), 9 deletions(-)

Even without an explicit test on my part, this looks sane enough that I
don't mind if you use:

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
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: 621 bytes --]

  reply	other threads:[~2013-04-02 20:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-02 20:18 [Qemu-devel] [PATCH v2 0/4] Monitor: make output buffer dynamic Luiz Capitulino
2013-04-02 20:18 ` [Qemu-devel] [PATCH 1/4] qstring: add qstring_get_length() Luiz Capitulino
2013-04-02 20:18 ` [Qemu-devel] [PATCH 2/4] Monitor: Make output buffer dynamic Luiz Capitulino
2013-04-02 20:48   ` Eric Blake
2013-04-02 20:18 ` [Qemu-devel] [PATCH 3/4] hmp: human-monitor-command: stop using the Memory chardev driver Luiz Capitulino
2013-04-02 20:44   ` Eric Blake [this message]
2013-04-03 13:33     ` Luiz Capitulino
2013-04-02 20:18 ` [Qemu-devel] [PATCH 4/4] chardev: drop " Luiz Capitulino
2013-04-02 20:50   ` Eric Blake
2013-04-03  8:23 ` [Qemu-devel] [PATCH v2 0/4] Monitor: make output buffer dynamic Gerd Hoffmann

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=515B433C.7090709@redhat.com \
    --to=eblake@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=armbru@redhat.com \
    --cc=fred.konrad@greensocs.com \
    --cc=kraxel@redhat.com \
    --cc=lcapitulino@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).