diff --git a/qemu/qemu.go b/qemu/qemu.go index 0b5adb2858..4b0e41795a 100644 --- a/qemu/qemu.go +++ b/qemu/qemu.go @@ -841,6 +841,9 @@ type SCSIController struct { // DisableModern prevents qemu from relying on fast MMIO. DisableModern bool + + // IOThread is the IO thread on which IO will be handled + IOThread string } // Valid returns true if the SCSIController structure is valid and complete. @@ -867,6 +870,9 @@ func (scsiCon SCSIController) QemuParams(config *Config) []string { if scsiCon.DisableModern { devParams = append(devParams, fmt.Sprintf("disable-modern=true")) } + if scsiCon.IOThread != "" { + devParams = append(devParams, fmt.Sprintf("iothread=%s", scsiCon.IOThread)) + } qemuParams = append(qemuParams, "-device") qemuParams = append(qemuParams, strings.Join(devParams, ",")) diff --git a/qemu/qemu_test.go b/qemu/qemu_test.go index 1c63e42bdb..0506f4240f 100644 --- a/qemu/qemu_test.go +++ b/qemu/qemu_test.go @@ -350,7 +350,7 @@ func TestVSOCKValid(t *testing.T) { } var deviceSCSIControllerStr = "-device virtio-scsi-pci,id=foo" -var deviceSCSIControllerBusAddrStr = "-device virtio-scsi-pci,id=foo,bus=pci.0,addr=00:04.0,disable-modern=true" +var deviceSCSIControllerBusAddrStr = "-device virtio-scsi-pci,id=foo,bus=pci.0,addr=00:04.0,disable-modern=true,iothread=iothread1" func TestAppendDeviceSCSIController(t *testing.T) { scsiCon := SCSIController{ @@ -361,6 +361,7 @@ func TestAppendDeviceSCSIController(t *testing.T) { scsiCon.Bus = "pci.0" scsiCon.Addr = "00:04.0" scsiCon.DisableModern = true + scsiCon.IOThread = "iothread1" testAppend(scsiCon, deviceSCSIControllerBusAddrStr, t) }