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:
Samuel Ortiz 2016-09-30 15:54:46 +02:00
parent 997cb23399
commit 992b861ec5
2 changed files with 9 additions and 1 deletions

View File

@ -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.

View File

@ -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)