mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
qemu-ga: add guest-sync-delimited
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 commit is contained in:
parent
3424fc9f16
commit
3cf0bed836
5 changed files with 77 additions and 9 deletions
|
@ -35,8 +35,6 @@
|
|||
#include "qemu-queue.h"
|
||||
#include "host-utils.h"
|
||||
|
||||
static GAState *ga_state;
|
||||
|
||||
static void reopen_fd_to_null(int fd)
|
||||
{
|
||||
int nullfd;
|
||||
|
@ -909,7 +907,6 @@ error:
|
|||
/* register init/cleanup routines for stateful command groups */
|
||||
void ga_command_state_init(GAState *s, GACommandState *cs)
|
||||
{
|
||||
ga_state = s;
|
||||
#if defined(CONFIG_FSFREEZE)
|
||||
ga_command_state_add(cs, guest_fsfreeze_init, guest_fsfreeze_cleanup);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue