From nobody Sat May 4 00:28:23 2024 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=1564697263; cv=none; d=zoho.com; s=zohoarc; b=NaLs6ziB12B6NuQR4MaXuMHEN9/MUQbLlpj/52DjRWYy+Hbg/BVAsePFHdei+Rd0lWkJy7YUC862qWEIRqm3g6iIhAv9oXhMh/wYZNr6qrOk+AKnCy+/WNb9dtz4bGSuvIfSiki3Cqq5lxaNxKwiHCXw0edlOE+A02NlAuq69dw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564697263; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=NnWYQwFBvv+cOEX9LLV+pHLKt2xZTiQTz09XpTXfaM0=; b=Ek14XsuVL7kLyi2aIddsIQogR45UXqba5zZdJyQg19dvqVeHXfQCNRSSF3eWMvG1MhWK6DnVKUjtoiTELO4unxGwrasxXK/2acpEE9yetLJNnFRxiOo/tq6NMbS/DLANnZw5Ug1q7mWAEmWU/sB5kClvJMCmn7U/0RWnOl7twtU= 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 1564697263603685.1510269111748; Thu, 1 Aug 2019 15:07:43 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 37CC0319DCC6; Thu, 1 Aug 2019 22:07:41 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A94C860605; Thu, 1 Aug 2019 22:07:39 +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 25852180B536; Thu, 1 Aug 2019 22:07:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x71M7Xti005206 for ; Thu, 1 Aug 2019 18:07:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id E49AC1000338; Thu, 1 Aug 2019 22:07:33 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DF7AA100032A for ; Thu, 1 Aug 2019 22:07:31 +0000 (UTC) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) (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 472B11D72FD for ; Thu, 1 Aug 2019 22:07:30 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id x1so25236108wrr.9 for ; Thu, 01 Aug 2019 15:07:30 -0700 (PDT) Received: from archpc.localdomain (x8d1ee222.agdsn.tu-dresden.de. [141.30.226.34]) by smtp.gmail.com with ESMTPSA id t6sm83503303wmb.29.2019.08.01.15.07.26 for (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 01 Aug 2019 15:07:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=arTJJ/11/w3bNguq2UgvO17GS6Ozy8iM8NLS4ACuQHg=; b=IoC+EFdVz2LXqwjXosQrWkoOEDzkiEO4X04oVgn2ECIt0N79d4guJb7n1Opvdy8jHf 40RN2gEu1Mf2zsFxaIAnH+8ZYDyCBX9wjyCERmeAicyVWMqnr0D/XXC+llQ3ovHeb+1d ljDjAzB1op2/KbgUatZdcTwco3fhBj0v8j8bOsgGeQpq6Lut93/S0sfNlHSV61trfRU1 iW096ln+YZ/amlwt4p5xf8w5pvQb3C3UH8Y7VmWuja/EwZE9O8YyUSTca9RqBUZeEIru YRLcX4ykq1FbR/1/72By9+Jr2mL8RSG+O6ERbYGbJJAMhyHP4NkyJC+wP5pzgTvVgtJy TqBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=arTJJ/11/w3bNguq2UgvO17GS6Ozy8iM8NLS4ACuQHg=; b=ARcJPtWZjXW6HtcxWAKjsHMaqduEJ+tn4vJ67TWZZnd14ZP8rYKOrQhTqO3/5qI5g1 IljUagTxUxjcMQsKq8K18iH0PA2oy/gb7RhVhCdQ7MyhyviVZR37buFZMbiR3E2gMPX5 gGzdcSKf++iID32Ii/HvFD8OyQKcx9qaajH0mDcFK/DbMMftZtlhTe9K7wSMJrL/uaW+ Mv9/bJuKPqGVDi88Aq2n4pZCbQsbh3NwE+eCT8vsxtgj5nXUEUCbMZtJaIGinyu/d7qA 7xQbUeLQk5DHZNXef+W6sc6HnlD3e8RZD4Ca+qaEifMO2pvsP54TZ/xaeDIK7Uo/qJn4 PPhQ== X-Gm-Message-State: APjAAAWggKnHvAzaiAM8h5KeW3Vl7VmD4NOHezK8kxSsUPAIX1FnWGo0 UA0iHtKHXNCzhkaAHfYgFp6M3kJFJZmfQw== X-Google-Smtp-Source: APXvYqzdLyGK5jqS6hD2/hy3YBbFwq0dRhbNFniIl/GAVLRAeHU96NBXSA84h2buAtHp/O1KzMWx/Q== X-Received: by 2002:a5d:43d0:: with SMTP id v16mr137208573wrr.252.1564697248546; Thu, 01 Aug 2019 15:07:28 -0700 (PDT) From: Ilias Stamatis To: libvir-list@redhat.com Date: Fri, 2 Aug 2019 00:07:19 +0200 Message-Id: <20190801220719.10858-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.27]); Thu, 01 Aug 2019 22:07:30 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 01 Aug 2019 22:07:30 +0000 (UTC) for IP:'209.85.221.68' DOMAIN:'mail-wr1-f68.google.com' HELO:'mail-wr1-f68.google.com' FROM:'stamatis.iliass@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.1 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS) 209.85.221.68 mail-wr1-f68.google.com 209.85.221.68 mail-wr1-f68.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2] 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.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Thu, 01 Aug 2019 22:07:42 +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 aae9875194..0e0acf2baf 100755 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -7367,6 +7367,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 / 1= 0); + 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); + } + +#undef STATS_SET_PARAM + + cleanup: + virDomainObjEndAPI(&vm); + return ret; +} + + static int testDomainMemoryPeek(virDomainPtr dom, unsigned long long start, @@ -8697,6 +8750,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