|
|
|
|
@ -56,6 +56,14 @@ var diskInterface = map[string]bool{
|
|
|
|
|
"virtio": true,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var diskCache = map[string]bool{
|
|
|
|
|
"writethrough": true,
|
|
|
|
|
"writeback": true,
|
|
|
|
|
"none": true,
|
|
|
|
|
"unsafe": true,
|
|
|
|
|
"directsync": true,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Builder struct {
|
|
|
|
|
config config
|
|
|
|
|
runner multistep.Runner
|
|
|
|
|
@ -68,6 +76,7 @@ type config struct {
|
|
|
|
|
BootCommand []string `mapstructure:"boot_command"`
|
|
|
|
|
DiskInterface string `mapstructure:"disk_interface"`
|
|
|
|
|
DiskSize uint `mapstructure:"disk_size"`
|
|
|
|
|
DiskCache string `mapstructure:"disk_cache`
|
|
|
|
|
FloppyFiles []string `mapstructure:"floppy_files"`
|
|
|
|
|
Format string `mapstructure:"format"`
|
|
|
|
|
Headless bool `mapstructure:"headless"`
|
|
|
|
|
@ -126,6 +135,10 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
|
|
|
|
b.config.DiskSize = 40000
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if b.config.DiskCache == "" {
|
|
|
|
|
b.config.DiskCache = "writeback"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if b.config.Accelerator == "" {
|
|
|
|
|
b.config.Accelerator = "kvm"
|
|
|
|
|
}
|
|
|
|
|
@ -280,6 +293,11 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
|
|
|
|
|
errs, errors.New("unrecognized disk interface type"))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if _, ok := diskCache[b.config.DiskCache]; !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"))
|
|
|
|
|
|