From 65db6be6b93ca8df6ec70508a6701fe62b091a8a Mon Sep 17 00:00:00 2001 From: Rowan Potgieter Date: Sat, 6 Oct 2018 14:40:43 +0200 Subject: [PATCH] Fix for #6804 The user QEMU args may overwrite the default -device. This results in no network --- builder/qemu/step_run.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/builder/qemu/step_run.go b/builder/qemu/step_run.go index c524d5514..a805f71c6 100644 --- a/builder/qemu/step_run.go +++ b/builder/qemu/step_run.go @@ -217,6 +217,13 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error } } + // Check if we are missing the netDevice #6804 + if x, ok := inArgs["-device"]; ok { + if !strings.Contains(strings.Join(x, ""), config.NetDevice) { + inArgs["-device"] = append(inArgs["-device"], fmt.Sprintf("%s,netdev=user.0", config.NetDevice)) + } + } + // Flatten to array of strings outArgs := make([]string, 0) for key, values := range inArgs {