forked from vmware/govmomi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue vmware#192: HostSystem doesn't seem to be returning the correct…
… host.
- Loading branch information
Gavin Gray
committed
Jan 4, 2015
1 parent
7fd39a7
commit 1cbe968
Showing
3 changed files
with
42 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -312,11 +312,23 @@ func (f *Finder) HostSystemList(path ...string) ([]*govmomi.HostSystem, error) { | |
|
||
var hss []*govmomi.HostSystem | ||
for _, e := range es { | ||
var hs *govmomi.HostSystem | ||
|
||
switch o := e.Object.(type) { | ||
case mo.HostSystem: | ||
hs := govmomi.NewHostSystem(f.Client, o.Reference()) | ||
hss = append(hss, hs) | ||
hs = govmomi.NewHostSystem(f.Client, o.Reference()) | ||
case mo.ComputeResource: | ||
cr := govmomi.NewComputeResource(f.Client, o.Reference()) | ||
hosts, err := cr.Hosts() | ||
if err != nil { | ||
return nil, err | ||
} | ||
hs = govmomi.NewHostSystem(f.Client, hosts[0]) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
bitwisekaizen
Owner
|
||
default: | ||
continue | ||
} | ||
|
||
hss = append(hss, hs) | ||
} | ||
|
||
return hss, nil | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Should we add all hosts here, instead of just the first?