Skip to content

Commit

Permalink
Merge pull request kata-containers#11 from devimc/scsi/disable_modern
Browse files Browse the repository at this point in the history
qemu: add DisableModern to SCSIController
  • Loading branch information
Mark Ryan committed Mar 6, 2018
2 parents d602561 + 68f3071 commit e87160f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions qemu/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,9 @@ type SCSIController struct {

// Addr is the PCI address offset, this is optional
Addr string

// DisableModern prevents qemu from relying on fast MMIO.
DisableModern bool
}

// Valid returns true if the SCSIController structure is valid and complete.
Expand All @@ -861,6 +864,9 @@ func (scsiCon SCSIController) QemuParams(config *Config) []string {
if scsiCon.Addr != "" {
devParams = append(devParams, fmt.Sprintf("addr=%s", scsiCon.Addr))
}
if scsiCon.DisableModern {
devParams = append(devParams, fmt.Sprintf("disable-modern=true"))
}

qemuParams = append(qemuParams, "-device")
qemuParams = append(qemuParams, strings.Join(devParams, ","))
Expand Down
3 changes: 2 additions & 1 deletion qemu/qemu_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,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"
var deviceSCSIControllerBusAddrStr = "-device virtio-scsi-pci,id=foo,bus=pci.0,addr=00:04.0,disable-modern=true"

func TestAppendDeviceSCSIController(t *testing.T) {
scsiCon := SCSIController{
Expand All @@ -356,6 +356,7 @@ func TestAppendDeviceSCSIController(t *testing.T) {

scsiCon.Bus = "pci.0"
scsiCon.Addr = "00:04.0"
scsiCon.DisableModern = true
testAppend(scsiCon, deviceSCSIControllerBusAddrStr, t)
}

Expand Down

0 comments on commit e87160f

Please sign in to comment.