diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index d01a887cc5..97794b77ea 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3005,6 +3005,10 @@
<controller type='virtio-serial' index='1'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
</controller>
+ <controller type='scsi' index='0' model='virtio-scsi'>
+ <driver iothread='4'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/>
+ </controller>
...
</devices>
...
@@ -3092,6 +3096,23 @@
I/O asynchronous handling or not. Accepted values are
"on" and "off". Since 1.2.18
+
iothread
+
+ Supported for controller type scsi
using model
+ virtio-scsi
for address
types
+ pci
and ccw
+ since 1.3.5 (QEMU 2.4) .
+
+ The optional iothread
attribute assigns the controller
+ to an IOThread as defined by the range for the domain
+ iothreads
+ value. Each SCSI disk
assigned to use the specified
+ controller
will utilize the same IOThread. 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.
+
USB companion controllers have an optional
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 966e9317fd..273715ced2 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1899,6 +1899,9 @@
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 81621b93d8..2c97bc1747 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4250,6 +4250,20 @@ virDomainDeviceDefPostParseInternal(virDomainDeviceDefPtr dev,
}
}
}
+
+ if (dev->type == VIR_DOMAIN_DEVICE_CONTROLLER) {
+ virDomainControllerDefPtr cdev = dev->data.controller;
+
+ if (cdev->iothread &&
+ cdev->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("'iothread' attribute only supported for "
+ "controller model '%s'"),
+ virDomainControllerModelSCSITypeToString(VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI));
+ return -1;
+ }
+ }
+
return 0;
}
@@ -7857,6 +7871,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
char *ioeventfd = NULL;
char *portsStr = NULL;
int ports = -1;
+ char *iothread = NULL;
xmlNodePtr saved = ctxt->node;
int rc;
@@ -7901,6 +7916,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
cmd_per_lun = virXMLPropString(cur, "cmd_per_lun");
max_sectors = virXMLPropString(cur, "max_sectors");
ioeventfd = virXMLPropString(cur, "ioeventfd");
+ iothread = virXMLPropString(cur, "iothread");
} else if (xmlStrEqual(cur->name, BAD_CAST "model")) {
if (processedModel) {
virReportError(VIR_ERR_XML_ERROR, "%s",
@@ -7962,6 +7978,14 @@ virDomainControllerDefParseXML(xmlNodePtr node,
goto error;
}
+ if (iothread) {
+ if (virStrToLong_uip(iothread, NULL, 10, &def->iothread) < 0) {
+ virReportError(VIR_ERR_XML_ERROR,
+ _("Invalid 'iothread' value '%s'"), iothread);
+ goto error;
+ }
+ }
+
if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
def->model == VIR_DOMAIN_CONTROLLER_MODEL_USB_NONE) {
VIR_DEBUG("Ignoring device address for none model usb controller");
@@ -8147,6 +8171,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
VIR_FREE(busNr);
VIR_FREE(ioeventfd);
VIR_FREE(portsStr);
+ VIR_FREE(iothread);
return def;
@@ -19490,6 +19515,7 @@ virDomainControllerDefFormat(virBufferPtr buf,
if (pciModel || pciTarget ||
def->queues || def->cmd_per_lun || def->max_sectors || def->ioeventfd ||
+ def->iothread ||
virDomainDeviceInfoNeedsFormat(&def->info, flags) || pcihole64) {
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
@@ -19532,7 +19558,7 @@ virDomainControllerDefFormat(virBufferPtr buf,
}
if (def->queues || def->cmd_per_lun ||
- def->max_sectors || def->ioeventfd) {
+ def->max_sectors || def->ioeventfd || def->iothread) {
virBufferAddLit(buf, "queues)
virBufferAsprintf(buf, " queues='%u'", def->queues);
@@ -19547,6 +19573,10 @@ virDomainControllerDefFormat(virBufferPtr buf,
virBufferAsprintf(buf, " ioeventfd='%s'",
virTristateSwitchTypeToString(def->ioeventfd));
}
+
+ if (def->iothread)
+ virBufferAsprintf(buf, " iothread='%u'", def->iothread);
+
virBufferAddLit(buf, "/>\n");
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 583b3b4d2b..b7b099c5a9 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -861,6 +861,7 @@ struct _virDomainControllerDef {
unsigned int cmd_per_lun;
unsigned int max_sectors;
int ioeventfd; /* enum virTristateSwitch */
+ unsigned int iothread; /* unused = 0, > 0 specific thread # */
union {
virDomainVirtioSerialOpts vioserial;
virDomainPCIControllerOpts pciopts;
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-iothreads-virtio-scsi-ccw.xml b/tests/qemuxml2argvdata/qemuxml2argv-iothreads-virtio-scsi-ccw.xml
new file mode 100644
index 0000000000..2499782431
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-iothreads-virtio-scsi-ccw.xml
@@ -0,0 +1,39 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 219136
+ 1
+ 2
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-iothreads-virtio-scsi-pci.xml b/tests/qemuxml2argvdata/qemuxml2argv-iothreads-virtio-scsi-pci.xml
new file mode 100644
index 0000000000..b427bccaab
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-iothreads-virtio-scsi-pci.xml
@@ -0,0 +1,47 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 219136
+ 2
+ 2
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-virtio-scsi-ccw.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-virtio-scsi-ccw.xml
new file mode 100644
index 0000000000..5e91f1c4aa
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-virtio-scsi-ccw.xml
@@ -0,0 +1,40 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 219136
+ 1
+ 2
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-virtio-scsi-pci.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-virtio-scsi-pci.xml
new file mode 100644
index 0000000000..d8306d4304
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-virtio-scsi-pci.xml
@@ -0,0 +1,51 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 219136
+ 2
+ 2
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index a68bd25c46..5a43fa9f91 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -512,6 +512,13 @@ mymain(void)
DO_TEST("iothreads-disk");
DO_TEST_FULL("iothreads-disk-virtio-ccw", WHEN_ACTIVE,
QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
+ DO_TEST_FULL("iothreads-virtio-scsi-pci", WHEN_ACTIVE,
+ QEMU_CAPS_NODEFCONFIG,
+ QEMU_CAPS_VIRTIO_SCSI);
+ DO_TEST_FULL("iothreads-virtio-scsi-ccw", WHEN_ACTIVE,
+ QEMU_CAPS_VIRTIO_SCSI,
+ QEMU_CAPS_VIRTIO_CCW,
+ QEMU_CAPS_VIRTIO_S390);
DO_TEST("lease");
DO_TEST("event_idx");
DO_TEST("vhost_queues");