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,