qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michal Privoznik <mprivozn@redhat.com>
To: Michael Roth <mdroth@linux.vnet.ibm.com>
Cc: libvir-list@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] qemu-ga: add guest-sync-delimited
Date: Tue, 07 Feb 2012 16:17:26 +0100	[thread overview]
Message-ID: <4F314086.4040109@redhat.com> (raw)
In-Reply-To: <1328576953-19701-2-git-send-email-mdroth@linux.vnet.ibm.com>

On 07.02.2012 02:09, Michael Roth wrote:
> guest-sync leaves it as an exercise to the user as to how to reliably
> obtain the response to guest-sync if the client had previously read in a
> partial response (due qemu-ga previously being restarted mid-"sentence"
> due to reboot, forced restart, etc).
> 
> qemu-ga handles this situation on its end by having a client precede
> their guest-sync request with a 0xFF byte (invalid UTF-8), which
> qemu-ga/QEMU JSON parsers will treat as a flush event. Thus we can
> reliably flush the qemu-ga parser state in preparation for receiving
> the guest-sync request.
> 
> guest-sync-delimited provides the same functionality for a client: when
> a guest-sync-delimited is issued, qemu-ga will precede it's response
> with a 0xFF byte that the client can use as an indicator to flush its
> buffer/parser state in preparation for reliably receiving the
> guest-sync-delimited response.
> 
> It is also useful as an optimization for clients, since, after issuing a
> guest-sync-delimited, clients can safely discard all stale data read
> from the channel until the 0xFF is found.
> 
> More information available on the wiki:
> 
> http://wiki.qemu.org/Features/QAPI/GuestAgent#QEMU_Guest_Agent_Protocol
> 
> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>

This makes sense. And it's workable for libvirt.
IIUC, client can send 0xFF to the guest agent and vice versa, right?

Michal

  reply	other threads:[~2012-02-07 15:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-07  1:09 [Qemu-devel] [PATCH v2 0/1] qemu-ga: add guest-sync-delimited Michael Roth
2012-02-07  1:09 ` [Qemu-devel] [PATCH v2] " Michael Roth
2012-02-07 15:17   ` Michal Privoznik [this message]
2012-02-07 16:47     ` Michael Roth
2012-02-07 19:56 ` [Qemu-devel] [PATCH v3] " Michael Roth

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=4F314086.4040109@redhat.com \
    --to=mprivozn@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=mdroth@linux.vnet.ibm.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).