Commit b5e551d9 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

Merge pull request #778 from aspring/vmware-post-processor-disk-mode

post-processor/vsphere: Add disk mode configuration to allow users to specify the desired diskMo...
parents be3f391e 41b009dc
...@@ -20,6 +20,7 @@ type Config struct { ...@@ -20,6 +20,7 @@ type Config struct {
Cluster string `mapstructure:"cluster"` Cluster string `mapstructure:"cluster"`
Datacenter string `mapstructure:"datacenter"` Datacenter string `mapstructure:"datacenter"`
Datastore string `mapstructure:"datastore"` Datastore string `mapstructure:"datastore"`
DiskMode string `mapstructure:"diskmode"`
Host string `mapstructure:"host"` Host string `mapstructure:"host"`
Password string `mapstructure:"password"` Password string `mapstructure:"password"`
ResourcePool string `mapstructure:"resource_pool"` ResourcePool string `mapstructure:"resource_pool"`
...@@ -47,6 +48,11 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { ...@@ -47,6 +48,11 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
} }
p.config.tpl.UserVars = p.config.PackerUserVars p.config.tpl.UserVars = p.config.PackerUserVars
// Defaults
if p.config.DiskMode == "" {
p.config.DiskMode = "thick"
}
// Accumulate any errors // Accumulate any errors
errs := new(packer.MultiError) errs := new(packer.MultiError)
...@@ -59,6 +65,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { ...@@ -59,6 +65,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error {
"cluster": &p.config.Cluster, "cluster": &p.config.Cluster,
"datacenter": &p.config.Datacenter, "datacenter": &p.config.Datacenter,
"datastore": &p.config.Datastore, "datastore": &p.config.Datastore,
"diskmode": &p.config.DiskMode,
"host": &p.config.Host, "host": &p.config.Host,
"vm_network": &p.config.VMNetwork, "vm_network": &p.config.VMNetwork,
"password": &p.config.Password, "password": &p.config.Password,
...@@ -110,6 +117,7 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac ...@@ -110,6 +117,7 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
"--acceptAllEulas", "--acceptAllEulas",
fmt.Sprintf("--name=%s", p.config.VMName), fmt.Sprintf("--name=%s", p.config.VMName),
fmt.Sprintf("--datastore=%s", p.config.Datastore), fmt.Sprintf("--datastore=%s", p.config.Datastore),
fmt.Sprintf("--diskMode=%s", p.config.DiskMode),
fmt.Sprintf("--network=%s", p.config.VMNetwork), fmt.Sprintf("--network=%s", p.config.VMNetwork),
fmt.Sprintf("--vmFolder=%s", p.config.VMFolder), fmt.Sprintf("--vmFolder=%s", p.config.VMFolder),
fmt.Sprintf("%s", vmx), 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