mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-23 19:49:43 +00:00
973603a813
After setting a balloon target value, applications have to continually poll 'query-balloon' to determine whether the guest has reacted to this request. The virtio-balloon backend knows exactly when the guest has reacted though, and thus it is possible to emit a JSON event to tell the mgmt application whenever the guest balloon changes. This introduces a new 'qemu_balloon_changed()' API which is to be called by balloon driver backends, whenever they have a change in balloon value. This takes the 'actual' balloon value, as would be found in the BalloonInfo struct. The qemu_balloon_change API emits a JSON monitor event which looks like: {"timestamp": {"seconds": 1337162462, "microseconds": 814521}, "event": "BALLOON_CHANGE", "data": {"actual": 944766976}} * balloon.c, balloon.h: Introduce qemu_balloon_changed() for emitting balloon change events on the monitor * hw/virtio-balloon.c: Invoke qemu_balloon_changed() whenever the guest changes the balloon actual value * monitor.c, monitor.h: Define QEVENT_BALLOON_CHANGE Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Acked-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
30 lines
678 B
C
30 lines
678 B
C
/*
|
|
* Balloon
|
|
*
|
|
* Copyright IBM, Corp. 2008
|
|
*
|
|
* Authors:
|
|
* Anthony Liguori <aliguori@us.ibm.com>
|
|
*
|
|
* This work is licensed under the terms of the GNU GPL, version 2. See
|
|
* the COPYING file in the top-level directory.
|
|
*
|
|
*/
|
|
|
|
#ifndef _QEMU_BALLOON_H
|
|
#define _QEMU_BALLOON_H
|
|
|
|
#include "monitor.h"
|
|
#include "qapi-types.h"
|
|
|
|
typedef void (QEMUBalloonEvent)(void *opaque, ram_addr_t target);
|
|
typedef void (QEMUBalloonStatus)(void *opaque, BalloonInfo *info);
|
|
|
|
int qemu_add_balloon_handler(QEMUBalloonEvent *event_func,
|
|
QEMUBalloonStatus *stat_func, void *opaque);
|
|
void qemu_remove_balloon_handler(void *opaque);
|
|
|
|
void qemu_balloon_changed(int64_t actual);
|
|
|
|
#endif
|