From 992b861ec576336b9d5becc8af6914f80175f279 Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Fri, 30 Sep 2016 15:54:46 +0200 Subject: [PATCH] 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 --- qemu.go | 7 +++++++ qemu_test.go | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/qemu.go b/qemu.go index 9cc7145f47..b5760141e1 100644 --- a/qemu.go +++ b/qemu.go @@ -669,6 +669,9 @@ type Knobs struct { // NoGraphic completely disables graphic output. NoGraphic bool + + // Daemonize will turn the qemu process into a daemon + Daemonize bool } // Config is the qemu configuration structure. @@ -912,6 +915,10 @@ func (config *Config) appendKnobs() { if config.Knobs.NoGraphic == true { 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. diff --git a/qemu_test.go b/qemu_test.go index 87e17ec9fe..18b016c62a 100644 --- a/qemu_test.go +++ b/qemu_test.go @@ -173,13 +173,14 @@ func TestAppendEmptyDevice(t *testing.T) { testAppend(device, "", t) } -var knobsString = "-no-user-config -nodefaults -nographic" +var knobsString = "-no-user-config -nodefaults -nographic -daemonize" func TestAppendKnobsAllTrue(t *testing.T) { knobs := Knobs{ NoUserConfig: true, NoDefaults: true, NoGraphic: true, + Daemonize: true, } testAppend(knobs, knobsString, t)