From ef507c7bd7944636287e09e346039fa742ead841 Mon Sep 17 00:00:00 2001 From: Taliesin Sisson Date: Sun, 12 Jul 2015 17:19:29 +0100 Subject: [PATCH] Pass in any iso images to add as dvd drives during boot --- builder/hyperv/iso/builder.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/builder/hyperv/iso/builder.go b/builder/hyperv/iso/builder.go index e918d3b5e..e1b2282f8 100644 --- a/builder/hyperv/iso/builder.go +++ b/builder/hyperv/iso/builder.go @@ -149,7 +149,7 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { if b.config.VMName == "" { b.config.VMName = fmt.Sprintf("packer-%s-{{timestamp}}", b.config.PackerBuildName) - } + } log.Println(fmt.Sprintf("%s: %v", "VMName", b.config.VMName)) @@ -171,6 +171,13 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) { b.config.Generation = 1 } + if b.config.Generation == 2 { + if len(b.config.SecondaryDvdImages) > 0 { + err = errors.New("Generation 2 vms don't support floppy drives. Use ISO image instead.") + errs = packer.MultiErrorAppend(errs, err) + } + } + log.Println(fmt.Sprintf("Using switch %s", b.config.SwitchName)) log.Println(fmt.Sprintf("%s: %v", "SwitchName", b.config.SwitchName)) @@ -301,7 +308,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe }, &hypervcommon.StepMountFloppydrive{}, - &hypervcommon.StepMountSecondaryDvdImages{}, + &hypervcommon.StepMountSecondaryDvdImages{ + Files: b.config.SecondaryDvdImages, + }, &hypervcommon.StepRun{ BootWait: b.config.BootWait,