Skip to content

Commit

Permalink
Merge pull request #3233 from dougm/issue-3221
Browse files Browse the repository at this point in the history
vcsim: set HostSystem.Config.Host
  • Loading branch information
dougm authored Sep 28, 2023
2 parents f859a94 + d49e401 commit 20719b2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions simulator/cluster_compute_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ func (add *addHost) Run(task *Task) (types.AnyType, types.BaseMethodFault) {

task.ctx.Map.PutEntity(cr, task.ctx.Map.NewEntity(host))
host.Summary.Host = &host.Self
host.Config.Host = host.Self

cr.Host = append(cr.Host, host.Reference())
addComputeResource(cr.Summary.GetComputeResourceSummary(), host)
Expand Down
1 change: 1 addition & 0 deletions simulator/host_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,7 @@ func CreateStandaloneHost(ctx *Context, f *Folder, spec types.HostConnectSpec) (

ctx.Map.PutEntity(cr, ctx.Map.NewEntity(host))
host.Summary.Host = &host.Self
host.Config.Host = host.Self

ctx.Map.PutEntity(cr, ctx.Map.NewEntity(pool))

Expand Down
13 changes: 13 additions & 0 deletions simulator/host_system_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/vmware/govmomi/find"
"github.com/vmware/govmomi/object"
"github.com/vmware/govmomi/simulator/esx"
"github.com/vmware/govmomi/vim25"
"github.com/vmware/govmomi/vim25/types"
)

Expand Down Expand Up @@ -70,6 +71,18 @@ func TestDefaultESX(t *testing.T) {
}
}

func TestDefaultVPX(t *testing.T) {
Test(func(ctx context.Context, c *vim25.Client) {
for _, e := range Map.All("HostSystem") {
host := e.(*HostSystem)
// issue #3221
if host.Config.Host != host.Self {
t.Errorf("config.host=%s", host.Config.Host)
}
}
})
}

func TestMaintenanceMode(t *testing.T) {
ctx := context.Background()
m := ESX()
Expand Down

0 comments on commit 20719b2

Please sign in to comment.