Skip to content

Commit 7bde166

Browse files
committed
vcsim: fix object.save when run directly against ESX
QueryTpmAttestationReport is NotImplemented, vCenter only method.
1 parent 4aae3ca commit 7bde166

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

govc/object/save.go

+3
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ func (cmd *save) save(content []types.ObjectContent) error {
212212
if fault.Is(err, &types.HostNotConnected{}) {
213213
continue
214214
}
215+
if fault.Is(err, &types.NotSupported{}) {
216+
continue
217+
}
215218
return err
216219
}
217220
dir := filepath.Join(cmd.dir, ref)

govc/test/object.bats

+10
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,16 @@ EOF
750750
assert_equal 2 "$n" # LicenseManager + LicenseAssignmentManager
751751
}
752752

753+
@test "object.save esx" {
754+
vcsim_env -esx
755+
756+
dir="$BATS_TMPDIR/$(new_id)"
757+
run govc object.save -v -d "$dir"
758+
assert_success
759+
760+
rm -rf "$dir"
761+
}
762+
753763
@test "tree" {
754764
vcsim_start -dc 2 -folder 1 -pod 1 -nsx 1 -pool 2
755765

simulator/host_system.go

+9-3
Original file line numberDiff line numberDiff line change
@@ -595,8 +595,14 @@ func (h *HostSystem) ReconnectHostTask(ctx *Context, spec *types.ReconnectHost_T
595595
}
596596
}
597597

598-
func (s *HostSystem) QueryTpmAttestationReport(req *types.QueryTpmAttestationReport) soap.HasFault {
599-
return &methods.QueryTpmAttestationReportBody{
600-
Res: &s.QueryTpmAttestationReportResponse,
598+
func (s *HostSystem) QueryTpmAttestationReport(ctx *Context, req *types.QueryTpmAttestationReport) soap.HasFault {
599+
body := new(methods.QueryTpmAttestationReportBody)
600+
601+
if ctx.Map.IsVPX() {
602+
body.Res = &s.QueryTpmAttestationReportResponse
603+
} else {
604+
body.Fault_ = Fault("", new(types.NotSupported))
601605
}
606+
607+
return body
602608
}

0 commit comments

Comments
 (0)