From 32c3865507a0b0f0f753a7864efdf192b2f2ed9b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Jun 2023 05:01:22 +0000 Subject: [PATCH] build(deps): bump github.com/vmware/govmomi from 0.29.0 to 0.30.5 Bumps [github.com/vmware/govmomi](https://github.com/vmware/govmomi) from 0.29.0 to 0.30.5. - [Release notes](https://github.com/vmware/govmomi/releases) - [Changelog](https://github.com/vmware/govmomi/blob/main/CHANGELOG.md) - [Commits](https://github.com/vmware/govmomi/compare/v0.29.0...v0.30.5) --- updated-dependencies: - dependency-name: github.com/vmware/govmomi dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 +- vendor/github.com/vmware/govmomi/CONTRIBUTORS | 41 ++++++++++- .../github.com/vmware/govmomi/cns/client.go | 13 ++++ .../vmware/govmomi/cns/methods/methods.go | 20 ++++++ .../vmware/govmomi/cns/types/enum.go | 5 ++ .../vmware/govmomi/cns/types/types.go | 36 +++++++++- .../github.com/vmware/govmomi/find/finder.go | 14 ++-- .../vmware/govmomi/govc/flags/debug.go | 3 + .../vmware/govmomi/govc/flags/library.go | 2 +- .../vmware/govmomi/govc/flags/output.go | 10 ++- .../vmware/govmomi/govc/host/esxcli/esxcli.go | 4 ++ .../vmware/govmomi/govc/vm/change.go | 6 ++ .../vmware/govmomi/govc/vm/console.go | 2 +- .../govmomi/internal/version/version.go | 2 +- .../github.com/vmware/govmomi/list/lister.go | 4 +- .../vmware/govmomi/object/search_index.go | 13 +++- .../govmomi/object/virtual_device_list.go | 8 ++- .../vmware/govmomi/task/history_collector.go | 13 ++-- .../vmware/govmomi/vapi/internal/internal.go | 4 +- .../vmware/govmomi/vapi/library/library.go | 24 ++++--- .../govmomi/vapi/library/library_item.go | 11 ++- .../govmomi/vapi/library/security_policy.go | 63 ++++++++++++++++ .../vapi/library/trusted_certificates.go | 70 ++++++++++++++++++ .../vmware/govmomi/vim25/soap/client.go | 36 ++++++++-- .../vmware/govmomi/vim25/types/helpers.go | 72 +++++++++++++++++++ .../vmware/govmomi/vim25/types/types.go | 24 +++---- .../vmware/govmomi/vim25/types/unreleased.go | 16 ++--- vendor/modules.txt | 2 +- 29 files changed, 453 insertions(+), 71 deletions(-) create mode 100644 vendor/github.com/vmware/govmomi/vapi/library/security_policy.go create mode 100644 vendor/github.com/vmware/govmomi/vapi/library/trusted_certificates.go diff --git a/go.mod b/go.mod index a1e6ef977..d65fb1b15 100644 --- a/go.mod +++ b/go.mod @@ -41,7 +41,7 @@ require ( github.com/spf13/cobra v1.7.0 github.com/stretchr/testify v1.8.3 github.com/ubccr/kerby v0.0.0-20170626144437-201a958fc453 - github.com/vmware/govmomi v0.29.0 + github.com/vmware/govmomi v0.30.5 golang.org/x/exp v0.0.0-20230307190834-24139beb5833 golang.org/x/oauth2 v0.8.0 golang.org/x/sync v0.2.0 diff --git a/go.sum b/go.sum index 051a1dbaa..093c71dcd 100644 --- a/go.sum +++ b/go.sum @@ -1340,8 +1340,8 @@ github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17 github.com/vishvananda/netns v0.0.0-20200728191858-db3c7e526aae/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= github.com/vmihailenco/msgpack/v4 v4.3.12 h1:07s4sz9IReOgdikxLTKNbBdqDMLsjPKXwvCazn8G65U= github.com/vmihailenco/tagparser v0.1.1 h1:quXMXlA39OCbd2wAdTsGDlK9RkOk6Wuw+x37wVyIuWY= -github.com/vmware/govmomi v0.29.0 h1:SHJQ7DUc4fltFZv16znJNGHR1/XhiDK5iKxm2OqwkuU= -github.com/vmware/govmomi v0.29.0/go.mod h1:F7adsVewLNHsW/IIm7ziFURaXDaHEwcc+ym4r3INMdY= +github.com/vmware/govmomi v0.30.5 h1:p4sFypY4AJlFRiS2OFEGh9DCzufBrexbtPL5DB9Pxw0= +github.com/vmware/govmomi v0.30.5/go.mod h1:F7adsVewLNHsW/IIm7ziFURaXDaHEwcc+ym4r3INMdY= github.com/willf/bitset v1.1.11-0.20200630133818-d5bec3311243/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= diff --git a/vendor/github.com/vmware/govmomi/CONTRIBUTORS b/vendor/github.com/vmware/govmomi/CONTRIBUTORS index 8a23a1d82..ef8c56de8 100644 --- a/vendor/github.com/vmware/govmomi/CONTRIBUTORS +++ b/vendor/github.com/vmware/govmomi/CONTRIBUTORS @@ -6,7 +6,9 @@ Abhijeet Kasurde abrarshivani Adam Chalkley +Adam Fowler Adam Shannon +Akanksha Panse Al Biheiri Alessandro Cortiana Alex @@ -28,6 +30,7 @@ aniketGslab Ankit Vaidya Ankur Huralikoppi Anna Carrigan +Antony Saba Ariel Chinn Arran Walker Artem Anisimov @@ -41,14 +44,18 @@ Ben Corrie Ben Vickers Benjamin Davini Benjamin Peterson +Benjamin Vickers Bhavya Choudhary Bob Killen Brad Fitzpatrick +Brian Rak brian57860 Bruce Downs +Bryan Venteicher Cédric Blomart Cheng Cheng Chethan Venkatesh +Choudhury Sarada Prasanna Nanda Chris Marchesi Christian Höltje Clint Greenwood @@ -66,19 +73,24 @@ David Gress David Stark Davide Agnello Davinder Kumar +Defa demarey dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Deric Crago +ditsuke Divyen Patel Dnyanesh Gate Doug MacEachern East <60801291+houfangdong@users.noreply.github.com> Eloy Coto +embano1 +Eng Zer Jun Eric Edens Eric Graham <16710890+Pheric@users.noreply.github.com> Eric Gray Eric Yutao Erik Hollensbe +Essodjolo KAHANAM Ethan Kaley Evan Chu Fabio Rapposelli @@ -94,9 +106,11 @@ Gerrit Renker gthombare HakanSunay Hasan Mahmood +Haydon Ryan Heiko Reese Henrik Hodne hkumar +Hrabur Stoyanov hui luo Ian Eyberg Isaac Rodman @@ -115,6 +129,7 @@ Jorge Sevilla Julien PILLON Justin J. Novack kayrus +Keenan Brock Kevin George Knappek Leslie Wang @@ -124,13 +139,17 @@ Liping Xue Louie Jiang Luther Monson Madanagopal Arunachalam +makelarisjr <8687447+makelarisjr@users.noreply.github.com> maplain Marc Carmier Marcus Tan Maria Ntalla Marin Atanasov Nikolov Mario Trangoni +Mark Dechiaro Mark Peek +Mark Rexwinkel +martin Matt Clay Matt Moore Matt Moriarity @@ -138,14 +157,19 @@ Matthew Cosgrove mbhadale Merlijn Sebrechts Mevan Samaratunga +Michael Gasch <15986659+embano1@users.noreply.github.com> Michael Gasch Michal Jankowski +Mike Schinkel Mincho Tonev mingwei Nicolas Lamirault Nikhil Kathare Nikhil R Deshpande Nikolas Grottendieck +Nils Elde +nirbhay +Nobuhiro MIKI Om Kumar Omar Kohl Parham Alvani @@ -153,15 +177,24 @@ Parveen Chahal Paul Martin <25058109+rawstorage@users.noreply.github.com> Pierre Gronlier Pieter Noordhuis +pradeepj <50135054+pradeep288@users.noreply.github.com> +Pranshu Jain prydin rconde01 rHermes +Rianto Wahyudi +Ricardo Katz +Robin Watkins Rowan Jacobs Roy Ling rsikdar runner.mei +Ryan Johnson +S R Ashrith S.Çağlar Onur Saad Malik +Sam Zhu +samzhu333 <45263849+samzhu333@users.noreply.github.com> Sandeep Pissay Srinivasa Rao Scott Holden Sergey Ignatov @@ -172,11 +205,15 @@ Shaozhen Ding Shawn Neal shylasrinivas sky-joker +smaftoul +smahadik Sten Feldman Stepan Mazurov Steve Purcell +Sudhindra Aithal SUMIT AGRAWAL -Syuparn +Sunny Carter +syuparn Takaaki Furukawa Tamas Eger Tanay Kothari @@ -198,11 +235,13 @@ Waldek Maleska William Lam Witold Krecicki xing-yang +xinyanw409 Yang Yang yangxi Yann Hodique Yash Nitin Desai Yassine TIJANI +Yi Jiang yiyingy ykakarap Yogesh Sobale <6104071+ysobale@users.noreply.github.com> diff --git a/vendor/github.com/vmware/govmomi/cns/client.go b/vendor/github.com/vmware/govmomi/cns/client.go index e4097f908..037ac2e92 100644 --- a/vendor/github.com/vmware/govmomi/cns/client.go +++ b/vendor/github.com/vmware/govmomi/cns/client.go @@ -269,3 +269,16 @@ func (c *Client) QuerySnapshots(ctx context.Context, snapshotQueryFilter cnstype } return object.NewTask(c.vim25Client, res.Returnval), nil } + +// ReconfigVolumePolicy calls the CnsReconfigVolumePolicy API +func (c *Client) ReconfigVolumePolicy(ctx context.Context, PolicyReconfigSpecs []cnstypes.CnsVolumePolicyReconfigSpec) (*object.Task, error) { + req := cnstypes.CnsReconfigVolumePolicy{ + This: CnsVolumeManagerInstance, + VolumePolicyReconfigSpecs: PolicyReconfigSpecs, + } + res, err := methods.CnsReconfigVolumePolicy(ctx, c, &req) + if err != nil { + return nil, err + } + return object.NewTask(c.vim25Client, res.Returnval), nil +} diff --git a/vendor/github.com/vmware/govmomi/cns/methods/methods.go b/vendor/github.com/vmware/govmomi/cns/methods/methods.go index 6f0e0d0ae..43f41f3aa 100644 --- a/vendor/github.com/vmware/govmomi/cns/methods/methods.go +++ b/vendor/github.com/vmware/govmomi/cns/methods/methods.go @@ -326,3 +326,23 @@ func CnsQuerySnapshots(ctx context.Context, r soap.RoundTripper, req *types.CnsQ return resBody.Res, nil } + +type CnsReconfigVolumePolicyBody struct { + Req *types.CnsReconfigVolumePolicy `xml:"urn:vsan CnsReconfigVolumePolicy,omitempty"` + Res *types.CnsReconfigVolumePolicyResponse `xml:"urn:vsan CnsReconfigVolumePolicyResponse,omitempty"` + Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"` +} + +func (b *CnsReconfigVolumePolicyBody) Fault() *soap.Fault { return b.Fault_ } + +func CnsReconfigVolumePolicy(ctx context.Context, r soap.RoundTripper, req *types.CnsReconfigVolumePolicy) (*types.CnsReconfigVolumePolicyResponse, error) { + var reqBody, resBody CnsReconfigVolumePolicyBody + + reqBody.Req = req + + if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil { + return nil, err + } + + return resBody.Res, nil +} diff --git a/vendor/github.com/vmware/govmomi/cns/types/enum.go b/vendor/github.com/vmware/govmomi/cns/types/enum.go index 53f0580b4..09186eea4 100644 --- a/vendor/github.com/vmware/govmomi/cns/types/enum.go +++ b/vendor/github.com/vmware/govmomi/cns/types/enum.go @@ -55,6 +55,8 @@ const ( QuerySelectionNameTypeComplianceStatus = QuerySelectionNameType("COMPLIANCE_STATUS") QuerySelectionNameTypeDataStoreAccessibility = QuerySelectionNameType("DATASTORE_ACCESSIBILITY_STATUS") QuerySelectionNameTypeHealthStatus = QuerySelectionNameType("HEALTH_STATUS") + QuerySelectionNameTypeDataStoreUrl = QuerySelectionNameType("DATASTORE_URL") + QuerySelectionNameTypePolicyId = QuerySelectionNameType("POLICY_ID") ) func init() { @@ -87,6 +89,9 @@ const ( CnsQuerySelectionName_BACKING_OBJECT_DETAILS = CnsQuerySelectionNameType("BACKING_OBJECT_DETAILS") CnsQuerySelectionName_COMPLIANCE_STATUS = CnsQuerySelectionNameType("COMPLIANCE_STATUS") CnsQuerySelectionName_DATASTORE_ACCESSIBILITY_STATUS = CnsQuerySelectionNameType("DATASTORE_ACCESSIBILITY_STATUS") + CnsQuerySelectionName_HEALTH_STATUS = CnsQuerySelectionNameType("HEALTH_STATUS") + CnsQuerySelectionName_DATASTORE_URL = CnsQuerySelectionNameType("DATASTORE_URL") + CnsQuerySelectionName_POLICY_ID = CnsQuerySelectionNameType("POLICY_ID") ) func init() { diff --git a/vendor/github.com/vmware/govmomi/cns/types/types.go b/vendor/github.com/vmware/govmomi/cns/types/types.go index c5fb2812b..452b9ed38 100644 --- a/vendor/github.com/vmware/govmomi/cns/types/types.go +++ b/vendor/github.com/vmware/govmomi/cns/types/types.go @@ -392,8 +392,8 @@ func init() { type CnsBlockBackingDetails struct { CnsBackingObjectDetails - BackingDiskId string `xml:"backingDiskId,omitempty"` - BackingDiskUrlPath string `xml:"backingDiskUrlPath,omitempty"` + BackingDiskId string `xml:"backingDiskId,omitempty"` + BackingDiskUrlPath string `xml:"backingDiskUrlPath,omitempty"` BackingDiskObjectId string `xml:"backingDiskObjectId,omitempty"` } @@ -460,7 +460,7 @@ type CnsQueryFilter struct { ComplianceStatus string `xml:"complianceStatus,omitempty"` DatastoreAccessibilityStatus string `xml:"datastoreAccessibilityStatus,omitempty"` Cursor *CnsCursor `xml:"cursor,omitempty"` - healthStatus string `xml:"healthStatus,omitempty"` + HealthStatus string `xml:"healthStatus,omitempty"` } func init() { @@ -879,3 +879,33 @@ type CnsSnapshotQuerySpec struct { func init() { types.Add("CnsSnapshotQuerySpec", reflect.TypeOf((*CnsSnapshotQuerySpec)(nil)).Elem()) } + +type CnsReconfigVolumePolicy CnsReconfigVolumePolicyRequestType + +func init() { + types.Add("vsan:CnsReconfigVolumePolicy", reflect.TypeOf((*CnsReconfigVolumePolicy)(nil)).Elem()) +} + +type CnsReconfigVolumePolicyRequestType struct { + This types.ManagedObjectReference `xml:"_this"` + VolumePolicyReconfigSpecs []CnsVolumePolicyReconfigSpec `xml:"volumePolicyReconfigSpecs,omitempty"` +} + +func init() { + types.Add("vsan:CnsReconfigVolumePolicyRequestType", reflect.TypeOf((*CnsReconfigVolumePolicyRequestType)(nil)).Elem()) +} + +type CnsReconfigVolumePolicyResponse struct { + Returnval types.ManagedObjectReference `xml:"returnval"` +} + +type CnsVolumePolicyReconfigSpec struct { + types.DynamicData + + VolumeId CnsVolumeId `xml:"volumeId"` + Profile []types.BaseVirtualMachineProfileSpec `xml:"profile,omitempty,typeattr"` +} + +func init() { + types.Add("vsan:CnsVolumePolicyReconfigSpec", reflect.TypeOf((*CnsVolumePolicyReconfigSpec)(nil)).Elem()) +} diff --git a/vendor/github.com/vmware/govmomi/find/finder.go b/vendor/github.com/vmware/govmomi/find/finder.go index 61ac780c4..4830fc26e 100644 --- a/vendor/github.com/vmware/govmomi/find/finder.go +++ b/vendor/github.com/vmware/govmomi/find/finder.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2014-2020 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -784,6 +784,11 @@ func (f *Finder) NetworkList(ctx context.Context, path string) ([]object.Network } if len(ns) == 0 { + net, nerr := f.networkByID(ctx, path) + if nerr == nil { + return []object.NetworkReference{net}, nil + } + return nil, &NotFoundError{"network", path} } @@ -798,18 +803,13 @@ func (f *Finder) NetworkList(ctx context.Context, path string) ([]object.Network // Examples: // - Name: "dvpg-1" // - Inventory Path: "vds-1/dvpg-1" +// - Cluster Path: "/dc-1/host/cluster-1/dvpg-1" // - ManagedObject ID: "DistributedVirtualPortgroup:dvportgroup-53" // - Logical Switch UUID: "da2a59b8-2450-4cb2-b5cc-79c4c1d2144c" // - Segment ID: "/infra/segments/vnet_ce50e69b-1784-4a14-9206-ffd7f1f146f7" func (f *Finder) Network(ctx context.Context, path string) (object.NetworkReference, error) { networks, err := f.NetworkList(ctx, path) if err != nil { - if _, ok := err.(*NotFoundError); ok { - net, nerr := f.networkByID(ctx, path) - if nerr == nil { - return net, nil - } - } return nil, err } diff --git a/vendor/github.com/vmware/govmomi/govc/flags/debug.go b/vendor/github.com/vmware/govmomi/govc/flags/debug.go index 3f5aff87f..702cf42e6 100644 --- a/vendor/github.com/vmware/govmomi/govc/flags/debug.go +++ b/vendor/github.com/vmware/govmomi/govc/flags/debug.go @@ -347,6 +347,9 @@ func (v *verbose) missingSet(o types.ManagedObjectReference, m []types.MissingPr func (v *verbose) updateSet(u *types.UpdateSet) []string { var s []string + if u == nil { + return s + } for _, f := range u.FilterSet { for _, o := range f.ObjectSet { for _, c := range o.ChangeSet { diff --git a/vendor/github.com/vmware/govmomi/govc/flags/library.go b/vendor/github.com/vmware/govmomi/govc/flags/library.go index 16883d77b..3b715f457 100644 --- a/vendor/github.com/vmware/govmomi/govc/flags/library.go +++ b/vendor/github.com/vmware/govmomi/govc/flags/library.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2020 VMware, Inc. All Rights Reserved. +Copyright (c) 2020-2022 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/vendor/github.com/vmware/govmomi/govc/flags/output.go b/vendor/github.com/vmware/govmomi/govc/flags/output.go index 565bdd15a..c0338b18c 100644 --- a/vendor/github.com/vmware/govmomi/govc/flags/output.go +++ b/vendor/github.com/vmware/govmomi/govc/flags/output.go @@ -106,8 +106,14 @@ func (flag *OutputFlag) Write(b []byte) (int, error) { return 0, nil } - n, err := os.Stdout.Write(b) - os.Stdout.Sync() + w := flag.Out + if w == nil { + w = os.Stdout + } + n, err := w.Write(b) + if w == os.Stdout { + os.Stdout.Sync() + } return n, err } diff --git a/vendor/github.com/vmware/govmomi/govc/host/esxcli/esxcli.go b/vendor/github.com/vmware/govmomi/govc/host/esxcli/esxcli.go index 88dc9cd64..6ca0cd39b 100644 --- a/vendor/github.com/vmware/govmomi/govc/host/esxcli/esxcli.go +++ b/vendor/github.com/vmware/govmomi/govc/host/esxcli/esxcli.go @@ -71,6 +71,10 @@ func (cmd *esxcli) Process(ctx context.Context) error { } func (cmd *esxcli) Run(ctx context.Context, f *flag.FlagSet) error { + if f.NArg() == 0 { + return flag.ErrHelp + } + c, err := cmd.Client() if err != nil { return err diff --git a/vendor/github.com/vmware/govmomi/govc/vm/change.go b/vendor/github.com/vmware/govmomi/govc/vm/change.go index bf223aa81..531013405 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/change.go +++ b/vendor/github.com/vmware/govmomi/govc/vm/change.go @@ -178,6 +178,8 @@ func (cmd *change) Register(ctx context.Context, f *flag.FlagSet) { f.Var(flags.NewOptionalBool(&cmd.MemoryHotAddEnabled), "memory-hot-add-enabled", "Enable memory hot add") f.Var(flags.NewOptionalBool(&cmd.MemoryReservationLockedToMax), "memory-pin", "Reserve all guest memory") f.Var(flags.NewOptionalBool(&cmd.CpuHotAddEnabled), "cpu-hot-add-enabled", "Enable CPU hot add") + cmd.Flags = &types.VirtualMachineFlagInfo{} + f.Var(flags.NewOptionalBool(&cmd.Flags.VvtdEnabled), "iommu-enabled", "Enable IOMMU") f.StringVar(&cmd.hwUpgradePolicy, "scheduled-hw-upgrade-policy", "", fmt.Sprintf("Schedule hardware upgrade policy (%s)", strings.Join(hwUpgradePolicies, "|"))) } @@ -228,6 +230,10 @@ func (cmd *change) Run(ctx context.Context, f *flag.FlagSet) error { cmd.Tools = nil // no flags set, avoid sending in the request } + if reflect.DeepEqual(cmd.Flags, new(types.VirtualMachineFlagInfo)) { + cmd.Flags = nil // no flags set, avoid sending in the request + } + if err = cmd.setLatency(); err != nil { return err } diff --git a/vendor/github.com/vmware/govmomi/govc/vm/console.go b/vendor/github.com/vmware/govmomi/govc/vm/console.go index 30fc05a82..77c849b41 100644 --- a/vendor/github.com/vmware/govmomi/govc/vm/console.go +++ b/vendor/github.com/vmware/govmomi/govc/vm/console.go @@ -97,7 +97,7 @@ func (cmd *console) Run(ctx context.Context, f *flag.FlagSet) error { return err } - if state != types.VirtualMachinePowerStatePoweredOn { + if (cmd.capture != "" || cmd.wss) && state != types.VirtualMachinePowerStatePoweredOn { return fmt.Errorf("vm is not powered on (%s)", state) } diff --git a/vendor/github.com/vmware/govmomi/internal/version/version.go b/vendor/github.com/vmware/govmomi/internal/version/version.go index bb3389e59..6a901ccc9 100644 --- a/vendor/github.com/vmware/govmomi/internal/version/version.go +++ b/vendor/github.com/vmware/govmomi/internal/version/version.go @@ -21,5 +21,5 @@ const ( ClientName = "govmomi" // ClientVersion is the version of this SDK - ClientVersion = "0.29.0" + ClientVersion = "0.30.5" ) diff --git a/vendor/github.com/vmware/govmomi/list/lister.go b/vendor/github.com/vmware/govmomi/list/lister.go index 9a4caed68..92a40e8ba 100644 --- a/vendor/github.com/vmware/govmomi/list/lister.go +++ b/vendor/github.com/vmware/govmomi/list/lister.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2014-2016 VMware, Inc. All Rights Reserved. +Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -312,6 +312,7 @@ func (l Lister) ListComputeResource(ctx context.Context) ([]Element, error) { fields := []string{ "host", + "network", "resourcePool", } @@ -327,6 +328,7 @@ func (l Lister) ListComputeResource(ctx context.Context) ([]Element, error) { childTypes := []string{ "HostSystem", + "Network", "ResourcePool", } diff --git a/vendor/github.com/vmware/govmomi/object/search_index.go b/vendor/github.com/vmware/govmomi/object/search_index.go index bcf5e29f2..288f78097 100644 --- a/vendor/github.com/vmware/govmomi/object/search_index.go +++ b/vendor/github.com/vmware/govmomi/object/search_index.go @@ -93,7 +93,18 @@ func (s SearchIndex) FindByInventoryPath(ctx context.Context, path string) (Refe if res.Returnval == nil { return nil, nil } - return NewReference(s.c, *res.Returnval), nil + + r := NewReference(s.c, *res.Returnval) + + type common interface { + SetInventoryPath(string) + } + + if c, ok := r.(common); ok { + c.SetInventoryPath(path) + } + + return r, nil } // FindByIp finds a virtual machine or host by IP address. diff --git a/vendor/github.com/vmware/govmomi/object/virtual_device_list.go b/vendor/github.com/vmware/govmomi/object/virtual_device_list.go index 19c91519e..376550653 100644 --- a/vendor/github.com/vmware/govmomi/object/virtual_device_list.go +++ b/vendor/github.com/vmware/govmomi/object/virtual_device_list.go @@ -919,7 +919,13 @@ func (l VirtualDeviceList) Name(device types.BaseVirtualDevice) string { dtype := l.Type(device) switch dtype { case DeviceTypeEthernet: - key = fmt.Sprintf("%d", UnitNumber-7) + // Ethernet devices of UnitNumber 7-19 are non-SRIOV. Ethernet devices of + // UnitNumber 45-36 descending are SRIOV + if UnitNumber <= 45 && UnitNumber >= 36 { + key = fmt.Sprintf("sriov-%d", 45-UnitNumber) + } else { + key = fmt.Sprintf("%d", UnitNumber-7) + } case DeviceTypeDisk: key = fmt.Sprintf("%d-%d", d.ControllerKey, UnitNumber) default: diff --git a/vendor/github.com/vmware/govmomi/task/history_collector.go b/vendor/github.com/vmware/govmomi/task/history_collector.go index dd9b70a1b..7d8a6cf04 100644 --- a/vendor/github.com/vmware/govmomi/task/history_collector.go +++ b/vendor/github.com/vmware/govmomi/task/history_collector.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2015 VMware, Inc. All Rights Reserved. +Copyright (c) 2015-2022 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -38,12 +38,15 @@ func newHistoryCollector(c *vim25.Client, ref types.ManagedObjectReference) *His } } -// RecentTasks returns a list of task managed objects that completed recently, -// that are currently running, or that are queued to run. -func (h HistoryCollector) RecentTasks(ctx context.Context) ([]types.TaskInfo, error) { +// LatestPage returns items in the 'viewable latest page' of the task history collector. +// As new tasks that match the collector's TaskFilterSpec are created, +// they are added to this page, and the oldest tasks are removed from the collector to keep +// the size of the page to that allowed by SetCollectorPageSize. +// The "oldest task" is the one with the oldest creation time. The tasks in the returned page are unordered. +func (h HistoryCollector) LatestPage(ctx context.Context) ([]types.TaskInfo, error) { var o mo.TaskHistoryCollector - err := h.Properties(ctx, h.Reference(), []string{"recentTask"}, &o) + err := h.Properties(ctx, h.Reference(), []string{"latestPage"}, &o) if err != nil { return nil, err } diff --git a/vendor/github.com/vmware/govmomi/vapi/internal/internal.go b/vendor/github.com/vmware/govmomi/vapi/internal/internal.go index 68fe79751..f6584c569 100644 --- a/vendor/github.com/vmware/govmomi/vapi/internal/internal.go +++ b/vendor/github.com/vmware/govmomi/vapi/internal/internal.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2018 VMware, Inc. All Rights Reserved. +Copyright (c) 2018-2022 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -37,8 +37,10 @@ const ( LibraryItemDownloadSessionFile = "/com/vmware/content/library/item/downloadsession/file" LocalLibraryPath = "/com/vmware/content/local-library" SubscribedLibraryPath = "/com/vmware/content/subscribed-library" + SecurityPoliciesPath = "/api/content/security-policies" SubscribedLibraryItem = "/com/vmware/content/library/subscribed-item" Subscriptions = "/com/vmware/content/library/subscriptions" + TrustedCertificatesPath = "/api/content/trusted-certificates" VCenterOVFLibraryItem = "/com/vmware/vcenter/ovf/library-item" VCenterVMTXLibraryItem = "/vcenter/vm-template/library-items" VCenterVM = "/vcenter/vm" diff --git a/vendor/github.com/vmware/govmomi/vapi/library/library.go b/vendor/github.com/vmware/govmomi/vapi/library/library.go index 254a1b6dc..e5e5d0896 100644 --- a/vendor/github.com/vmware/govmomi/vapi/library/library.go +++ b/vendor/github.com/vmware/govmomi/vapi/library/library.go @@ -36,17 +36,19 @@ type StorageBackings struct { // Library provides methods to create, read, update, delete, and enumerate libraries. type Library struct { - CreationTime *time.Time `json:"creation_time,omitempty"` - Description string `json:"description,omitempty"` - ID string `json:"id,omitempty"` - LastModifiedTime *time.Time `json:"last_modified_time,omitempty"` - LastSyncTime *time.Time `json:"last_sync_time,omitempty"` - Name string `json:"name,omitempty"` - Storage []StorageBackings `json:"storage_backings,omitempty"` - Type string `json:"type,omitempty"` - Version string `json:"version,omitempty"` - Subscription *Subscription `json:"subscription_info,omitempty"` - Publication *Publication `json:"publish_info,omitempty"` + CreationTime *time.Time `json:"creation_time,omitempty"` + Description string `json:"description,omitempty"` + ID string `json:"id,omitempty"` + LastModifiedTime *time.Time `json:"last_modified_time,omitempty"` + LastSyncTime *time.Time `json:"last_sync_time,omitempty"` + Name string `json:"name,omitempty"` + Storage []StorageBackings `json:"storage_backings,omitempty"` + Type string `json:"type,omitempty"` + Version string `json:"version,omitempty"` + Subscription *Subscription `json:"subscription_info,omitempty"` + Publication *Publication `json:"publish_info,omitempty"` + SecurityPolicyID string `json:"security_policy_id,omitempty"` + UnsetSecurityPolicyID bool `json:"unset_security_policy_id,omitempty"` } // Subscription info diff --git a/vendor/github.com/vmware/govmomi/vapi/library/library_item.go b/vendor/github.com/vmware/govmomi/vapi/library/library_item.go index c596ec128..adc2101ab 100644 --- a/vendor/github.com/vmware/govmomi/vapi/library/library_item.go +++ b/vendor/github.com/vmware/govmomi/vapi/library/library_item.go @@ -1,5 +1,5 @@ /* -Copyright (c) 2018 VMware, Inc. All Rights Reserved. +Copyright (c) 2018-2022 VMware, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -47,6 +47,15 @@ type Item struct { SourceID string `json:"source_id,omitempty"` Type string `json:"type,omitempty"` Version string `json:"version,omitempty"` + + SecurityCompliance *bool `json:"security_compliance,omitempty"` + CertificateVerification *ItemCertificateVerification `json:"certificate_verification_info,omitempty"` +} + +// ItemCertificateVerification contains the certificate verification status and item's signing certificate +type ItemCertificateVerification struct { + Status string `json:"status"` + CertChain []string `json:"cert_chain,omitempty"` } // Patch merges updates from the given src. diff --git a/vendor/github.com/vmware/govmomi/vapi/library/security_policy.go b/vendor/github.com/vmware/govmomi/vapi/library/security_policy.go new file mode 100644 index 000000000..dd4766356 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/vapi/library/security_policy.go @@ -0,0 +1,63 @@ +/* +Copyright (c) 2022-2022 VMware, Inc. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package library + +import ( + "context" + "errors" + "net/http" + + "github.com/vmware/govmomi/vapi/internal" +) + +const ( + OvfDefaultSecurityPolicy = "OVF default policy" +) + +// ContentSecurityPoliciesInfo contains information on security policies that can +// be used to describe security for content library items. +type ContentSecurityPoliciesInfo struct { + // ItemTypeRules are rules governing the policy. + ItemTypeRules map[string]string `json:"item_type_rules"` + // Name is a human-readable identifier identifying the policy. + Name string `json:"name"` + // Policy is the unique identifier for a policy. + Policy string `json:"policy"` +} + +// ListSecurityPolicies lists security policies +func (c *Manager) ListSecurityPolicies(ctx context.Context) ([]ContentSecurityPoliciesInfo, error) { + url := c.Resource(internal.SecurityPoliciesPath) + var res []ContentSecurityPoliciesInfo + return res, c.Do(ctx, url.Request(http.MethodGet), &res) +} + +func (c *Manager) DefaultOvfSecurityPolicy(ctx context.Context) (string, error) { + res, err := c.ListSecurityPolicies(ctx) + + if err != nil { + return "", err + } + + for _, policy := range res { + if policy.Name == OvfDefaultSecurityPolicy { + return policy.Policy, nil + } + } + + return "", errors.New("failed to find default ovf security policy") +} diff --git a/vendor/github.com/vmware/govmomi/vapi/library/trusted_certificates.go b/vendor/github.com/vmware/govmomi/vapi/library/trusted_certificates.go new file mode 100644 index 000000000..33e25a065 --- /dev/null +++ b/vendor/github.com/vmware/govmomi/vapi/library/trusted_certificates.go @@ -0,0 +1,70 @@ +/* +Copyright (c) 2022-2022 VMware, Inc. All Rights Reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package library + +import ( + "context" + "net/http" + "path" + + "github.com/vmware/govmomi/vapi/internal" +) + +// TrustedCertificate contains a trusted certificate in Base64 encoded PEM format +type TrustedCertificate struct { + Text string `json:"cert_text"` +} + +// TrustedCertificateSummary contains a trusted certificate in Base64 encoded PEM format and its id +type TrustedCertificateSummary struct { + TrustedCertificate + ID string `json:"certificate"` +} + +// ListTrustedCertificates retrieves all content library's trusted certificates +func (c *Manager) ListTrustedCertificates(ctx context.Context) ([]TrustedCertificateSummary, error) { + url := c.Resource(internal.TrustedCertificatesPath) + var res struct { + Certificates []TrustedCertificateSummary `json:"certificates"` + } + err := c.Do(ctx, url.Request(http.MethodGet), &res) + return res.Certificates, err +} + +// GetTrustedCertificate retrieves a trusted certificate for a given certificate id +func (c *Manager) GetTrustedCertificate(ctx context.Context, id string) (*TrustedCertificate, error) { + url := c.Resource(path.Join(internal.TrustedCertificatesPath, id)) + var res TrustedCertificate + err := c.Do(ctx, url.Request(http.MethodGet), &res) + if err != nil { + return nil, err + } + return &res, nil +} + +// CreateTrustedCertificate adds a certificate to content library trust store +func (c *Manager) CreateTrustedCertificate(ctx context.Context, cert string) error { + url := c.Resource(internal.TrustedCertificatesPath) + body := TrustedCertificate{Text: cert} + return c.Do(ctx, url.Request(http.MethodPost, body), nil) +} + +// DeleteTrustedCertificate deletes the trusted certificate from content library's trust store for the given id +func (c *Manager) DeleteTrustedCertificate(ctx context.Context, id string) error { + url := c.Resource(path.Join(internal.TrustedCertificatesPath, id)) + return c.Do(ctx, url.Request(http.MethodDelete), nil) +} diff --git a/vendor/github.com/vmware/govmomi/vim25/soap/client.go b/vendor/github.com/vmware/govmomi/vim25/soap/client.go index 5c63bcc9a..e46a17f95 100644 --- a/vendor/github.com/vmware/govmomi/vim25/soap/client.go +++ b/vendor/github.com/vmware/govmomi/vim25/soap/client.go @@ -156,10 +156,14 @@ func NewClient(u *url.URL, insecure bool) *Client { c.hosts = make(map[string]string) c.t.TLSClientConfig = &tls.Config{InsecureSkipVerify: c.k} - // Don't bother setting DialTLS if InsecureSkipVerify=true - if !c.k { - c.t.DialTLS = c.dialTLS - } + + // Always set DialTLS and DialTLSContext, even if InsecureSkipVerify=true, + // because of how certificate verification has been delegated to the host's + // PKI framework in Go 1.18. Please see the following links for more info: + // + // * https://tip.golang.org/doc/go1.18 (search for "Certificate.Verify") + // * https://github.com/square/certigo/issues/264 + c.t.DialTLSContext = c.dialTLSContext c.Client.Transport = c.t c.Client.Jar, _ = cookiejar.New(nil) @@ -352,7 +356,10 @@ func ThumbprintSHA1(cert *x509.Certificate) string { return strings.Join(hex, ":") } -func (c *Client) dialTLS(network string, addr string) (net.Conn, error) { +func (c *Client) dialTLSContext( + ctx context.Context, + network, addr string) (net.Conn, error) { + // Would be nice if there was a tls.Config.Verify func, // see tls.clientHandshakeState.doFullHandshake @@ -366,7 +373,20 @@ func (c *Client) dialTLS(network string, addr string) (net.Conn, error) { case x509.UnknownAuthorityError: case x509.HostnameError: default: - return nil, err + // Allow a thumbprint verification attempt if the error indicates + // the failure was due to lack of trust. + // + // Please note the err variable is not a special type of x509 or HTTP + // error that can be validated by a type assertion. The err variable is + // in fact an *errors.errorString. + switch { + case strings.HasSuffix(err.Error(), "certificate is not trusted"): + // darwin and linux + case strings.HasSuffix(err.Error(), "certificate signed by unknown authority"): + // windows + default: + return nil, err + } } thumbprint := c.Thumbprint(addr) @@ -391,6 +411,10 @@ func (c *Client) dialTLS(network string, addr string) (net.Conn, error) { return conn, nil } +func (c *Client) dialTLS(network, addr string) (net.Conn, error) { + return c.dialTLSContext(context.Background(), network, addr) +} + // splitHostPort is similar to net.SplitHostPort, // but rather than return error if there isn't a ':port', // return an empty string for the port. diff --git a/vendor/github.com/vmware/govmomi/vim25/types/helpers.go b/vendor/github.com/vmware/govmomi/vim25/types/helpers.go index 67d9793fa..70360eb4f 100644 --- a/vendor/github.com/vmware/govmomi/vim25/types/helpers.go +++ b/vendor/github.com/vmware/govmomi/vim25/types/helpers.go @@ -157,6 +157,18 @@ func (ci VirtualMachineConfigInfo) ToConfigSpec() VirtualMachineConfigSpec { SevEnabled: ci.SevEnabled, PmemFailoverEnabled: ci.PmemFailoverEnabled, Pmem: ci.Pmem, + NpivWorldWideNameOp: ci.NpivWorldWideNameType, + RebootPowerOff: ci.RebootPowerOff, + ScheduledHardwareUpgradeInfo: ci.ScheduledHardwareUpgradeInfo, + SgxInfo: ci.SgxInfo, + GuestMonitoringModeInfo: ci.GuestMonitoringModeInfo, + VmxStatsCollectionEnabled: ci.VmxStatsCollectionEnabled, + VmOpNotificationToAppEnabled: ci.VmOpNotificationToAppEnabled, + VmOpNotificationTimeout: ci.VmOpNotificationTimeout, + DeviceSwap: ci.DeviceSwap, + SimultaneousThreads: ci.Hardware.SimultaneousThreads, + DeviceGroups: ci.DeviceGroups, + MotherboardLayout: ci.Hardware.MotherboardLayout, } // Unassign the Files field if all of its fields are empty. @@ -234,6 +246,66 @@ func (ci VirtualMachineConfigInfo) ToConfigSpec() VirtualMachineConfigSpec { } } + if ni := ci.NumaInfo; ni != nil { + cs.VirtualNuma = &VirtualMachineVirtualNuma{ + CoresPerNumaNode: ni.CoresPerNumaNode, + ExposeVnumaOnCpuHotadd: ni.VnumaOnCpuHotaddExposed, + } + } + + if civa, ok := ci.VAppConfig.(*VmConfigInfo); ok { + var csva VmConfigSpec + + csva.Eula = civa.Eula + csva.InstallBootRequired = &civa.InstallBootRequired + csva.InstallBootStopDelay = civa.InstallBootStopDelay + + ipAssignment := civa.IpAssignment + csva.IpAssignment = &ipAssignment + + csva.OvfEnvironmentTransport = civa.OvfEnvironmentTransport + for i := range civa.OvfSection { + s := civa.OvfSection[i] + csva.OvfSection = append( + csva.OvfSection, + VAppOvfSectionSpec{ + ArrayUpdateSpec: ArrayUpdateSpec{ + Operation: ArrayUpdateOperationAdd, + }, + Info: &s, + }, + ) + } + + for i := range civa.Product { + p := civa.Product[i] + csva.Product = append( + csva.Product, + VAppProductSpec{ + ArrayUpdateSpec: ArrayUpdateSpec{ + Operation: ArrayUpdateOperationAdd, + }, + Info: &p, + }, + ) + } + + for i := range civa.Property { + p := civa.Property[i] + csva.Property = append( + csva.Property, + VAppPropertySpec{ + ArrayUpdateSpec: ArrayUpdateSpec{ + Operation: ArrayUpdateOperationAdd, + }, + Info: &p, + }, + ) + } + + cs.VAppConfig = &csva + } + return cs } diff --git a/vendor/github.com/vmware/govmomi/vim25/types/types.go b/vendor/github.com/vmware/govmomi/vim25/types/types.go index 30a58792b..f7ae195f7 100644 --- a/vendor/github.com/vmware/govmomi/vim25/types/types.go +++ b/vendor/github.com/vmware/govmomi/vim25/types/types.go @@ -8313,6 +8313,18 @@ func init() { t["ClusterAttemptedVmInfo"] = reflect.TypeOf((*ClusterAttemptedVmInfo)(nil)).Elem() } +type ClusterClusterInitialPlacementAction struct { + ClusterAction + + TargetHost *ManagedObjectReference `xml:"targetHost,omitempty"` + Pool ManagedObjectReference `xml:"pool"` + ConfigSpec *VirtualMachineConfigSpec `xml:"configSpec,omitempty"` +} + +func init() { + t["ClusterClusterInitialPlacementAction"] = reflect.TypeOf((*ClusterClusterInitialPlacementAction)(nil)).Elem() +} + type ClusterComplianceCheckedEvent struct { ClusterEvent @@ -8835,18 +8847,6 @@ func init() { t["ClusterDasVmConfigSpec"] = reflect.TypeOf((*ClusterDasVmConfigSpec)(nil)).Elem() } -type ClusterDasVmPreemptiblePairInfo struct { - DynamicData - - Key int32 `xml:"key,omitempty"` - MonitoredVm ManagedObjectReference `xml:"monitoredVm"` - PreemptibleVm ManagedObjectReference `xml:"preemptibleVm"` -} - -func init() { - t["ClusterDasVmPreemptiblePairInfo"] = reflect.TypeOf((*ClusterDasVmPreemptiblePairInfo)(nil)).Elem() -} - type ClusterDasVmSettings struct { DynamicData diff --git a/vendor/github.com/vmware/govmomi/vim25/types/unreleased.go b/vendor/github.com/vmware/govmomi/vim25/types/unreleased.go index ee1c09f33..72bc1082b 100644 --- a/vendor/github.com/vmware/govmomi/vim25/types/unreleased.go +++ b/vendor/github.com/vmware/govmomi/vim25/types/unreleased.go @@ -98,8 +98,10 @@ func init() { type PlaceVmsXClusterSpec struct { DynamicData - ResourcePools []ManagedObjectReference `xml:"resourcePools,omitempty"` - VmPlacementSpecs []PlaceVmsXClusterSpecVmPlacementSpec `xml:"vmPlacementSpecs,omitempty"` + ResourcePools []ManagedObjectReference `xml:"resourcePools,omitempty"` + VmPlacementSpecs []PlaceVmsXClusterSpecVmPlacementSpec `xml:"vmPlacementSpecs,omitempty"` + HostRecommRequired *bool `xml:"hostRecommRequired"` + DatastoreRecommRequired *bool `xml:"datastoreRecommRequired"` } func init() { @@ -117,13 +119,3 @@ func init() { } const RecommendationReasonCodeXClusterPlacement = RecommendationReasonCode("xClusterPlacement") - -type ClusterClusterInitialPlacementAction struct { - ClusterInitialPlacementAction - - ConfigSpec *VirtualMachineConfigSpec `xml:"configSpec,omitempty"` -} - -func init() { - t["ClusterClusterInitialPlacementAction"] = reflect.TypeOf((*ClusterClusterInitialPlacementAction)(nil)).Elem() -} diff --git a/vendor/modules.txt b/vendor/modules.txt index d67f55a4d..99cfc6235 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -702,7 +702,7 @@ github.com/vbauerster/mpb/v7 github.com/vbauerster/mpb/v7/cwriter github.com/vbauerster/mpb/v7/decor github.com/vbauerster/mpb/v7/internal -# github.com/vmware/govmomi v0.29.0 +# github.com/vmware/govmomi v0.30.5 ## explicit; go 1.17 github.com/vmware/govmomi/cns github.com/vmware/govmomi/cns/methods