This commit adds a new option, `vmx_remove_ethernet_interfaces`, to both
of the VMWare builders. This is useful when building Vagrant boxes,
since Vagrant now produces output such as:
```
WARNING: The VMX file for this box contains a setting that is
automatically overwritten by Vagrant when started. Vagrant will stop
overwriting this setting in an upcoming release which may pre vent
proper networking setup. Below is the detected VMX setting:
ethernet0.pcislotnumber = "33"
If networking fails to properly configure, it may require this VMX
setting. It can be manually applied via the Vagrantfile:
Vagrant.configure(2) do |config|
config.vm.provider :vmware_fusion do |vmware|
vmware.vmx["ethernet0.pcislotnumber"] = "33"
end
end
```
This can be avoided entirely by removing the ethernet adapters from the
VMX file prior to packaging as a Vagrant box, in which case adapters are
created as expected according to the Vagrantfile specification.
PR #2309 introduced case-sensitive options in VMX files. This is to support a case-sensitive option called `virtualSSD`. The change made all options case-sensitive, which causes problems with external VMX options provided in user templates. To prevent breakage, this change is being reverted.
- Fixes#2574
- Reverts #2542
- Reverts #2309
We need to ensure the VMWare process has exited before attempting to run VMX file cleanup steps, otherwise VMWare may overwrite our changes. While Packer does its best to ensure VMWare has exited, there's still a race condition on some OSs between VMWare flushing the VMX and Packer updating it. The workaround is to artifically wait 5 seconds.
When using the VMX builder its possible for the source machine to have a floppy and/or CD-ROM mounted which gets cloned to the new VM Packer spins up, but have no Packer configuration for those devices. With this change we always attempt to remove the mounted devices regardless of the Packer configuration.
When using the VMX builder its possible for the source machine to have a floppy configured which gets cloned to the new VM Packer spins up. When the new VM's Packer config doesn't have a floppy_files config entry, the Packer clean VMX step fails to remove the floppy disk from the new VM. This can cause build failures, for example with the vsphere post processor; generating errors like:
* Post-processor failed: Failed: exit status 1
Error: File (/home/teamcity/tmp/buildTmp/packer941120499) could not be found.
Opening the cloned VM's VMX file you can clearly see it has a floppy entry from the source machine's VMX file (exact same path) even though the Packer config contains no floppy_files entry.