qemu: Add configuration structure to simplify LaunchQemu

LaunchQemu() now takes a Config structure that contains some more
descriptive fields than raw qemu parameter strings.

LaunchQemu is now simpler to call and more extensible as supporting more
qemu parameters would mean expanding Config instead of changing the API.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz
2016-09-12 15:02:17 +02:00
parent 5ccbaf2b59
commit 37a1f5003d
2 changed files with 75 additions and 6 deletions

View File

@@ -38,10 +38,10 @@ func Example() {
// resources
params = append(params, "-m", "370", "-smp", "cpus=2")
// LaunchQemu should return as soon as the instance has launched as we
// LaunchCustomQemu should return as soon as the instance has launched as we
// are using the --daemonize flag. It will set up a unix domain socket
// called /tmp/qmp-socket that we can use to manage the instance.
_, err := qemu.LaunchQemu(context.Background(), params, nil, nil)
_, err := qemu.LaunchCustomQemu(context.Background(), "", params, nil, nil)
if err != nil {
panic(err)
}