From nobody Tue Oct 28 17:31:52 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1760024547; cv=none; d=zohomail.com; s=zohoarc; b=JRu6mKHbbYV3cVeRoCXkZOdW1VfrpilC9IzcSi0vEGbcc4+ztjeS+3R+43uridq3eqchGDVJRvIWcdZflGXq1NYK2gAVKbHXISdWMHBjsr2D1iqCbeoIGHnXa7Mu7KI3QFi+UQdtFAuc1XRshRXXgSe0NyleTD+DeJdovpelUyQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1760024547; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=P/ftEzwY4RB5wg+7JlR8q6OrAsSqIsz/GraiTtj9t58=; b=S7HW9B/m8ixcwzHWN+sv3taY4REy8vJ/u4cBLeEC6UbjONHwn7f56lOVdB1I0wRzNEKfxFf0hV1VKTCBwhP3IqpYQo7VXPmeXdbffZDUtyUxoyT+mPKTwKlW6BzFP5sMKsTi1cruISGx85TLNLgu+1vZpRjcTQgctlpiaTK5DZY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1760024547644737.4532236871502; Thu, 9 Oct 2025 08:42:27 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id A0820418C8; Thu, 9 Oct 2025 11:42:25 -0400 (EDT) Received: from [172.19.199.20] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 38CF643F5B; Thu, 9 Oct 2025 11:18:09 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id A45AE44AB5; Thu, 9 Oct 2025 11:17:57 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 391CD44285 for ; Thu, 9 Oct 2025 11:16:41 -0400 (EDT) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-653-UuwmTwD2O3mD_rzp30eynQ-1; Thu, 09 Oct 2025 11:16:39 -0400 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 907881956089 for ; Thu, 9 Oct 2025 15:16:38 +0000 (UTC) Received: from speedmetal.lan (unknown [10.44.22.12]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C7D6E1955F22 for ; Thu, 9 Oct 2025 15:16:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1760023000; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=P/ftEzwY4RB5wg+7JlR8q6OrAsSqIsz/GraiTtj9t58=; b=QkILp4ggWGiPM+vj4HRO7KLHeDzMiip0Vp7xj9JXo3AfH6yE/cOaCEuKWeG1ZM5wI6NOpU 4xH5rQXHHlh5CB4iZxk1EZ7ckAnRDa1gHbZc/CXJBbGaxkkCmznNS5ww4OBZwn54p54oqY XmefZ2AyzH6PziofLTJWeVfqpxCafAI= X-MC-Unique: UuwmTwD2O3mD_rzp30eynQ-1 X-Mimecast-MFC-AGG-ID: UuwmTwD2O3mD_rzp30eynQ_1760022998 To: devel@lists.libvirt.org Subject: [RFC PATCH 15/16] conf: Add configuration option for timed disk statistics collection Date: Thu, 9 Oct 2025 17:16:15 +0200 Message-ID: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 51A3dhj80YLl5UYYftnrE2HNfKqNAS8UF19v9DPwQsg_1760022998 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: WPDBCOB6ISCQNQNRKR4JTV4VEOJCTYHY X-Message-ID-Hash: WPDBCOB6ISCQNQNRKR4JTV4VEOJCTYHY X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1760024551515154100 Content-Type: text/plain; charset="utf-8" From: Peter Krempa QEMU supports collection of disk statistics in configurable time windows. Add support for enabling this feature to the conf parser. Signed-off-by: Peter Krempa --- docs/formatdomain.rst | 17 ++++++++++++++++ src/conf/domain_conf.c | 34 +++++++++++++++++++++++++++++++ src/conf/domain_conf.h | 2 ++ src/conf/schemas/domaincommon.rng | 11 ++++++++++ 4 files changed, 64 insertions(+) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index f50dce477f..f46a21463f 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -3588,6 +3588,23 @@ paravirtualized driver is specified via the ``disk``= element. + - The optional ``statistics`` sub-element allows configuring statistics + collection in configurable intervals for the given disk. Intervals are + configured by ```` sub-elements with ``interval`` attribute + configuring the collection window duration in seconds. The statistics + are available via the bulk statistics API. + + Example:: + + + + + + + + + :since:`Since 11.9.0 (QEMU 10.2, virtio, ide, scsi disks only)`. + - The optional ``queues`` attribute specifies the number of virt queue= s for virtio-blk ( :since:`Since 3.9.0` ) or vhost-user-blk ( :since:`Since 7.1.0` ) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 281846dfbe..b6832d193a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8288,6 +8288,8 @@ static int virDomainDiskDefDriverParseXML(virDomainDiskDef *def, xmlNodePtr cur) { + xmlNodePtr statisticsNode; + def->driverName =3D virXMLPropString(cur, "name"); if (virXMLPropEnum(cur, "cache", virDomainDiskCacheTypeFromString, @@ -8337,6 +8339,26 @@ virDomainDiskDefDriverParseXML(virDomainDiskDef *def, if (virDomainIothreadMappingDefParse(cur, &def->iothreads) < 0) return -1; + if ((statisticsNode =3D virXMLNodeGetSubelement(cur, "statistics"))) { + g_autoptr(GPtrArray) statisticNodes =3D NULL; + + statisticNodes =3D virXMLNodeGetSubelementList(statisticsNode, "st= atistic"); + + if (statisticNodes->len > 0) { + size_t i; + + def->statistics =3D g_new0(unsigned int, statisticNodes->len += 1); + + for (i =3D 0; i < statisticNodes->len; i++) { + if (virXMLPropUInt(g_ptr_array_index(statisticNodes, i), + "interval", 10, + VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NO= NZERO, + def->statistics + i) < 0) + return -1; + } + } + } + if (virXMLPropEnum(cur, "detect_zeroes", virDomainDiskDetectZeroesTypeFromString, VIR_XML_PROP_NONZERO, &def->detect_zeroes) < 0) @@ -23826,6 +23848,18 @@ virDomainDiskDefFormatDriver(virBuffer *buf, virDomainIothreadMappingDefFormat(&childBuf, disk->iothreads); + if (disk->statistics) { + g_auto(virBuffer) statisticsChildBuf =3D VIR_BUFFER_INIT_CHILD(&ch= ildBuf); + size_t i; + + for (i =3D 0; disk->statistics[i] > 0; i++) + virBufferAsprintf(&statisticsChildBuf, "\n", + disk->statistics[i]); + + virXMLFormatElement(&childBuf, "statistics", NULL, &statisticsChil= dBuf); + } + + virXMLFormatElement(buf, "driver", &attrBuf, &childBuf); } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 39807b5fe3..4110ca75ac 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -591,6 +591,8 @@ struct _virDomainDiskDef { virDomainDiskDiscard discard; unsigned int iothread; /* unused =3D 0, > 0 specific thread # */ GSList *iothreads; /* List of virDomainIothreadMappingDef */ + unsigned int *statistics; /* Optional, zero terminated list of interva= ls to + collect statistics for */ virDomainDiskDetectZeroes detect_zeroes; virTristateSwitch discard_no_unref; char *domain_name; /* backend domain name */ diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index b9230a35b4..1303c392ae 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -2742,6 +2742,17 @@ + + + + + + + + + + + --=20 2.51.0