mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-18 07:18:27 +00:00
Merge pull request #9 from devimc/qemu/extraOptions
qemu: add extra options for the machine type
This commit is contained in:
@@ -43,6 +43,10 @@ type Machine struct {
|
||||
|
||||
// Acceleration are the machine acceleration options to be used by qemu.
|
||||
Acceleration string
|
||||
|
||||
// Options are options for the machine type
|
||||
// For example gic-version=host and usb=off
|
||||
Options string
|
||||
}
|
||||
|
||||
// Device is the qemu device interface.
|
||||
@@ -1240,6 +1244,10 @@ func (config *Config) appendMachine() {
|
||||
machineParams = append(machineParams, fmt.Sprintf(",accel=%s", config.Machine.Acceleration))
|
||||
}
|
||||
|
||||
if config.Machine.Options != "" {
|
||||
machineParams = append(machineParams, fmt.Sprintf(",%s", config.Machine.Options))
|
||||
}
|
||||
|
||||
config.qemuParams = append(config.qemuParams, "-machine")
|
||||
config.qemuParams = append(config.qemuParams, strings.Join(machineParams, ""))
|
||||
}
|
||||
|
@@ -75,14 +75,20 @@ func testAppend(structure interface{}, expected string, t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
var machineString = "-machine pc-lite,accel=kvm,kernel_irqchip,nvdimm"
|
||||
|
||||
func TestAppendMachine(t *testing.T) {
|
||||
machineString := "-machine pc-lite,accel=kvm,kernel_irqchip,nvdimm"
|
||||
machine := Machine{
|
||||
Type: "pc-lite",
|
||||
Acceleration: "kvm,kernel_irqchip,nvdimm",
|
||||
}
|
||||
testAppend(machine, machineString, t)
|
||||
|
||||
machineString = "-machine pc-lite,accel=kvm,kernel_irqchip,nvdimm,gic-version=host,usb=off"
|
||||
machine = Machine{
|
||||
Type: "pc-lite",
|
||||
Acceleration: "kvm,kernel_irqchip,nvdimm",
|
||||
Options: "gic-version=host,usb=off",
|
||||
}
|
||||
testAppend(machine, machineString, t)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user