Skip to content

Commit

Permalink
Merge pull request #2026 from dougm/issue-2016
Browse files Browse the repository at this point in the history
vcsim: use HostNetworkSystem wrapper with -load flag
  • Loading branch information
dougm authored Jun 23, 2020
2 parents 7650349 + d7f4bba commit 736f1f8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions govc/test/vcsim.bats
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,9 @@ docker_name() {

objs=$(govc find / | wc -l)
assert_equal 23 "$objs"

run govc host.portgroup.add -host DC0_H0 -vswitch vSwitch0 bridge
assert_success # issue #2016
}

@test "vcsim trace file" {
Expand Down
10 changes: 10 additions & 0 deletions simulator/host_network_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ func NewHostNetworkSystem(host *mo.HostSystem) *HostNetworkSystem {
}
}

func (s *HostNetworkSystem) init(r *Registry) {
for _, obj := range r.objects {
if h, ok := obj.(*HostSystem); ok {
if h.ConfigManager.NetworkSystem.Value == s.Self.Value {
s.Host = &h.HostSystem
}
}
}
}

func (s *HostNetworkSystem) folder() *Folder {
f := Map.getEntityDatacenter(s.Host).NetworkFolder
return Map.Get(f).(*Folder)
Expand Down
1 change: 1 addition & 0 deletions simulator/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ var kinds = map[string]reflect.Type{
"GuestOperationsManager": reflect.TypeOf((*GuestOperationsManager)(nil)).Elem(),
"HostDatastoreBrowser": reflect.TypeOf((*HostDatastoreBrowser)(nil)).Elem(),
"HostLocalAccountManager": reflect.TypeOf((*HostLocalAccountManager)(nil)).Elem(),
"HostNetworkSystem": reflect.TypeOf((*HostNetworkSystem)(nil)).Elem(),
"HostSystem": reflect.TypeOf((*HostSystem)(nil)).Elem(),
"IpPoolManager": reflect.TypeOf((*IpPoolManager)(nil)).Elem(),
"LicenseManager": reflect.TypeOf((*LicenseManager)(nil)).Elem(),
Expand Down

0 comments on commit 736f1f8

Please sign in to comment.