|
|
|
|
@ -66,6 +66,11 @@ var diskCache = map[string]bool{
|
|
|
|
|
"directsync": true,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var diskDiscard = map[string]bool{
|
|
|
|
|
"unmap": true,
|
|
|
|
|
"ignore": true,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Builder struct {
|
|
|
|
|
config Config
|
|
|
|
|
runner multistep.Runner
|
|
|
|
|
@ -79,6 +84,7 @@ type Config struct {
|
|
|
|
|
DiskInterface string `mapstructure:"disk_interface"`
|
|
|
|
|
DiskSize uint `mapstructure:"disk_size"`
|
|
|
|
|
DiskCache string `mapstructure:"disk_cache"`
|
|
|
|
|
DiskDiscard string `mapstructure:"disk_discard"`
|
|
|
|
|
FloppyFiles []string `mapstructure:"floppy_files"`
|
|
|
|
|
Format string `mapstructure:"format"`
|
|
|
|
|
Headless bool `mapstructure:"headless"`
|
|
|
|
|
@ -144,6 +150,10 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
|
|
|
|
b.config.DiskCache = "writeback"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if b.config.DiskDiscard == "" {
|
|
|
|
|
b.config.DiskDiscard = "ignore"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if b.config.Accelerator == "" {
|
|
|
|
|
b.config.Accelerator = "kvm"
|
|
|
|
|
}
|
|
|
|
|
@ -237,6 +247,11 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
|
|
|
|
errs, errors.New("unrecognized disk cache type"))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if _, ok := diskDiscard[b.config.DiskDiscard]; !ok {
|
|
|
|
|
errs = packer.MultiErrorAppend(
|
|
|
|
|
errs, errors.New("unrecognized disk cache type"))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if b.config.HTTPPortMin > b.config.HTTPPortMax {
|
|
|
|
|
errs = packer.MultiErrorAppend(
|
|
|
|
|
errs, errors.New("http_port_min must be less than http_port_max"))
|
|
|
|
|
|