ESXi: Fix failure to get VM IP when `displayName` differs from `vm_name`

The value in the Name field returned by 'esxcli network vm list'
actually returns the VMs `displayName`. As such, we need to match
against `displayName` to discover the VMs 'WorldID'.
'WorldId' is ultimately used/needed as an argument in the command that
returns the VMs IP.
pull/6448/head
DanHam 8 years ago
parent 3eab3cc99b
commit cd7d3812ea
No known key found for this signature in database
GPG Key ID: 58E79AEDD6AA987E

@ -389,7 +389,13 @@ func (d *ESX5Driver) CommHost(state multistep.StateBag) (string, error) {
return "", err
}
record, err := r.find("Name", config.VMName)
// The value in the Name field returned by 'esxcli network vm list'
// corresponds directly to the value of displayName set in the VMX file
var displayName string
if v, ok := state.GetOk("display_name"); ok {
displayName = v.(string)
}
record, err := r.find("Name", displayName)
if err != nil {
return "", err
}

Loading…
Cancel
Save