qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Roth <mdroth@linux.vnet.ibm.com>
To: Michal Privoznik <mprivozn@redhat.com>
Cc: libvir-list@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2] qemu-ga: add guest-sync-delimited
Date: Tue, 7 Feb 2012 10:47:39 -0600	[thread overview]
Message-ID: <20120207164739.GA21191@illuin> (raw)
In-Reply-To: <4F314086.4040109@redhat.com>

On Tue, Feb 07, 2012 at 04:17:26PM +0100, Michal Privoznik wrote:
> 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?

Yup, and it should be considered a requirement to send the 0xFF before
guest-sync* to avoid some of the potential corner cases mentioned, since
on the qemu-ga side the 0xFF reliance is baked in.

Clients have a choice as to how they want to deal with this scenario so we
offer both guest-sync (no 0xFF) and guest-sync-delimited (precede response
with 0xFF).

> 
> Michal
> 

  reply	other threads:[~2012-02-07 16:47 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
2012-02-07 16:47     ` Michael Roth [this message]
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=20120207164739.GA21191@illuin \
    --to=mdroth@linux.vnet.ibm.com \
    --cc=libvir-list@redhat.com \
    --cc=mprivozn@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).