From 4892d041e7889beccb7f3b128d86eadc66ee70c4 Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Mon, 12 Sep 2016 19:13:52 +0200 Subject: [PATCH] qemu: Add a Global parameter field to the Config structure The Global string represents the set of default Device driver properties we want qemu to use. This is mostly useful for automatically created devices. Signed-off-by: Samuel Ortiz --- qemu.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/qemu.go b/qemu.go index bef338735e..0013e6a449 100644 --- a/qemu.go +++ b/qemu.go @@ -205,6 +205,9 @@ type Config struct { // SMP is the quest multi processors configuration. SMP SMP + // GlobalParam is the -global parameter + GlobalParam string + // ExtraParams is a slice of options to pass to qemu. ExtraParams []string @@ -433,6 +436,15 @@ func appendRTC(params []string, config Config) []string { return params } +func appendGlobalParam(params []string, config Config) []string { + if config.GlobalParam != "" { + params = append(params, "-global") + params = append(params, config.GlobalParam) + } + + return params +} + func appendKernel(params []string, config Config) []string { if config.Kernel.Path != "" { params = append(params, "-kernel") @@ -472,6 +484,7 @@ func LaunchQemu(config Config, logger QMPLog) (string, error) { params = appendObjects(params, config) params = appendRTC(params, config) params = appendKernel(params, config) + params = appendGlobalParam(params, config) params = append(params, config.ExtraParams...)