If a specific IOThread is desired for a specific SCSI ``disk``, then multiple
controllers must be defined each having a specific ``iothread`` value. The
``iothread`` value must be within the range 1 to the domain iothreads value.
+``iothreads``
+ Supported for ``virtio-scsi`` controllers using ``address`` types ``pci`` and
+ ``ccw``. :since:`since 11.2.0 (QEMU 10.0).` Mutually exclusive with ``iothread``.
+
+ The optional ``iothreads`` sub-element allows specifying multiple IOThreads
+ via the ``iothread`` sub-element with attribute ``id`` the ``virtio-scsi``
+ controller will use for I/O operations. The virt queues (see ``queues``
+ attribute of ``driver``) are automatically distributed among the configured
+ iothreads.
+
+ Optionally the ``iothread`` element can have multiple ``queue``
+ subelements with mandatory ``id`` atribute specifying that the iothread
+ should be used to handle given virt queue. If queue mapping is present
+ the ``queues`` attribute of ``driver`` must be configured and all
+ configured virt queues must be included in the mapping. The
+ ``virtio-scsi`` device exposes request virt queues ``0`` to ``N-1`` where
+ N is the number of queues configured for the device.
+
+ Example::
+
+ <driver queues='4>
+ <iothreads>
+ <iothread id='2'/>
+ <iothread id='3'/>
+ </iothreads>
+ </driver>
+
+ <driver queues='3'>
+ <iothreads>
+ <iothread id='2'>
+ <queue id='1'/>
+ </iothread>
+ <iothread id='3'>
+ <queue id='0'/>
+ <queue id='2'/>
+ </iothread>
+ </iothreads>
+ </driver>
+
virtio options
For virtio controllers, `Virtio-related options`_ can
also be set. ( :since:`Since 3.5.0` )
if (!def)
return;
+ g_slist_free_full(def->iothreads, (GDestroyNotify) virDomainIothreadMappingDefFree);
+
virDomainDeviceInfoClear(&def->info);
g_free(def->virtio);
&def->iothread) < 0)
return NULL;
+ if (virDomainIothreadMappingDefParse(driver, &def->iothreads) < 0)
+ return NULL;
+
if (virDomainVirtioOptionsParseXML(driver, &def->virtio) < 0)
return NULL;
}
virDomainControllerDef *def)
{
g_auto(virBuffer) driverBuf = VIR_BUFFER_INITIALIZER;
+ g_auto(virBuffer) driverChildBuf = VIR_BUFFER_INIT_CHILD(buf);
if (def->queues)
virBufferAsprintf(&driverBuf, " queues='%u'", def->queues);
if (def->iothread)
virBufferAsprintf(&driverBuf, " iothread='%u'", def->iothread);
+ virDomainIothreadMappingDefFormat(&driverChildBuf, def->iothreads);
+
virDomainVirtioOptionsFormat(&driverBuf, def->virtio);
- virXMLFormatElement(buf, "driver", &driverBuf, NULL);
+ virXMLFormatElement(buf, "driver", &driverBuf, &driverChildBuf);
}
unsigned int max_sectors;
virTristateSwitch ioeventfd;
unsigned int iothread; /* unused = 0, > 0 specific thread # */
+ GSList *iothreads; /* List of virDomainIothreadMappingDef */
union {
virDomainVirtioSerialOpts vioserial;
virDomainPCIControllerOpts pciopts;
}
}
- if (controller->iothread != 0) {
+ if (controller->iothread != 0 || controller->iothreads) {
if (controller->type != VIR_DOMAIN_CONTROLLER_TYPE_SCSI ||
!(controller->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI ||
controller->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL ||
_("iothreads are supported only by 'virtio-scsi' controllers"));
return -1;
}
+
+ /* configuring both <driver iothread='n'> and it's <iothreads> sub-element
+ * isn't supported */
+ if (controller->iothread && controller->iothreads) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("controller driver 'iothread' attribute can't be used together with 'iothreads' subelement"));
+ return -1;
+ }
}
return 0;
<optional>
<ref name="driverIOThread"/>
</optional>
+ <optional>
+ <ref name="iothreadMapping"/>
+ </optional>
<ref name="virtioOptions"/>
</element>
</optional>
}
for (i = 0; i < def->ncontrollers; i++) {
- if (def->controllers[i]->iothread == iothread_id) {
+ if (virDomainIothreadMappingDefHasIothread(def->controllers[i]->iothreads, iothread_id) ||
+ def->controllers[i]->iothread == iothread_id) {
virReportError(VIR_ERR_INVALID_ARG,
_("cannot remove IOThread '%1$u' since it is being used by controller"),
iothread_id);