From 5e6a2eea61587ea617ca9b6677ea1d7181132e12 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 16 Apr 2018 21:44:30 +0200 Subject: vm/qemu: add image_device config parameter For some configurations device is "sd" instead of "hda". --- vm/qemu/qemu.go | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/vm/qemu/qemu.go b/vm/qemu/qemu.go index 6ebf7e8ec..4173e2c6f 100644 --- a/vm/qemu/qemu.go +++ b/vm/qemu/qemu.go @@ -30,14 +30,15 @@ func init() { } type Config struct { - Count int // number of VMs to use - Qemu string // qemu binary name (qemu-system-arch by default) - Qemu_Args string // additional command line arguments for qemu binary - Kernel string // kernel for injected boot (e.g. arch/x86/boot/bzImage) - Cmdline string // kernel command line (can only be specified with kernel) - Initrd string // linux initial ramdisk. (optional) - CPU int // number of VM CPUs - Mem int // amount of VM memory in MBs + Count int // number of VMs to use + Qemu string // qemu binary name (qemu-system-arch by default) + Qemu_Args string // additional command line arguments for qemu binary + Kernel string // kernel for injected boot (e.g. arch/x86/boot/bzImage) + Cmdline string // kernel command line (can only be specified with kernel) + Initrd string // linux initial ramdisk. (optional) + Image_Device string // qemu image device (hda by default) + CPU int // number of VM CPUs + Mem int // amount of VM memory in MBs } type Pool struct { @@ -100,9 +101,10 @@ var archConfigs = map[string]archConfig{ func ctor(env *vmimpl.Env) (vmimpl.Pool, error) { archConfig := archConfigs[env.OS+"/"+env.Arch] cfg := &Config{ - Count: 1, - Qemu: archConfig.Qemu, - Qemu_Args: archConfig.QemuArgs, + Count: 1, + Image_Device: "hda", + Qemu: archConfig.Qemu, + Qemu_Args: archConfig.QemuArgs, } if err := config.LoadData(env.Config, cfg); err != nil { return nil, fmt.Errorf("failed to parse qemu vm config: %v", err) @@ -264,7 +266,7 @@ func (inst *instance) Boot() error { ) } else { args = append(args, - "-hda", inst.image, + "-"+inst.cfg.Image_Device, inst.image, "-snapshot", ) } -- cgit mrf-deployment