From nobody Mon Feb 9 00:20:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1564744496; cv=none; d=zoho.com; s=zohoarc; b=N+fljRABowknYDHOp701oRYnFX0TFM5wUtvGWZBiCfnJd37iNlhzp/f5+wQf0+/c3O8fmUsx8dF2aIpZMdLwisAwPZ+RTxCGnfJMJnuQDrtIfe9OVUOrjNNXW8Jv4q8kitb3p7xq5agsh+LtN0F0cBN6ALAafyaFVe7IJNYz1rg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564744496; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=TfH//VpCpM1Rm1K+fT6zH/vJkdokeja6oeRi/AO8RaI=; b=MusYPeFokr7AwJ8VFPxsvmi6hurLYQO1mFLjwJmIyJmEm5Lmb9enj15K8yf8qS9gp/PYyQc7xrU1ya2kEtvg/2GNrtUR2ONts/nOmFZK11F+UNKdDxOxlp8AvwjKxpoJBbYeasJaSqWRtpMhgCOIxOGgLjmOTwvgQV9SYPcH2ns= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1564744496235304.090172396253; Fri, 2 Aug 2019 04:14:56 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 213C15945B; Fri, 2 Aug 2019 11:14:55 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E5F7619C70; Fri, 2 Aug 2019 11:14:54 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AEB0D41F66; Fri, 2 Aug 2019 11:14:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x72BEBdW005364 for ; Fri, 2 Aug 2019 07:14:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 99AD960925; Fri, 2 Aug 2019 11:14:11 +0000 (UTC) Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 49B44608C2; Fri, 2 Aug 2019 11:14:09 +0000 (UTC) Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6488E307CDEA; Fri, 2 Aug 2019 11:14:08 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id g17so76758076wrr.5; Fri, 02 Aug 2019 04:14:08 -0700 (PDT) Received: from archpc.localdomain (x8d1ee222.agdsn.tu-dresden.de. [141.30.226.34]) by smtp.gmail.com with ESMTPSA id n8sm62779620wro.89.2019.08.02.04.14.05 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 02 Aug 2019 04:14:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RHWkQvP5my1+CgdKSzO/YASRSK8AGFcny0NG1UEVw8Y=; b=citamgzw3TCIiKZxMcnS9bY2n2ir7VPIVCVhX2ATYUCkKZOy1OcH9kj7kf3kvpUJlo j9CvSzyaJ1KKkHOef8BUW5O50j/jKjtIuFJCFDV3BXPpsaHG7fnO62MIZuRfAVdc/rEX SQktmRNrrP9B+aIYZoUx51IqsudztDqq3ItjOaaMHGLqOrsRnR5osWU2v70Qsl2XDB0A gu1XCC4D+8wXM0DZmNYhHoQM7WaPQ9TCgp0n64KraysgKxWXbEZwZf2MVmyeDydHMG9i 8vJx5qgEhd21J/oX/uiZJ8+Exbs+rQA+/tWwf33X8ptbn6XG0N+zM6UZFVCEEBak7VlH xQ6Q== 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=RHWkQvP5my1+CgdKSzO/YASRSK8AGFcny0NG1UEVw8Y=; b=mpvVBmYx0naI8wkT6gv9M+aRACXd+3VO2yu3AdezSQkbRECSez2rALy87AhsdkKogs 8K1AcrN8eKXFHAbHSJ4/Kj9cRgtApevO3c3gXhMmbCCZhpaEyngrBrhJa14G0tSBOY8+ sHuStkY6z6lQrQehJofiG+weeAfnxpeV0BQ4GlDX1hdRDyOjdL1Vw35QlIAHAs7p+QXN 39i4HKli6PJTYTcNNykIfJxPNMYA4ekheyAg6MlbQz9BqHU1FiElzR34yew5wX/6dqQu 14LmRihBDZQ705en7cqmyYreF+B+vJmTWOxxyVGXqa+EBdh/t1v2fr9r3s0/y53tECEC P+IA== X-Gm-Message-State: APjAAAXAhHjE1H0W+mX/6oI/oUqF0ATgGOhH0cUswNB60DAjbSknToj0 h2iQ9PZmA7TsnqeeGTkHvGV7tFT/jp5R1g== X-Google-Smtp-Source: APXvYqyrmbZEX8ha7xIqBfR91s3CCBMwhErMlL4/8GWEl2ikqbfEALKIcqr1+e287cOxn4+MpZpPVQ== X-Received: by 2002:adf:9486:: with SMTP id 6mr116881754wrr.242.1564744446785; Fri, 02 Aug 2019 04:14:06 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Fri, 2 Aug 2019 13:13:31 +0200 Message-Id: <20190802111331.14400-3-stamatis.iliass@gmail.com> In-Reply-To: <20190802111331.14400-1-stamatis.iliass@gmail.com> References: <20190802111331.14400-1-stamatis.iliass@gmail.com> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 02 Aug 2019 11:14:08 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 02 Aug 2019 11:14:08 +0000 (UTC) for IP:'209.85.221.65' DOMAIN:'mail-wr1-f65.google.com' HELO:'mail-wr1-f65.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.099 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS) 209.85.221.65 mail-wr1-f65.google.com 209.85.221.65 mail-wr1-f65.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Erik Skultety Subject: [libvirt] [PATCH v3 2/2] test_driver: implement virDomainMemoryStats X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 02 Aug 2019 11:14:55 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Signed-off-by: Ilias Stamatis Reviewed-by: Erik Skultety --- src/test/test_driver.c | 54 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 83e2c0289f..2fbaf1c4ee 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -7370,6 +7370,59 @@ testDomainManagedSaveRemove(virDomainPtr dom, unsign= ed int flags) return 0; } + +static int +testDomainMemoryStats(virDomainPtr dom, + virDomainMemoryStatPtr stats, + unsigned int nr_stats, + unsigned int flags) +{ + virDomainObjPtr vm =3D NULL; + int cur_memory; + int ret =3D -1; + + virCheckFlags(0, -1); + + if (!(vm =3D testDomObjFromDomain(dom))) + return -1; + + if (virDomainObjCheckActive(vm) < 0) + goto cleanup; + + cur_memory =3D vm->def->mem.cur_balloon; + ret =3D 0; + +#define STATS_SET_PARAM(name, value) \ + if (ret < nr_stats) { \ + stats[ret].tag =3D name; \ + stats[ret].val =3D value; \ + ret++; \ + } + + if (virDomainDefHasMemballoon(vm->def)) { + STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON, cur_memory); + STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_SWAP_IN, 0); + STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_SWAP_OUT, 0); + STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_MAJOR_FAULT, 0); + STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_MINOR_FAULT, 0); + STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_UNUSED, cur_memory / 2); + STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_AVAILABLE, cur_memory); + STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_USABLE, cur_memory / 2); + STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE, 627319920); + STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_DISK_CACHES, cur_memory / 8= ); + STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGALLOC, 0); + STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGFAIL, 0); + STATS_SET_PARAM(VIR_DOMAIN_MEMORY_STAT_RSS, cur_memory / 2); + } + +#undef STATS_SET_PARAM + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + + static int testDomainMemoryPeek(virDomainPtr dom, unsigned long long start, @@ -8700,6 +8753,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .domainManagedSave =3D testDomainManagedSave, /* 1.1.4 */ .domainHasManagedSaveImage =3D testDomainHasManagedSaveImage, /* 1.1.4= */ .domainManagedSaveRemove =3D testDomainManagedSaveRemove, /* 1.1.4 */ + .domainMemoryStats =3D testDomainMemoryStats, /* 5.7.0 */ .domainMemoryPeek =3D testDomainMemoryPeek, /* 5.4.0 */ .domainSnapshotNum =3D testDomainSnapshotNum, /* 1.1.4 */ -- 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list