From 0d07960f3e051bd8a439558095fb6f4aba81500e Mon Sep 17 00:00:00 2001 From: Matthew Baker Date: Tue, 29 Jul 2014 07:40:29 -0700 Subject: [PATCH 1/5] Disabling SDL gui mode --- builder/qemu/step_run.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/builder/qemu/step_run.go b/builder/qemu/step_run.go index 858c8424c..b4687ff7c 100644 --- a/builder/qemu/step_run.go +++ b/builder/qemu/step_run.go @@ -61,7 +61,6 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error sshHostPort := state.Get("sshHostPort").(uint) ui := state.Get("ui").(packer.Ui) - guiArgument := "sdl" vnc := fmt.Sprintf("0.0.0.0:%d", vncPort-5900) vmName := config.VMName imgPath := filepath.Join(config.OutputDir, @@ -71,13 +70,12 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error ui.Message("WARNING: The VM will be started in headless mode, as configured.\n" + "In headless mode, errors during the boot sequence or OS setup\n" + "won't be easily visible. Use at your own discretion.") - guiArgument = "none" } defaultArgs := make(map[string]string) defaultArgs["-name"] = vmName - defaultArgs["-machine"] = fmt.Sprintf("type=pc-1.0,accel=%s", config.Accelerator) - defaultArgs["-display"] = guiArgument + // defaultArgs["-machine"] = fmt.Sprintf("type=pc,accel=%s", config.Accelerator) + // defaultArgs["-machine"] = "type=pc" defaultArgs["-netdev"] = "user,id=user.0" defaultArgs["-device"] = fmt.Sprintf("%s,netdev=user.0", config.NetDevice) defaultArgs["-drive"] = fmt.Sprintf("file=%s,if=%s", imgPath, config.DiskInterface) From c87c88fce21f5404e2f25c0193a4d566627e8448 Mon Sep 17 00:00:00 2001 From: Matthew Baker Date: Tue, 29 Jul 2014 07:41:07 -0700 Subject: [PATCH 2/5] OEL available net device --- builder/qemu/builder.go | 1 + 1 file changed, 1 insertion(+) diff --git a/builder/qemu/builder.go b/builder/qemu/builder.go index 7f404a566..248f4a5a2 100644 --- a/builder/qemu/builder.go +++ b/builder/qemu/builder.go @@ -26,6 +26,7 @@ var netDevice = map[string]bool{ "pcnet": true, "virtio": true, "virtio-net": true, + "virtio-net-pci": true, "usb-net": true, "i82559a": true, "i82559b": true, From 9220d644d147acdba4157d267d5ad62ae0ae2935 Mon Sep 17 00:00:00 2001 From: Matthew Baker Date: Wed, 6 Aug 2014 02:43:38 -0700 Subject: [PATCH 3/5] Making graphics and hardware virtualisation optional and configurable --- builder/qemu/step_run.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/builder/qemu/step_run.go b/builder/qemu/step_run.go index b4687ff7c..7624ab68f 100644 --- a/builder/qemu/step_run.go +++ b/builder/qemu/step_run.go @@ -66,16 +66,23 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error imgPath := filepath.Join(config.OutputDir, fmt.Sprintf("%s.%s", vmName, strings.ToLower(config.Format))) + defaultArgs := make(map[string]string) + if config.Headless == true { ui.Message("WARNING: The VM will be started in headless mode, as configured.\n" + "In headless mode, errors during the boot sequence or OS setup\n" + "won't be easily visible. Use at your own discretion.") + } else { + defaultArgs["-display"] = "sdl" } - defaultArgs := make(map[string]string) defaultArgs["-name"] = vmName - // defaultArgs["-machine"] = fmt.Sprintf("type=pc,accel=%s", config.Accelerator) - // defaultArgs["-machine"] = "type=pc" + if config.Accelerator != "none" { + defaultArgs["-machine"] = fmt.Sprintf("type=pc,accel=%s", config.Accelerator) + } else { + ui.Message("WARNING: The VM will be started with no hardware acceleration.\n" + + "The installation will take considerably longer to finish\n") + } defaultArgs["-netdev"] = "user,id=user.0" defaultArgs["-device"] = fmt.Sprintf("%s,netdev=user.0", config.NetDevice) defaultArgs["-drive"] = fmt.Sprintf("file=%s,if=%s", imgPath, config.DiskInterface) From 99d15abfd2ba2afe49201f51c2039cdeedea16ce Mon Sep 17 00:00:00 2001 From: Matthew Baker Date: Thu, 7 Aug 2014 02:51:24 -0700 Subject: [PATCH 4/5] adding allowed values for accelerator --- builder/qemu/builder.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builder/qemu/builder.go b/builder/qemu/builder.go index 248f4a5a2..a3ea940c1 100644 --- a/builder/qemu/builder.go +++ b/builder/qemu/builder.go @@ -250,9 +250,9 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { errs, errors.New("invalid format, only 'qcow2' or 'raw' are allowed")) } - if !(b.config.Accelerator == "kvm" || b.config.Accelerator == "xen") { + if !(b.config.Accelerator == "kvm" || b.config.Accelerator == "xen" || b.config.Accelerator == "none") { errs = packer.MultiErrorAppend( - errs, errors.New("invalid format, only 'kvm' or 'xen' are allowed")) + errs, errors.New("invalid format, only 'kvm' or 'xen' or 'none' are allowed")) } if _, ok := netDevice[b.config.NetDevice]; !ok { From b8c13d3e4d72eb0b72d103f079a95fba21571666 Mon Sep 17 00:00:00 2001 From: Matthew Baker Date: Thu, 7 Aug 2014 04:08:50 -0700 Subject: [PATCH 5/5] Keeping the -machine type=pc if accelerator method set to "none" --- builder/qemu/step_run.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/builder/qemu/step_run.go b/builder/qemu/step_run.go index 7624ab68f..67be8ae6d 100644 --- a/builder/qemu/step_run.go +++ b/builder/qemu/step_run.go @@ -77,12 +77,14 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error } defaultArgs["-name"] = vmName + accelMethod := "" if config.Accelerator != "none" { - defaultArgs["-machine"] = fmt.Sprintf("type=pc,accel=%s", config.Accelerator) + accelMethod = fmt.Sprintf(",accel=%s", config.Accelerator) } else { ui.Message("WARNING: The VM will be started with no hardware acceleration.\n" + - "The installation will take considerably longer to finish\n") + "The installation may take considerably longer to finish\n") } + defaultArgs["-machine"] = fmt.Sprintf("type=pc%s", accelMethod) defaultArgs["-netdev"] = "user,id=user.0" defaultArgs["-device"] = fmt.Sprintf("%s,netdev=user.0", config.NetDevice) defaultArgs["-drive"] = fmt.Sprintf("file=%s,if=%s", imgPath, config.DiskInterface)