Skip to content

Commit

Permalink
vcsim: fix object.save when run directly against ESX
Browse files Browse the repository at this point in the history
QueryTpmAttestationReport is NotImplemented, vCenter only method.
  • Loading branch information
dougm committed Dec 12, 2024
1 parent 4aae3ca commit 7bde166
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
3 changes: 3 additions & 0 deletions govc/object/save.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ func (cmd *save) save(content []types.ObjectContent) error {
if fault.Is(err, &types.HostNotConnected{}) {
continue
}
if fault.Is(err, &types.NotSupported{}) {
continue
}
return err
}
dir := filepath.Join(cmd.dir, ref)
Expand Down
10 changes: 10 additions & 0 deletions govc/test/object.bats
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,16 @@ EOF
assert_equal 2 "$n" # LicenseManager + LicenseAssignmentManager
}

@test "object.save esx" {
vcsim_env -esx

dir="$BATS_TMPDIR/$(new_id)"
run govc object.save -v -d "$dir"
assert_success

rm -rf "$dir"
}

@test "tree" {
vcsim_start -dc 2 -folder 1 -pod 1 -nsx 1 -pool 2

Expand Down
12 changes: 9 additions & 3 deletions simulator/host_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,14 @@ func (h *HostSystem) ReconnectHostTask(ctx *Context, spec *types.ReconnectHost_T
}
}

func (s *HostSystem) QueryTpmAttestationReport(req *types.QueryTpmAttestationReport) soap.HasFault {
return &methods.QueryTpmAttestationReportBody{
Res: &s.QueryTpmAttestationReportResponse,
func (s *HostSystem) QueryTpmAttestationReport(ctx *Context, req *types.QueryTpmAttestationReport) soap.HasFault {
body := new(methods.QueryTpmAttestationReportBody)

if ctx.Map.IsVPX() {
body.Res = &s.QueryTpmAttestationReportResponse
} else {
body.Fault_ = Fault("", new(types.NotSupported))
}

return body
}

0 comments on commit 7bde166

Please sign in to comment.