From nobody Wed Nov 5 13:48:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1498223066417272.8802621125909; Fri, 23 Jun 2017 06:04:26 -0700 (PDT) Received: from localhost ([::1]:35451 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dOOG4-0004Jq-Vg for importer@patchew.org; Fri, 23 Jun 2017 09:04:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dOOEZ-0003Ta-DE for qemu-devel@nongnu.org; Fri, 23 Jun 2017 09:02:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dOOEV-0001le-Ge for qemu-devel@nongnu.org; Fri, 23 Jun 2017 09:02:47 -0400 Received: from mail-wr0-f172.google.com ([209.85.128.172]:35825) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dOOEV-0001lK-9N for qemu-devel@nongnu.org; Fri, 23 Jun 2017 09:02:43 -0400 Received: by mail-wr0-f172.google.com with SMTP id k67so64664095wrc.2 for ; Fri, 23 Jun 2017 06:02:43 -0700 (PDT) Received: from fiorina.brq.redhat.com (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id 5sm3081897wrq.60.2017.06.23.06.02.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Jun 2017 06:02:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=67Lq8npGRWUiYFHkSZKWv+7bmYJg50XXI/MU6S9QAQs=; b=qyV8VWHDun0MwhcUDdleDIBuNyhucYdd29NGMR/ol24P2hnI8J/f/1G1pgKpkKBFy9 EGNJF2alatOESczfh6kSIREF2GYcJyzO3DP9URAElvvGtfONsbUEJXZnVt7pB2snYVJd kOWu+eZQ17Sdd2uZWYdoNz0QD6XE5pVw/KRlm9X0T0apHOZQLb2nZJ17RtTviKMufQVC 0hjDx5oZ3XXxEtKI4IiFtTtb+tUaRHXnenoYZS0sQPYNarBBhZQDrPmjOzzyHsndCm4G TQjfpofzGg42UR1THPBOrSBYwyLlu3QZtIWW8EKIPVAbKtsXRL+zsK4yMsdLaf34RGs/ EZMg== X-Gm-Message-State: AKS2vOyBjSjnV4xiwaF5f0pONF+3bMpc08t+CPiFCzvwMCrAX4Iq77/u hCeEBk8mvttbEVLuWBGQ+0M8 X-Received: by 10.223.139.87 with SMTP id v23mr5555408wra.145.1498222961865; Fri, 23 Jun 2017 06:02:41 -0700 (PDT) From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= To: Michael Roth Date: Fri, 23 Jun 2017 15:02:36 +0200 Message-Id: <0d9a013bd8f1ac8211758a0f9b0d35ba0a2eec3d.1498222907.git.tgolembi@redhat.com> X-Mailer: git-send-email 2.13.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.128.172 Subject: [Qemu-devel] [RFC 2/3] qemu-ga: add simple event reporting memory statistics X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 work in progress Signed-off-by: Tom=C3=A1=C5=A1 Golembiovsk=C3=BD --- 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 =3D (GAState *)data; =20 g_assert(s->channel); - g_warning("monitoring!"); =20 if (!ga_channel_client_attached(s->channel)) { goto ok; } =20 - /* TODO: call something */ + /* Fire an event */ + qapi_event_send_guest_heartbeat(12345, &err); + if (err) { + goto fail; + } + + if (queued_event) { + int ret; + ret =3D send_response(s, QOBJECT(queued_event)); + QDECREF(queued_event); + queued_event =3D NULL; + if (ret < 0) { + g_warning("error sending event: %s", strerror(-ret)); + } + } goto ok; =20 -/*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 -*-* =20 +## +# @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' } } --=20 2.13.1