Commit 41b009dc authored by Anthony Spring's avatar Anthony Spring

Add disk mode configuration to allow users to specify the desired diskMode to...

Add disk mode configuration to allow users to specify the desired diskMode to ovftool: eagerZeroedThick , seSparse, thin and think.  Defaults to thick per current ovftool default.
parent 93f217c2
......@@ -20,6 +20,7 @@ type Config struct {
Cluster string `mapstructure:"cluster"`
Datacenter string `mapstructure:"datacenter"`
Datastore string `mapstructure:"datastore"`
DiskMode string `mapstructure:"diskmode"`
Host string `mapstructure:"host"`
Password string `mapstructure:"password"`
ResourcePool string `mapstructure:"resource_pool"`
......@@ -47,6 +48,11 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
}
p.config.tpl.UserVars = p.config.PackerUserVars
// Defaults
if p.config.DiskMode == "" {
p.config.DiskMode = "thick"
}
// Accumulate any errors
errs := new(packer.MultiError)
......@@ -59,6 +65,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
"cluster": &p.config.Cluster,
"datacenter": &p.config.Datacenter,
"datastore": &p.config.Datastore,
"diskmode": &p.config.DiskMode,
"host": &p.config.Host,
"vm_network": &p.config.VMNetwork,
"password": &p.config.Password,
......@@ -110,6 +117,7 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
"--acceptAllEulas",
fmt.Sprintf("--name=%s", p.config.VMName),
fmt.Sprintf("--datastore=%s", p.config.Datastore),
fmt.Sprintf("--diskMode=%s", p.config.DiskMode),
fmt.Sprintf("--network=%s", p.config.VMNetwork),
fmt.Sprintf("--vmFolder=%s", p.config.VMFolder),
fmt.Sprintf("%s", vmx),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment