Merge pull request #7357 from e-mow/issue-7140

Issue 7140
This commit is contained in:
Megan Marsh 2019-03-01 15:51:39 -08:00 committed by GitHub
commit eb98840f18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -68,7 +68,7 @@ func (d *ESX5Driver) Clone(dst, src string, linked bool) error {
return fmt.Errorf("Failed to copy the vmx file %s: %s", srcVmx, err)
}
filesToClone, err := d.run(nil, "find", strconv.Quote(srcDir), "! -name '*.vmdk' ! -name '*.vmx' -type f ! -size 0")
filesToClone, err := d.run(nil, "find", strconv.Quote(srcDir), "! -name '*.vmdk' ! -name '*.vmx' ! -name '*.vmxf' -type f ! -size 0")
if err != nil {
return fmt.Errorf("Failed to get the file list to copy: %s", err)
}

View File

@ -102,6 +102,17 @@ func (s *StepConfigureVMX) Run(_ context.Context, state multistep.StateBag) mult
}
}
// Set the extendedConfigFile setting for the .vmxf filename to the VMName
// if displayName is not set. This is needed so that when VMWare creates
// the .vmxf file it matches the displayName if it is set. When just using
// the sisplayName if it was empty VMWare would make a file named ".vmxf".
// The ".vmxf" file would not get deleted when the VM got deleted.
if s.DisplayName != "" {
vmxData["extendedconfigfile"] = fmt.Sprintf("%s.vmxf", s.DisplayName)
} else {
vmxData["extendedconfigfile"] = fmt.Sprintf("%s.vmxf", s.VMName)
}
err = WriteVMX(vmxPath, vmxData)
if err != nil {