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 <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz 2016-09-12 19:13:52 +02:00
parent 612a5a9e5d
commit 4892d041e7

13
qemu.go
View File

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