work in progress Signed-off-by: Tomáš Golembiovský <tgole...@redhat.com> --- qga/main.c | 19 ++++++++++++++++--- qga/qapi-event.json | 16 ++++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-)
diff --git a/qga/main.c b/qga/main.c index f16abb5cbb..a9586e7513 100644 --- a/qga/main.c +++ b/qga/main.c @@ -695,16 +695,29 @@ static gboolean monitoring_cb(gpointer data) GAState *s = (GAState *)data; g_assert(s->channel); - g_warning("monitoring!"); if (!ga_channel_client_attached(s->channel)) { goto ok; } - /* TODO: call something */ + /* Fire an event */ + qapi_event_send_guest_heartbeat(12345, &err); + if (err) { + goto fail; + } + + if (queued_event) { + int ret; + ret = send_response(s, QOBJECT(queued_event)); + QDECREF(queued_event); + queued_event = NULL; + if (ret < 0) { + g_warning("error sending event: %s", strerror(-ret)); + } + } goto ok; -/*fail:*/ +fail: g_assert(err); g_warning("%s", error_get_pretty(err)); error_free(err); diff --git a/qga/qapi-event.json b/qga/qapi-event.json index 9c14e4609e..3d48ddb214 100644 --- a/qga/qapi-event.json +++ b/qga/qapi-event.json @@ -1,2 +1,18 @@ # *-*- Mode: Python -*-* +## +# @GUEST_HEARTBEAT: +# +# Mostrly returns memory statistics. TODO +# +# @free-ram: Amount of free memory in kB +# +# Since: 2.10 +# +# Example: +# +# <- { "event": "GUEST_HEARTBEAT", "data": { "free-ram": "12345" }, +# "timestamp": { "seconds": 1267040730, "microseconds": 682951 } } +# +## +{ 'event': 'GUEST_HEARTBEAT', 'data': { 'free-ram': 'size' } } -- 2.13.1