mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-23 05:58:04 +00:00
qemu: Add microvm machine type support
Following on from #111 which added support for multiple virtio transports, add code to use virtio-mmio as the transport when booting a guest with the microvm machine type and add a microvm case when checking for NUMA support. Also add a test case for machine string parsing. Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
This commit is contained in:
parent
e969afbec5
commit
787c86b7e5
12
qemu/qemu.go
12
qemu/qemu.go
@ -51,6 +51,11 @@ type Machine struct {
|
|||||||
Options string
|
Options string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
// MachineTypeMicrovm is the QEMU microvm machine type for amd64
|
||||||
|
MachineTypeMicrovm string = "microvm"
|
||||||
|
)
|
||||||
|
|
||||||
// Device is the qemu device interface.
|
// Device is the qemu device interface.
|
||||||
type Device interface {
|
type Device interface {
|
||||||
Valid() bool
|
Valid() bool
|
||||||
@ -128,6 +133,10 @@ const (
|
|||||||
func isDimmSupported(config *Config) bool {
|
func isDimmSupported(config *Config) bool {
|
||||||
switch runtime.GOARCH {
|
switch runtime.GOARCH {
|
||||||
case "amd64", "386":
|
case "amd64", "386":
|
||||||
|
if config != nil && config.Machine.Type == MachineTypeMicrovm {
|
||||||
|
// microvm does not support NUMA
|
||||||
|
return false
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
@ -153,6 +162,9 @@ const (
|
|||||||
func (transport VirtioTransport) defaultTransport(config *Config) VirtioTransport {
|
func (transport VirtioTransport) defaultTransport(config *Config) VirtioTransport {
|
||||||
switch runtime.GOARCH {
|
switch runtime.GOARCH {
|
||||||
case "amd64", "386":
|
case "amd64", "386":
|
||||||
|
if config != nil && config.Machine.Type == MachineTypeMicrovm {
|
||||||
|
return TransportMMIO
|
||||||
|
}
|
||||||
return TransportPCI
|
return TransportPCI
|
||||||
case "s390x":
|
case "s390x":
|
||||||
return TransportCCW
|
return TransportCCW
|
||||||
|
@ -108,6 +108,14 @@ func TestAppendMachine(t *testing.T) {
|
|||||||
Options: "gic-version=host,usb=off",
|
Options: "gic-version=host,usb=off",
|
||||||
}
|
}
|
||||||
testAppend(machine, machineString, t)
|
testAppend(machine, machineString, t)
|
||||||
|
|
||||||
|
machineString = "-machine microvm,accel=kvm,pic=off,pit=off"
|
||||||
|
machine = Machine{
|
||||||
|
Type: "microvm",
|
||||||
|
Acceleration: "kvm",
|
||||||
|
Options: "pic=off,pit=off",
|
||||||
|
}
|
||||||
|
testAppend(machine, machineString, t)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAppendEmptyMachine(t *testing.T) {
|
func TestAppendEmptyMachine(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user