mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-03 17:47:15 +03:00
qemu: Add 'iothread' to command line for supported controller
https://bugzilla.redhat.com/show_bug.cgi?id=1286709 Now that we have all the pieces in place, we can add the 'iothread=#' to the command line for the (two) controllers that support it (virtio-scsi-pci and virtio-scsi-ccw). Add the tests as well...
This commit is contained in:
parent
ade5dae282
commit
d0b5845952
@ -2191,6 +2191,65 @@ qemuBuildUSBControllerDevStr(const virDomainDef *domainDef,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* qemuCheckSCSIControllerIOThreads:
|
||||||
|
* @domainDef: Pointer to domain def
|
||||||
|
* @def: Pointer to controller def
|
||||||
|
* @qemuCaps: Capabilities
|
||||||
|
*
|
||||||
|
* If this controller definition has iothreads set, let's make sure the
|
||||||
|
* configuration is right before adding to the command line
|
||||||
|
*
|
||||||
|
* Returns true if either supported or there are no iothreads for controller;
|
||||||
|
* otherwise, returns false if configuration is not quite right.
|
||||||
|
*/
|
||||||
|
static bool
|
||||||
|
qemuCheckSCSIControllerIOThreads(const virDomainDef *domainDef,
|
||||||
|
virDomainControllerDefPtr def,
|
||||||
|
virQEMUCapsPtr qemuCaps)
|
||||||
|
{
|
||||||
|
if (!def->iothread)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
/* By this time QEMU_CAPS_OBJECT_IOTHREAD was already checked.
|
||||||
|
* We just need to check if the QEMU_CAPS_VIRTIO_SCSI_IOTHREAD
|
||||||
|
* capability is set.
|
||||||
|
*/
|
||||||
|
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI_IOTHREAD)) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("IOThreads for virtio-scsi not supported for "
|
||||||
|
"this QEMU"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (def->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("IOThreads only supported for virtio-scsi "
|
||||||
|
"controllers model is '%s'"),
|
||||||
|
virDomainControllerModelSCSITypeToString(def->model));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
|
||||||
|
def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("IOThreads only available for virtio pci and "
|
||||||
|
"virtio ccw controllers"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Can we find the controller iothread in the iothreadid list? */
|
||||||
|
if (!virDomainIOThreadIDFind(domainDef, def->iothread)) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||||
|
_("controller iothread '%u' not defined in iothreadid"),
|
||||||
|
def->iothread);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
qemuBuildControllerDevStr(const virDomainDef *domainDef,
|
qemuBuildControllerDevStr(const virDomainDef *domainDef,
|
||||||
virDomainControllerDefPtr def,
|
virDomainControllerDefPtr def,
|
||||||
@ -2238,16 +2297,31 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
|
|||||||
case VIR_DOMAIN_CONTROLLER_TYPE_SCSI:
|
case VIR_DOMAIN_CONTROLLER_TYPE_SCSI:
|
||||||
switch (model) {
|
switch (model) {
|
||||||
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI:
|
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI:
|
||||||
if (def->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)
|
if (def->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
|
||||||
virBufferAddLit(&buf, "virtio-scsi-ccw");
|
virBufferAddLit(&buf, "virtio-scsi-ccw");
|
||||||
else if (def->info.type ==
|
if (def->iothread) {
|
||||||
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390)
|
if (!qemuCheckSCSIControllerIOThreads(domainDef,
|
||||||
|
def, qemuCaps))
|
||||||
|
goto error;
|
||||||
|
virBufferAsprintf(&buf, ",iothread=iothread%u",
|
||||||
|
def->iothread);
|
||||||
|
}
|
||||||
|
} else if (def->info.type ==
|
||||||
|
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390) {
|
||||||
virBufferAddLit(&buf, "virtio-scsi-s390");
|
virBufferAddLit(&buf, "virtio-scsi-s390");
|
||||||
else if (def->info.type ==
|
} else if (def->info.type ==
|
||||||
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO)
|
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO) {
|
||||||
virBufferAddLit(&buf, "virtio-scsi-device");
|
virBufferAddLit(&buf, "virtio-scsi-device");
|
||||||
else
|
} else {
|
||||||
virBufferAddLit(&buf, "virtio-scsi-pci");
|
virBufferAddLit(&buf, "virtio-scsi-pci");
|
||||||
|
if (def->iothread) {
|
||||||
|
if (!qemuCheckSCSIControllerIOThreads(domainDef,
|
||||||
|
def, qemuCaps))
|
||||||
|
goto error;
|
||||||
|
virBufferAsprintf(&buf, ",iothread=iothread%u",
|
||||||
|
def->iothread);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC:
|
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC:
|
||||||
virBufferAddLit(&buf, "lsi");
|
virBufferAddLit(&buf, "lsi");
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
LC_ALL=C \
|
||||||
|
PATH=/bin \
|
||||||
|
HOME=/home/test \
|
||||||
|
USER=test \
|
||||||
|
LOGNAME=test \
|
||||||
|
QEMU_AUDIO_DRV=none \
|
||||||
|
/usr/bin/qemu \
|
||||||
|
-name QEMUGuest1 \
|
||||||
|
-S \
|
||||||
|
-M s390-ccw \
|
||||||
|
-m 214 \
|
||||||
|
-smp 1 \
|
||||||
|
-object iothread,id=iothread1 \
|
||||||
|
-object iothread,id=iothread2 \
|
||||||
|
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
||||||
|
-nographic \
|
||||||
|
-nodefaults \
|
||||||
|
-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
|
||||||
|
-no-acpi \
|
||||||
|
-boot c \
|
||||||
|
-device virtio-scsi-ccw,iothread=iothread2,id=scsi0,devno=fe.0.0001 \
|
||||||
|
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
|
||||||
|
-device virtio-blk-ccw,iothread=iothread1,devno=fe.0.0000,\
|
||||||
|
drive=drive-virtio-disk0,id=virtio-disk0 \
|
||||||
|
-drive file=/dev/HostVG/QEMUGuest2,format=raw,if=none,id=drive-scsi0-0-2-0 \
|
||||||
|
-device scsi-disk,bus=scsi0.0,channel=0,scsi-id=2,lun=0,drive=drive-scsi0-0-2-0,\
|
||||||
|
id=scsi0-0-2-0 \
|
||||||
|
-device virtio-balloon-ccw,id=balloon0,devno=fe.0.000a
|
@ -0,0 +1,32 @@
|
|||||||
|
LC_ALL=C \
|
||||||
|
PATH=/bin \
|
||||||
|
HOME=/home/test \
|
||||||
|
USER=test \
|
||||||
|
LOGNAME=test \
|
||||||
|
QEMU_AUDIO_DRV=none \
|
||||||
|
/usr/bin/qemu \
|
||||||
|
-name QEMUGuest1 \
|
||||||
|
-S \
|
||||||
|
-M pc \
|
||||||
|
-m 214 \
|
||||||
|
-smp 2 \
|
||||||
|
-object iothread,id=iothread1 \
|
||||||
|
-object iothread,id=iothread2 \
|
||||||
|
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
||||||
|
-nographic \
|
||||||
|
-nodefaults \
|
||||||
|
-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
|
||||||
|
-no-acpi \
|
||||||
|
-boot c \
|
||||||
|
-device virtio-scsi-pci,iothread=iothread2,id=scsi0,bus=pci.0,addr=0xb \
|
||||||
|
-usb \
|
||||||
|
-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
|
||||||
|
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
|
||||||
|
-drive file=/var/lib/libvirt/images/iothrtest1.img,format=raw,if=none,\
|
||||||
|
id=drive-virtio-disk1 \
|
||||||
|
-device virtio-blk-pci,iothread=iothread1,bus=pci.0,addr=0x4,\
|
||||||
|
drive=drive-virtio-disk1,id=virtio-disk1 \
|
||||||
|
-drive file=/var/lib/libvirt/images/iothrtest2.img,format=raw,if=none,\
|
||||||
|
id=drive-scsi0-0-0-3 \
|
||||||
|
-device scsi-disk,bus=scsi0.0,channel=0,scsi-id=0,lun=3,drive=drive-scsi0-0-0-3,\
|
||||||
|
id=scsi0-0-0-3
|
@ -1257,6 +1257,12 @@ mymain(void)
|
|||||||
DO_TEST("iothreads-disk", QEMU_CAPS_OBJECT_IOTHREAD);
|
DO_TEST("iothreads-disk", QEMU_CAPS_OBJECT_IOTHREAD);
|
||||||
DO_TEST("iothreads-disk-virtio-ccw", QEMU_CAPS_OBJECT_IOTHREAD,
|
DO_TEST("iothreads-disk-virtio-ccw", QEMU_CAPS_OBJECT_IOTHREAD,
|
||||||
QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
|
QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
|
||||||
|
DO_TEST("iothreads-virtio-scsi-pci", QEMU_CAPS_VIRTIO_SCSI,
|
||||||
|
QEMU_CAPS_OBJECT_IOTHREAD,
|
||||||
|
QEMU_CAPS_VIRTIO_SCSI_IOTHREAD);
|
||||||
|
DO_TEST("iothreads-virtio-scsi-ccw", QEMU_CAPS_OBJECT_IOTHREAD,
|
||||||
|
QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI_IOTHREAD,
|
||||||
|
QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
|
||||||
|
|
||||||
DO_TEST("cpu-topology1", QEMU_CAPS_SMP_TOPOLOGY);
|
DO_TEST("cpu-topology1", QEMU_CAPS_SMP_TOPOLOGY);
|
||||||
DO_TEST("cpu-topology2", QEMU_CAPS_SMP_TOPOLOGY);
|
DO_TEST("cpu-topology2", QEMU_CAPS_SMP_TOPOLOGY);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user