mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 16:27:50 +00:00
Merge pull request #133 from amshinde/scsi-data-plane
iothread support for virtio-scsi
This commit is contained in:
commit
0e8b6dc049
4
Gopkg.lock
generated
4
Gopkg.lock
generated
@ -80,7 +80,7 @@
|
|||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/intel/govmm"
|
name = "github.com/intel/govmm"
|
||||||
packages = ["qemu"]
|
packages = ["qemu"]
|
||||||
revision = "82c67ab9b21e8cd0042b6c2d3be2d3705a511603"
|
revision = "1509acf1862ae5154c5c096f9318bd3eb434d816"
|
||||||
|
|
||||||
[[projects]]
|
[[projects]]
|
||||||
name = "github.com/kata-containers/agent"
|
name = "github.com/kata-containers/agent"
|
||||||
@ -244,6 +244,6 @@
|
|||||||
[solve-meta]
|
[solve-meta]
|
||||||
analyzer-name = "dep"
|
analyzer-name = "dep"
|
||||||
analyzer-version = 1
|
analyzer-version = 1
|
||||||
inputs-digest = "bb2ac1696f8e90526e492a6d54362549094fa844c17fbd06c727198bff6667ef"
|
inputs-digest = "f7c3a1b7f5cb5f891a3badcb7323f3b5fc0fa79f69dd6532ec2e2be2baafaf98"
|
||||||
solver-name = "gps-cdcl"
|
solver-name = "gps-cdcl"
|
||||||
solver-version = 1
|
solver-version = 1
|
||||||
|
@ -56,7 +56,7 @@
|
|||||||
|
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
name = "github.com/intel/govmm"
|
name = "github.com/intel/govmm"
|
||||||
revision = "82c67ab9b21e8cd0042b6c2d3be2d3705a511603"
|
revision = "1509acf1862ae5154c5c096f9318bd3eb434d816"
|
||||||
|
|
||||||
[[constraint]]
|
[[constraint]]
|
||||||
name = "github.com/kata-containers/agent"
|
name = "github.com/kata-containers/agent"
|
||||||
|
4
Makefile
4
Makefile
@ -101,6 +101,7 @@ DEFNETWORKMODEL := macvtap
|
|||||||
|
|
||||||
DEFDISABLEBLOCK := false
|
DEFDISABLEBLOCK := false
|
||||||
DEFBLOCKSTORAGEDRIVER := virtio-scsi
|
DEFBLOCKSTORAGEDRIVER := virtio-scsi
|
||||||
|
DEFENABLEIOTHREADS := false
|
||||||
DEFENABLEMEMPREALLOC := false
|
DEFENABLEMEMPREALLOC := false
|
||||||
DEFENABLEHUGEPAGES := false
|
DEFENABLEHUGEPAGES := false
|
||||||
DEFENABLESWAP := false
|
DEFENABLESWAP := false
|
||||||
@ -172,6 +173,7 @@ USER_VARS += DEFBRIDGES
|
|||||||
USER_VARS += DEFNETWORKMODEL
|
USER_VARS += DEFNETWORKMODEL
|
||||||
USER_VARS += DEFDISABLEBLOCK
|
USER_VARS += DEFDISABLEBLOCK
|
||||||
USER_VARS += DEFBLOCKSTORAGEDRIVER
|
USER_VARS += DEFBLOCKSTORAGEDRIVER
|
||||||
|
USER_VARS += DEFENABLEIOTHREADS
|
||||||
USER_VARS += DEFENABLEMEMPREALLOC
|
USER_VARS += DEFENABLEMEMPREALLOC
|
||||||
USER_VARS += DEFENABLEHUGEPAGES
|
USER_VARS += DEFENABLEHUGEPAGES
|
||||||
USER_VARS += DEFENABLESWAP
|
USER_VARS += DEFENABLESWAP
|
||||||
@ -263,6 +265,7 @@ const defaultBridgesCount uint32 = $(DEFBRIDGES)
|
|||||||
const defaultInterNetworkingModel = "$(DEFNETWORKMODEL)"
|
const defaultInterNetworkingModel = "$(DEFNETWORKMODEL)"
|
||||||
const defaultDisableBlockDeviceUse bool = $(DEFDISABLEBLOCK)
|
const defaultDisableBlockDeviceUse bool = $(DEFDISABLEBLOCK)
|
||||||
const defaultBlockDeviceDriver = "$(DEFBLOCKSTORAGEDRIVER)"
|
const defaultBlockDeviceDriver = "$(DEFBLOCKSTORAGEDRIVER)"
|
||||||
|
const defaultEnableIOThreads bool = $(DEFENABLEIOTHREADS)
|
||||||
const defaultEnableMemPrealloc bool = $(DEFENABLEMEMPREALLOC)
|
const defaultEnableMemPrealloc bool = $(DEFENABLEMEMPREALLOC)
|
||||||
const defaultEnableHugePages bool = $(DEFENABLEHUGEPAGES)
|
const defaultEnableHugePages bool = $(DEFENABLEHUGEPAGES)
|
||||||
const defaultEnableSwap bool = $(DEFENABLESWAP)
|
const defaultEnableSwap bool = $(DEFENABLESWAP)
|
||||||
@ -346,6 +349,7 @@ $(GENERATED_FILES): %: %.in Makefile VERSION
|
|||||||
-e "s|@DEFNETWORKMODEL@|$(DEFNETWORKMODEL)|g" \
|
-e "s|@DEFNETWORKMODEL@|$(DEFNETWORKMODEL)|g" \
|
||||||
-e "s|@DEFDISABLEBLOCK@|$(DEFDISABLEBLOCK)|g" \
|
-e "s|@DEFDISABLEBLOCK@|$(DEFDISABLEBLOCK)|g" \
|
||||||
-e "s|@DEFBLOCKSTORAGEDRIVER@|$(DEFBLOCKSTORAGEDRIVER)|g" \
|
-e "s|@DEFBLOCKSTORAGEDRIVER@|$(DEFBLOCKSTORAGEDRIVER)|g" \
|
||||||
|
-e "s|@DEFENABLEIOTHREADS@|$(DEFENABLEIOTHREADS)|g" \
|
||||||
-e "s|@DEFENABLEMEMPREALLOC@|$(DEFENABLEMEMPREALLOC)|g" \
|
-e "s|@DEFENABLEMEMPREALLOC@|$(DEFENABLEMEMPREALLOC)|g" \
|
||||||
-e "s|@DEFENABLEHUGEPAGES@|$(DEFENABLEHUGEPAGES)|g" \
|
-e "s|@DEFENABLEHUGEPAGES@|$(DEFENABLEHUGEPAGES)|g" \
|
||||||
-e "s|@DEFENABLEMSWAP@|$(DEFENABLESWAP)|g" \
|
-e "s|@DEFENABLEMSWAP@|$(DEFENABLESWAP)|g" \
|
||||||
|
@ -92,6 +92,7 @@ type hypervisor struct {
|
|||||||
Swap bool `toml:"enable_swap"`
|
Swap bool `toml:"enable_swap"`
|
||||||
Debug bool `toml:"enable_debug"`
|
Debug bool `toml:"enable_debug"`
|
||||||
DisableNestingChecks bool `toml:"disable_nesting_checks"`
|
DisableNestingChecks bool `toml:"disable_nesting_checks"`
|
||||||
|
EnableIOThreads bool `toml:"enable_iothreads"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type proxy struct {
|
type proxy struct {
|
||||||
@ -321,6 +322,7 @@ func newQemuHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) {
|
|||||||
Debug: h.Debug,
|
Debug: h.Debug,
|
||||||
DisableNestingChecks: h.DisableNestingChecks,
|
DisableNestingChecks: h.DisableNestingChecks,
|
||||||
BlockDeviceDriver: blockDriver,
|
BlockDeviceDriver: blockDriver,
|
||||||
|
EnableIOThreads: h.EnableIOThreads,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,6 +425,7 @@ func loadConfiguration(configPath string, ignoreLogging bool) (resolvedConfigPat
|
|||||||
Debug: defaultEnableDebug,
|
Debug: defaultEnableDebug,
|
||||||
DisableNestingChecks: defaultDisableNestingChecks,
|
DisableNestingChecks: defaultDisableNestingChecks,
|
||||||
BlockDeviceDriver: defaultBlockDeviceDriver,
|
BlockDeviceDriver: defaultBlockDeviceDriver,
|
||||||
|
EnableIOThreads: defaultEnableIOThreads,
|
||||||
}
|
}
|
||||||
|
|
||||||
err = config.InterNetworkModel.SetModel(defaultInterNetworkingModel)
|
err = config.InterNetworkModel.SetModel(defaultInterNetworkingModel)
|
||||||
|
@ -70,6 +70,12 @@ disable_block_device_use = @DEFDISABLEBLOCK@
|
|||||||
# virtio-blk.
|
# virtio-blk.
|
||||||
block_device_driver = "@DEFBLOCKSTORAGEDRIVER@"
|
block_device_driver = "@DEFBLOCKSTORAGEDRIVER@"
|
||||||
|
|
||||||
|
# Enable iothreads (data-plane) to be used. This causes IO to be
|
||||||
|
# handled in a separate IO thread. This is currently only implemented
|
||||||
|
# for SCSI.
|
||||||
|
#
|
||||||
|
enable_iothreads = @DEFENABLEIOTHREADS@
|
||||||
|
|
||||||
# Enable pre allocation of VM RAM, default false
|
# Enable pre allocation of VM RAM, default false
|
||||||
# Enabling this will result in lower container density
|
# Enabling this will result in lower container density
|
||||||
# as all of the memory will be allocated and locked
|
# as all of the memory will be allocated and locked
|
||||||
|
@ -41,7 +41,7 @@ type testRuntimeConfig struct {
|
|||||||
LogPath string
|
LogPath string
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeRuntimeConfigFileData(hypervisor, hypervisorPath, kernelPath, imagePath, kernelParams, machineType, shimPath, proxyPath, logPath string, disableBlock bool, blockDeviceDriver string) string {
|
func makeRuntimeConfigFileData(hypervisor, hypervisorPath, kernelPath, imagePath, kernelParams, machineType, shimPath, proxyPath, logPath string, disableBlock bool, blockDeviceDriver string, enableIOThreads bool) string {
|
||||||
return `
|
return `
|
||||||
# Runtime configuration file
|
# Runtime configuration file
|
||||||
|
|
||||||
@ -55,6 +55,7 @@ func makeRuntimeConfigFileData(hypervisor, hypervisorPath, kernelPath, imagePath
|
|||||||
default_vcpus = ` + strconv.FormatUint(uint64(defaultVCPUCount), 10) + `
|
default_vcpus = ` + strconv.FormatUint(uint64(defaultVCPUCount), 10) + `
|
||||||
default_memory = ` + strconv.FormatUint(uint64(defaultMemSize), 10) + `
|
default_memory = ` + strconv.FormatUint(uint64(defaultMemSize), 10) + `
|
||||||
disable_block_device_use = ` + strconv.FormatBool(disableBlock) + `
|
disable_block_device_use = ` + strconv.FormatBool(disableBlock) + `
|
||||||
|
enable_iothreads = ` + strconv.FormatBool(enableIOThreads) + `
|
||||||
|
|
||||||
[proxy.kata]
|
[proxy.kata]
|
||||||
path = "` + proxyPath + `"
|
path = "` + proxyPath + `"
|
||||||
@ -101,8 +102,9 @@ func createAllRuntimeConfigFiles(dir, hypervisor string) (config testRuntimeConf
|
|||||||
machineType := "machineType"
|
machineType := "machineType"
|
||||||
disableBlockDevice := true
|
disableBlockDevice := true
|
||||||
blockDeviceDriver := "virtio-scsi"
|
blockDeviceDriver := "virtio-scsi"
|
||||||
|
enableIOThreads := true
|
||||||
|
|
||||||
runtimeConfigFileData := makeRuntimeConfigFileData(hypervisor, hypervisorPath, kernelPath, imagePath, kernelParams, machineType, shimPath, proxyPath, logPath, disableBlockDevice, blockDeviceDriver)
|
runtimeConfigFileData := makeRuntimeConfigFileData(hypervisor, hypervisorPath, kernelPath, imagePath, kernelParams, machineType, shimPath, proxyPath, logPath, disableBlockDevice, blockDeviceDriver, enableIOThreads)
|
||||||
|
|
||||||
configPath := path.Join(dir, "runtime.toml")
|
configPath := path.Join(dir, "runtime.toml")
|
||||||
err = createConfig(configPath, runtimeConfigFileData)
|
err = createConfig(configPath, runtimeConfigFileData)
|
||||||
@ -140,6 +142,7 @@ func createAllRuntimeConfigFiles(dir, hypervisor string) (config testRuntimeConf
|
|||||||
BlockDeviceDriver: defaultBlockDeviceDriver,
|
BlockDeviceDriver: defaultBlockDeviceDriver,
|
||||||
DefaultBridges: defaultBridgesCount,
|
DefaultBridges: defaultBridgesCount,
|
||||||
Mlock: !defaultEnableSwap,
|
Mlock: !defaultEnableSwap,
|
||||||
|
EnableIOThreads: enableIOThreads,
|
||||||
}
|
}
|
||||||
|
|
||||||
agentConfig := vc.KataAgentConfig{}
|
agentConfig := vc.KataAgentConfig{}
|
||||||
@ -569,6 +572,7 @@ func TestNewQemuHypervisorConfig(t *testing.T) {
|
|||||||
imagePath := path.Join(dir, "image")
|
imagePath := path.Join(dir, "image")
|
||||||
machineType := "machineType"
|
machineType := "machineType"
|
||||||
disableBlock := true
|
disableBlock := true
|
||||||
|
enableIOThreads := true
|
||||||
|
|
||||||
hypervisor := hypervisor{
|
hypervisor := hypervisor{
|
||||||
Path: hypervisorPath,
|
Path: hypervisorPath,
|
||||||
@ -576,6 +580,7 @@ func TestNewQemuHypervisorConfig(t *testing.T) {
|
|||||||
Image: imagePath,
|
Image: imagePath,
|
||||||
MachineType: machineType,
|
MachineType: machineType,
|
||||||
DisableBlockDeviceUse: disableBlock,
|
DisableBlockDeviceUse: disableBlock,
|
||||||
|
EnableIOThreads: enableIOThreads,
|
||||||
}
|
}
|
||||||
|
|
||||||
files := []string{hypervisorPath, kernelPath, imagePath}
|
files := []string{hypervisorPath, kernelPath, imagePath}
|
||||||
@ -617,6 +622,10 @@ func TestNewQemuHypervisorConfig(t *testing.T) {
|
|||||||
t.Errorf("Expected value for disable block usage %v, got %v", disableBlock, config.DisableBlockDeviceUse)
|
t.Errorf("Expected value for disable block usage %v, got %v", disableBlock, config.DisableBlockDeviceUse)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if config.EnableIOThreads != enableIOThreads {
|
||||||
|
t.Errorf("Expected value for enable IOThreads %v, got %v", enableIOThreads, config.EnableIOThreads)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNewShimConfig(t *testing.T) {
|
func TestNewShimConfig(t *testing.T) {
|
||||||
|
@ -69,6 +69,7 @@ func makeRuntimeConfig(prefixDir string) (configFile string, config oci.RuntimeC
|
|||||||
proxyPath := filepath.Join(prefixDir, "proxy")
|
proxyPath := filepath.Join(prefixDir, "proxy")
|
||||||
disableBlock := true
|
disableBlock := true
|
||||||
blockStorageDriver := "virtio-scsi"
|
blockStorageDriver := "virtio-scsi"
|
||||||
|
enableIOThreads := true
|
||||||
|
|
||||||
// override
|
// override
|
||||||
defaultProxyPath = proxyPath
|
defaultProxyPath = proxyPath
|
||||||
@ -112,7 +113,9 @@ func makeRuntimeConfig(prefixDir string) (configFile string, config oci.RuntimeC
|
|||||||
testProxyURL,
|
testProxyURL,
|
||||||
logPath,
|
logPath,
|
||||||
disableBlock,
|
disableBlock,
|
||||||
blockStorageDriver)
|
blockStorageDriver,
|
||||||
|
enableIOThreads,
|
||||||
|
)
|
||||||
|
|
||||||
configFile = path.Join(prefixDir, "runtime.toml")
|
configFile = path.Join(prefixDir, "runtime.toml")
|
||||||
err = createConfig(configFile, runtimeConfig)
|
err = createConfig(configFile, runtimeConfig)
|
||||||
|
23
vendor/github.com/intel/govmm/qemu/qemu.go
generated
vendored
23
vendor/github.com/intel/govmm/qemu/qemu.go
generated
vendored
@ -841,6 +841,9 @@ type SCSIController struct {
|
|||||||
|
|
||||||
// DisableModern prevents qemu from relying on fast MMIO.
|
// DisableModern prevents qemu from relying on fast MMIO.
|
||||||
DisableModern bool
|
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.
|
// 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 {
|
if scsiCon.DisableModern {
|
||||||
devParams = append(devParams, fmt.Sprintf("disable-modern=true"))
|
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, "-device")
|
||||||
qemuParams = append(qemuParams, strings.Join(devParams, ","))
|
qemuParams = append(qemuParams, strings.Join(devParams, ","))
|
||||||
@ -1159,6 +1165,11 @@ type Knobs struct {
|
|||||||
Realtime bool
|
Realtime bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IOThread allows IO to be performed on a separate thread.
|
||||||
|
type IOThread struct {
|
||||||
|
ID string
|
||||||
|
}
|
||||||
|
|
||||||
// Config is the qemu configuration structure.
|
// Config is the qemu configuration structure.
|
||||||
// It allows for passing custom settings and parameters to the qemu API.
|
// It allows for passing custom settings and parameters to the qemu API.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
@ -1213,6 +1224,8 @@ type Config struct {
|
|||||||
// fds is a list of open file descriptors to be passed to the spawned qemu process
|
// fds is a list of open file descriptors to be passed to the spawned qemu process
|
||||||
fds []*os.File
|
fds []*os.File
|
||||||
|
|
||||||
|
IOThreads []IOThread
|
||||||
|
|
||||||
qemuParams []string
|
qemuParams []string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1481,6 +1494,15 @@ func (config *Config) appendBios() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (config *Config) appendIOThreads() {
|
||||||
|
for _, t := range config.IOThreads {
|
||||||
|
if t.ID != "" {
|
||||||
|
config.qemuParams = append(config.qemuParams, "-object")
|
||||||
|
config.qemuParams = append(config.qemuParams, fmt.Sprintf("iothread,id=%s", t.ID))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// LaunchQemu can be used to launch a new qemu instance.
|
// LaunchQemu can be used to launch a new qemu instance.
|
||||||
//
|
//
|
||||||
// The Config parameter contains a set of qemu parameters and settings.
|
// The Config parameter contains a set of qemu parameters and settings.
|
||||||
@ -1504,6 +1526,7 @@ func LaunchQemu(config Config, logger QMPLog) (string, error) {
|
|||||||
config.appendKnobs()
|
config.appendKnobs()
|
||||||
config.appendKernel()
|
config.appendKernel()
|
||||||
config.appendBios()
|
config.appendBios()
|
||||||
|
config.appendIOThreads()
|
||||||
|
|
||||||
if err := config.appendCPUs(); err != nil {
|
if err := config.appendCPUs(); err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
@ -201,6 +201,10 @@ type HypervisorConfig struct {
|
|||||||
// DisableBlockDeviceUse disallows a block device from being used.
|
// DisableBlockDeviceUse disallows a block device from being used.
|
||||||
DisableBlockDeviceUse bool
|
DisableBlockDeviceUse bool
|
||||||
|
|
||||||
|
// EnableIOThreads enables IO to be processed in a separate thread.
|
||||||
|
// Supported currently for virtio-scsi driver.
|
||||||
|
EnableIOThreads bool
|
||||||
|
|
||||||
// Debug changes the default hypervisor and kernel parameters to
|
// Debug changes the default hypervisor and kernel parameters to
|
||||||
// enable debug output where available.
|
// enable debug output where available.
|
||||||
Debug bool
|
Debug bool
|
||||||
|
@ -379,8 +379,9 @@ func (q *qemu) createPod(podConfig PodConfig) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var ioThread *govmmQemu.IOThread
|
||||||
if q.config.BlockDeviceDriver == VirtioSCSI {
|
if q.config.BlockDeviceDriver == VirtioSCSI {
|
||||||
devices = q.arch.appendSCSIController(devices)
|
devices, ioThread = q.arch.appendSCSIController(devices, q.config.EnableIOThreads)
|
||||||
}
|
}
|
||||||
|
|
||||||
cpuModel := q.arch.cpuModel()
|
cpuModel := q.arch.cpuModel()
|
||||||
@ -414,6 +415,10 @@ func (q *qemu) createPod(podConfig PodConfig) error {
|
|||||||
Bios: firmwarePath,
|
Bios: firmwarePath,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ioThread != nil {
|
||||||
|
qemuConfig.IOThreads = []govmmQemu.IOThread{*ioThread}
|
||||||
|
}
|
||||||
|
|
||||||
q.qemuConfig = qemuConfig
|
q.qemuConfig = qemuConfig
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -66,7 +66,7 @@ type qemuArch interface {
|
|||||||
appendImage(devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error)
|
appendImage(devices []govmmQemu.Device, path string) ([]govmmQemu.Device, error)
|
||||||
|
|
||||||
// appendSCSIController appens a SCSI controller to devices
|
// appendSCSIController appens a SCSI controller to devices
|
||||||
appendSCSIController(devices []govmmQemu.Device) []govmmQemu.Device
|
appendSCSIController(devices []govmmQemu.Device, enableIOThreads bool) ([]govmmQemu.Device, *govmmQemu.IOThread)
|
||||||
|
|
||||||
// appendBridges appends bridges to devices
|
// appendBridges appends bridges to devices
|
||||||
appendBridges(devices []govmmQemu.Device, bridges []Bridge) []govmmQemu.Device
|
appendBridges(devices []govmmQemu.Device, bridges []Bridge) []govmmQemu.Device
|
||||||
@ -300,15 +300,27 @@ func (q *qemuArchBase) appendImage(devices []govmmQemu.Device, path string) ([]g
|
|||||||
return q.appendBlockDevice(devices, drive), nil
|
return q.appendBlockDevice(devices, drive), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *qemuArchBase) appendSCSIController(devices []govmmQemu.Device) []govmmQemu.Device {
|
func (q *qemuArchBase) appendSCSIController(devices []govmmQemu.Device, enableIOThreads bool) ([]govmmQemu.Device, *govmmQemu.IOThread) {
|
||||||
scsiController := govmmQemu.SCSIController{
|
scsiController := govmmQemu.SCSIController{
|
||||||
ID: scsiControllerID,
|
ID: scsiControllerID,
|
||||||
DisableModern: q.nestedRun,
|
DisableModern: q.nestedRun,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var t *govmmQemu.IOThread
|
||||||
|
|
||||||
|
if enableIOThreads {
|
||||||
|
randBytes, _ := generateRandomBytes(8)
|
||||||
|
|
||||||
|
t = &govmmQemu.IOThread{
|
||||||
|
ID: fmt.Sprintf("%s-%s", "iothread", hex.EncodeToString(randBytes)),
|
||||||
|
}
|
||||||
|
|
||||||
|
scsiController.IOThread = t.ID
|
||||||
|
}
|
||||||
|
|
||||||
devices = append(devices, scsiController)
|
devices = append(devices, scsiController)
|
||||||
|
|
||||||
return devices
|
return devices, t
|
||||||
}
|
}
|
||||||
|
|
||||||
// appendBridges appends to devices the given bridges
|
// appendBridges appends to devices the given bridges
|
||||||
|
@ -470,6 +470,10 @@ func TestQemuArchBaseAppendSCSIController(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
devices = qemuArchBase.appendSCSIController(devices)
|
devices, ioThread := qemuArchBase.appendSCSIController(devices, false)
|
||||||
assert.Equal(expectedOut, devices)
|
assert.Equal(expectedOut, devices)
|
||||||
|
assert.Nil(ioThread)
|
||||||
|
|
||||||
|
_, ioThread = qemuArchBase.appendSCSIController(devices, true)
|
||||||
|
assert.NotNil(ioThread)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user