From 6691f801bf97bd6423f17e3f70a6ce0222e1e151 Mon Sep 17 00:00:00 2001 From: JeremyHuang Date: Mon, 20 Jun 2016 17:37:29 +0800 Subject: add a initrd flag for qemu type and display the qemu command. --- vm/qemu/qemu.go | 6 +++++- vm/vm.go | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'vm') diff --git a/vm/qemu/qemu.go b/vm/qemu/qemu.go index ab669b9b1..97ec1850d 100644 --- a/vm/qemu/qemu.go +++ b/vm/qemu/qemu.go @@ -5,6 +5,7 @@ package qemu import ( "fmt" + "log" "math/rand" "net" "os" @@ -142,14 +143,17 @@ func (inst *instance) Boot() error { "-smp", "sockets=2,cores=2,threads=1", "-usb", "-usbdevice", "mouse", "-usbdevice", "tablet", "-soundhw", "all", + "-initrd", inst.cfg.Initrd, } if inst.cfg.Kernel != "" { args = append(args, "-kernel", inst.cfg.Kernel, - "-append", "console=ttyS0 root=/dev/sda debug earlyprintk=serial slub_debug=UZ "+inst.cfg.Cmdline, + "-append", "\"console=ttyS0 root=/dev/sda debug earlyprintk=serial slub_debug=UZ\" "+inst.cfg.Cmdline, ) } qemu := exec.Command(inst.cfg.Bin, args...) + + log.Printf("qemu command : ", qemu.Args) qemu.Stdout = inst.wpipe qemu.Stderr = inst.wpipe if err := qemu.Start(); err != nil { diff --git a/vm/vm.go b/vm/vm.go index 8ac190264..49bec49a6 100644 --- a/vm/vm.go +++ b/vm/vm.go @@ -33,6 +33,7 @@ type Config struct { Index int Workdir string Bin string + Initrd string Kernel string Cmdline string Image string -- cgit mrf-deployment