diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-04-16 21:44:30 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-04-16 21:44:30 +0200 |
| commit | 5e6a2eea61587ea617ca9b6677ea1d7181132e12 (patch) | |
| tree | 0e38aaac2f2f9304f3c7db9566a7579cd161ec6c | |
| parent | 1bf59f052508d90788849dac6bc9d83a348d12d0 (diff) | |
vm/qemu: add image_device config parameter
For some configurations device is "sd" instead of "hda".
| -rw-r--r-- | vm/qemu/qemu.go | 26 |
1 files 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", ) } |
