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...
This commit is contained in:
Mitchell Hashimoto 2014-04-21 21:07:58 -07:00
commit b5e551d930
1 changed files with 8 additions and 0 deletions

View File

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