Pass in any iso images to add as dvd drives during boot

This commit is contained in:
Taliesin Sisson 2015-07-12 17:19:29 +01:00
parent 3051ea6633
commit ef507c7bd7
1 changed files with 11 additions and 2 deletions

View File

@ -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,