</iothreads>
</driver>
+ - The optional ``statistics`` sub-element allows configuring statistics
+ collection in configurable intervals for the given disk. Intervals are
+ configured by ``<statistic>`` sub-elements with ``interval`` attribute
+ configuring the collection window duration in seconds. The statistics
+ are available via the bulk statistics API.
+
+ Example::
+
+ <driver name='qemu'>
+ <statistics>
+ <statistic interval='1'/>
+ <statistic interval='10'/>
+ </statistics>
+ </driver>
+
+ :since:`Since 11.9.0 (QEMU 10.2, virtio, ide, scsi disks only)`.
+
- The optional ``queues`` attribute specifies the number of virt queues for
virtio-blk ( :since:`Since 3.9.0` ) or vhost-user-blk
( :since:`Since 7.1.0` )
virDomainDiskDefDriverParseXML(virDomainDiskDef *def,
xmlNodePtr cur)
{
+ xmlNodePtr statisticsNode;
+
def->driverName = virXMLPropString(cur, "name");
if (virXMLPropEnum(cur, "cache", virDomainDiskCacheTypeFromString,
if (virDomainIothreadMappingDefParse(cur, &def->iothreads) < 0)
return -1;
+ if ((statisticsNode = virXMLNodeGetSubelement(cur, "statistics"))) {
+ g_autoptr(GPtrArray) statisticNodes = NULL;
+
+ statisticNodes = virXMLNodeGetSubelementList(statisticsNode, "statistic");
+
+ if (statisticNodes->len > 0) {
+ size_t i;
+
+ def->statistics = g_new0(unsigned int, statisticNodes->len + 1);
+
+ for (i = 0; i < statisticNodes->len; i++) {
+ if (virXMLPropUInt(g_ptr_array_index(statisticNodes, i),
+ "interval", 10,
+ VIR_XML_PROP_REQUIRED | VIR_XML_PROP_NONZERO,
+ def->statistics + i) < 0)
+ return -1;
+ }
+ }
+ }
+
if (virXMLPropEnum(cur, "detect_zeroes",
virDomainDiskDetectZeroesTypeFromString,
VIR_XML_PROP_NONZERO, &def->detect_zeroes) < 0)
virDomainIothreadMappingDefFormat(&childBuf, disk->iothreads);
+ if (disk->statistics) {
+ g_auto(virBuffer) statisticsChildBuf = VIR_BUFFER_INIT_CHILD(&childBuf);
+ size_t i;
+
+ for (i = 0; disk->statistics[i] > 0; i++)
+ virBufferAsprintf(&statisticsChildBuf, "<statistic interval='%u'/>\n",
+ disk->statistics[i]);
+
+ virXMLFormatElement(&childBuf, "statistics", NULL, &statisticsChildBuf);
+ }
+
+
virXMLFormatElement(buf, "driver", &attrBuf, &childBuf);
}
virDomainDiskDiscard discard;
unsigned int iothread; /* unused = 0, > 0 specific thread # */
GSList *iothreads; /* List of virDomainIothreadMappingDef */
+ unsigned int *statistics; /* Optional, zero terminated list of intervals to
+ collect statistics for */
virDomainDiskDetectZeroes detect_zeroes;
virTristateSwitch discard_no_unref;
char *domain_name; /* backend domain name */