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] <support@github.com>
This commit is contained in:
dependabot[bot] 2023-06-27 05:01:22 +00:00 committed by Tomáš Hozza
parent 4f91e956aa
commit 32c3865507
29 changed files with 453 additions and 71 deletions

2
go.mod
View file

@ -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

4
go.sum
View file

@ -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=

View file

@ -6,7 +6,9 @@
Abhijeet Kasurde <akasurde@redhat.com>
abrarshivani <abrarshivani@users.noreply.github.com>
Adam Chalkley <atc0005@users.noreply.github.com>
Adam Fowler <adam@adamfowler.org>
Adam Shannon <adamkshannon@gmail.com>
Akanksha Panse <pansea@vmware.com>
Al Biheiri <abiheiri@apple.com>
Alessandro Cortiana <alessandro.cortiana@gmail.com>
Alex <puzo2002@gmail.com>
@ -28,6 +30,7 @@ aniketGslab <aniket.shinde@gslab.com>
Ankit Vaidya <vaidyaa@vmware.com>
Ankur Huralikoppi <huralikoppia@vmware.com>
Anna Carrigan <anna.carrigan@hpe.com>
Antony Saba <awsaba@gmail.com>
Ariel Chinn <arielchinn@gmail.com>
Arran Walker <arran.walker@zopa.com>
Artem Anisimov <aanisimov@inbox.ru>
@ -41,14 +44,18 @@ Ben Corrie <bcorrie@vmware.com>
Ben Vickers <bvickers@pivotal.io>
Benjamin Davini <davinib@vmware.com>
Benjamin Peterson <benjamin@python.org>
Benjamin Vickers <bvickers@vmware.com>
Bhavya Choudhary <bhavyac@vmware.com>
Bob Killen <killen.bob@gmail.com>
Brad Fitzpatrick <bradfitz@golang.org>
Brian Rak <brak@vmware.com>
brian57860 <brian57860@users.noreply.github.com>
Bruce Downs <bruceadowns@gmail.com>
Bryan Venteicher <bryanventeicher@gmail.com>
Cédric Blomart <cblomart@gmail.com>
Cheng Cheng <chengch@vmware.com>
Chethan Venkatesh <chethanv@vmware.com>
Choudhury Sarada Prasanna Nanda <cspn@google.com>
Chris Marchesi <chrism@vancluevertech.com>
Christian Höltje <docwhat@gerf.org>
Clint Greenwood <cgreenwood@vmware.com>
@ -66,19 +73,24 @@ David Gress <gressd@vmware.com>
David Stark <dave@davidstark.name>
Davide Agnello <dagnello@hp.com>
Davinder Kumar <davinderk@vmware.com>
Defa <zhoudefa666@163.com>
demarey <christophe.demarey@inria.fr>
dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Deric Crago <deric.crago@gmail.com>
ditsuke <ditsuke@protonmail.com>
Divyen Patel <divyenp@vmware.com>
Dnyanesh Gate <dnyanesh.gate@druva.com>
Doug MacEachern <dougm@vmware.com>
East <60801291+houfangdong@users.noreply.github.com>
Eloy Coto <eloy.coto@gmail.com>
embano1 <embano1@users.noreply.github.com>
Eng Zer Jun <engzerjun@gmail.com>
Eric Edens <ericedens@google.com>
Eric Graham <16710890+Pheric@users.noreply.github.com>
Eric Gray <egray@vmware.com>
Eric Yutao <eric.yutao@gmail.com>
Erik Hollensbe <github@hollensbe.org>
Essodjolo KAHANAM <essodjolo@kahanam.com>
Ethan Kaley <ethan.kaley@emc.com>
Evan Chu <echu@vmware.com>
Fabio Rapposelli <fabio@vmware.com>
@ -94,9 +106,11 @@ Gerrit Renker <Gerrit.Renker@ctl.io>
gthombare <gthombare@vmware.com>
HakanSunay <hakansunay@abv.bg>
Hasan Mahmood <mahmoodh@vmware.com>
Haydon Ryan <haydon.ryan@gmail.com>
Heiko Reese <hreese@users.noreply.github.com>
Henrik Hodne <henrik@travis-ci.com>
hkumar <hkumar@vmware.com>
Hrabur Stoyanov <hstoyanov@vmware.com>
hui luo <luoh@vmware.com>
Ian Eyberg <ian@deferpanic.com>
Isaac Rodman <isaac@eyz.us>
@ -115,6 +129,7 @@ Jorge Sevilla <jorge.sevilla@rstor.io>
Julien PILLON <jpillon@lesalternatives.org>
Justin J. Novack <jnovack@users.noreply.github.com>
kayrus <kay.diam@gmail.com>
Keenan Brock <keenan@thebrocks.net>
Kevin George <georgek@vmware.com>
Knappek <andy.knapp.ak@gmail.com>
Leslie Wang <qiwa@pensando.io>
@ -124,13 +139,17 @@ Liping Xue <lipingx@vmware.com>
Louie Jiang <jiangl@vmware.com>
Luther Monson <luther.monson@gmail.com>
Madanagopal Arunachalam <marunachalam@vmware.com>
makelarisjr <8687447+makelarisjr@users.noreply.github.com>
maplain <fangyuanl@vmware.com>
Marc Carmier <mcarmier@gmail.com>
Marcus Tan <marcus.tan@rubrik.com>
Maria Ntalla <maria.ntalla@gmail.com>
Marin Atanasov Nikolov <mnikolov@vmware.com>
Mario Trangoni <mjtrangoni@gmail.com>
Mark Dechiaro <mdechiaro@users.noreply.github.com>
Mark Peek <markpeek@vmware.com>
Mark Rexwinkel <Mark.Rexwinkel@elekta.com>
martin <martin@catai.org>
Matt Clay <matt@mystile.com>
Matt Moore <mattmoor@vmware.com>
Matt Moriarity <matt@mattmoriarity.com>
@ -138,14 +157,19 @@ Matthew Cosgrove <matthew.cosgrove@dell.com>
mbhadale <mbhadale@vmware.com>
Merlijn Sebrechts <merlijn.sebrechts@gmail.com>
Mevan Samaratunga <mevansam@gmail.com>
Michael Gasch <15986659+embano1@users.noreply.github.com>
Michael Gasch <mgasch@vmware.com>
Michal Jankowski <mjankowski@vmware.com>
Mike Schinkel <mike@newclarity.net>
Mincho Tonev <mtonev@vmware.com>
mingwei <mingwei@smartx.com>
Nicolas Lamirault <nicolas.lamirault@gmail.com>
Nikhil Kathare <nikhil.kathare@netapp.com>
Nikhil R Deshpande <ndeshpande@vmware.com>
Nikolas Grottendieck <git@nikolasgrottendieck.com>
Nils Elde <nils.elde@sscinc.com>
nirbhay <nirbhay.bagmar@nutanix.com>
Nobuhiro MIKI <nmiki@yahoo-corp.jp>
Om Kumar <om.kumar@hpe.com>
Omar Kohl <omarkohl@gmail.com>
Parham Alvani <parham.alvani@gmail.com>
@ -153,15 +177,24 @@ Parveen Chahal <parkuma@microsoft.com>
Paul Martin <25058109+rawstorage@users.noreply.github.com>
Pierre Gronlier <pierre.gronlier@corp.ovh.com>
Pieter Noordhuis <pnoordhuis@vmware.com>
pradeepj <50135054+pradeep288@users.noreply.github.com>
Pranshu Jain <jpranshu@vmware.com>
prydin <prydin@vmware.com>
rconde01 <rconde01@hotmail.com>
rHermes <teodor_spaeren@riseup.net>
Rianto Wahyudi <rwahyudi@gmail.com>
Ricardo Katz <rkatz@vmware.com>
Robin Watkins <robwatkins@gmail.com>
Rowan Jacobs <rojacobs@pivotal.io>
Roy Ling <royling0024@gmail.com>
rsikdar <rsikdar@berkeley.edu>
runner.mei <runner.mei@gmail.com>
Ryan Johnson <johnsonryan@vmware.com>
S R Ashrith <sashrith@vmware.com>
S.Çağlar Onur <conur@vmware.com>
Saad Malik <saad@spectrocloud.com>
Sam Zhu <zhusa@zhusa-a02.vmware.com>
samzhu333 <45263849+samzhu333@users.noreply.github.com>
Sandeep Pissay Srinivasa Rao <ssrinivas@vmware.com>
Scott Holden <scott@nullops.io>
Sergey Ignatov <sergey.ignatov@jetbrains.com>
@ -172,11 +205,15 @@ Shaozhen Ding <dsz0111@gmail.com>
Shawn Neal <sneal@sneal.net>
shylasrinivas <sshyla@vmware.com>
sky-joker <sky.jokerxx@gmail.com>
smaftoul <samuel.maftoul@gmail.com>
smahadik <smahadik@vmware.com>
Sten Feldman <exile@chamber.ee>
Stepan Mazurov <smazurov@gmail.com>
Steve Purcell <steve@sanityinc.com>
Sudhindra Aithal <sudhiaithal@pensando.io>
SUMIT AGRAWAL <asumit@vmware.com>
Syuparn <s.hello.spagetti@gmail.com>
Sunny Carter <sunny.carter@metaswitch.com>
syuparn <s.hello.spagetti@gmail.com>
Takaaki Furukawa <takaaki.frkw@gmail.com>
Tamas Eger <tamas.eger@bitrise.io>
Tanay Kothari <tkothari@vmware.com>
@ -198,11 +235,13 @@ Waldek Maleska <w.maleska@gmail.com>
William Lam <wlam@vmware.com>
Witold Krecicki <wpk@culm.net>
xing-yang <xingyang105@gmail.com>
xinyanw409 <wxinyan@vmware.com>
Yang Yang <yangy@vmware.com>
yangxi <yangxi@vmware.com>
Yann Hodique <yhodique@google.com>
Yash Nitin Desai <desaiy@vmware.com>
Yassine TIJANI <ytijani@vmware.com>
Yi Jiang <yijiang@vmware.com>
yiyingy <yiyingy@vmware.com>
ykakarap <yuva2811@gmail.com>
Yogesh Sobale <6104071+ysobale@users.noreply.github.com>

View file

@ -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
}

View file

@ -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
}

View file

@ -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() {

View file

@ -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())
}

View file

@ -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
}

View file

@ -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 {

View file

@ -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.

View file

@ -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
}

View file

@ -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

View file

@ -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 <tools/> in the request
}
if reflect.DeepEqual(cmd.Flags, new(types.VirtualMachineFlagInfo)) {
cmd.Flags = nil // no flags set, avoid sending <flags/> in the request
}
if err = cmd.setLatency(); err != nil {
return err
}

View file

@ -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)
}

View file

@ -21,5 +21,5 @@ const (
ClientName = "govmomi"
// ClientVersion is the version of this SDK
ClientVersion = "0.29.0"
ClientVersion = "0.30.5"
)

View file

@ -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",
}

View file

@ -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.

View file

@ -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:

View file

@ -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
}

View file

@ -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"

View file

@ -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

View file

@ -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.

View file

@ -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")
}

View file

@ -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)
}

View file

@ -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.

View file

@ -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
}

View file

@ -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

View file

@ -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()
}

2
vendor/modules.txt vendored
View file

@ -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