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.
This commit is contained in:
parent
3eab3cc99b
commit
cd7d3812ea
|
@ -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…
Reference in New Issue