mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 04:04:45 +00:00
qemu: Add the daemonize qemu option to the Knobs structure
This way callers can choose if they want the qemu process to be a daemon or not. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
997cb23399
commit
992b861ec5
7
qemu.go
7
qemu.go
@ -669,6 +669,9 @@ type Knobs struct {
|
|||||||
|
|
||||||
// NoGraphic completely disables graphic output.
|
// NoGraphic completely disables graphic output.
|
||||||
NoGraphic bool
|
NoGraphic bool
|
||||||
|
|
||||||
|
// Daemonize will turn the qemu process into a daemon
|
||||||
|
Daemonize bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Config is the qemu configuration structure.
|
// Config is the qemu configuration structure.
|
||||||
@ -912,6 +915,10 @@ func (config *Config) appendKnobs() {
|
|||||||
if config.Knobs.NoGraphic == true {
|
if config.Knobs.NoGraphic == true {
|
||||||
config.qemuParams = append(config.qemuParams, "-nographic")
|
config.qemuParams = append(config.qemuParams, "-nographic")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if config.Knobs.Daemonize == true {
|
||||||
|
config.qemuParams = append(config.qemuParams, "-daemonize")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// LaunchQemu can be used to launch a new qemu instance.
|
// LaunchQemu can be used to launch a new qemu instance.
|
||||||
|
@ -173,13 +173,14 @@ func TestAppendEmptyDevice(t *testing.T) {
|
|||||||
testAppend(device, "", t)
|
testAppend(device, "", t)
|
||||||
}
|
}
|
||||||
|
|
||||||
var knobsString = "-no-user-config -nodefaults -nographic"
|
var knobsString = "-no-user-config -nodefaults -nographic -daemonize"
|
||||||
|
|
||||||
func TestAppendKnobsAllTrue(t *testing.T) {
|
func TestAppendKnobsAllTrue(t *testing.T) {
|
||||||
knobs := Knobs{
|
knobs := Knobs{
|
||||||
NoUserConfig: true,
|
NoUserConfig: true,
|
||||||
NoDefaults: true,
|
NoDefaults: true,
|
||||||
NoGraphic: true,
|
NoGraphic: true,
|
||||||
|
Daemonize: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
testAppend(knobs, knobsString, t)
|
testAppend(knobs, knobsString, t)
|
||||||
|
Loading…
Reference in New Issue
Block a user