mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
.: bump govmomi to v0.30.6
Bumping govmomi to include an error check fix needed
to work with go1.20. We made this fix in the CI, but
were reliant on the text matching of error strings,
which is why it didn't catch the actual issue. This
Fix in b4eac19369
PR to bump govmomi in cloud-provider-vsphere: https://github.com/kubernetes/cloud-provider-vsphere/pull/738
Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
This commit is contained in:
parent
76a22d3b32
commit
fc6b19a4ba
2
go.mod
2
go.mod
@ -65,7 +65,7 @@ require (
|
|||||||
github.com/spf13/pflag v1.0.5
|
github.com/spf13/pflag v1.0.5
|
||||||
github.com/stretchr/testify v1.8.2
|
github.com/stretchr/testify v1.8.2
|
||||||
github.com/vishvananda/netlink v1.1.0
|
github.com/vishvananda/netlink v1.1.0
|
||||||
github.com/vmware/govmomi v0.30.0
|
github.com/vmware/govmomi v0.30.6
|
||||||
go.etcd.io/etcd/api/v3 v3.5.9
|
go.etcd.io/etcd/api/v3 v3.5.9
|
||||||
go.etcd.io/etcd/client/pkg/v3 v3.5.9
|
go.etcd.io/etcd/client/pkg/v3 v3.5.9
|
||||||
go.etcd.io/etcd/client/v3 v3.5.9
|
go.etcd.io/etcd/client/v3 v3.5.9
|
||||||
|
4
go.sum
4
go.sum
@ -826,8 +826,8 @@ github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYp
|
|||||||
github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU=
|
github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU=
|
||||||
github.com/vishvananda/netns v0.0.4 h1:Oeaw1EM2JMxD51g9uhtC0D7erkIjgmj8+JZc26m1YX8=
|
github.com/vishvananda/netns v0.0.4 h1:Oeaw1EM2JMxD51g9uhtC0D7erkIjgmj8+JZc26m1YX8=
|
||||||
github.com/vishvananda/netns v0.0.4/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM=
|
github.com/vishvananda/netns v0.0.4/go.mod h1:SpkAiCQRtJ6TvvxPnOSyH3BMl6unz3xZlaprSwhNNJM=
|
||||||
github.com/vmware/govmomi v0.30.0 h1:Fm8ugPnnlMSTSceDKY9goGvjmqc6eQLPUSUeNXdpeXA=
|
github.com/vmware/govmomi v0.30.6 h1:O3tjSwQBy0XwI5uK1/yVIfQ1LP9bAECEDUfifnyGs9U=
|
||||||
github.com/vmware/govmomi v0.30.0/go.mod h1:F7adsVewLNHsW/IIm7ziFURaXDaHEwcc+ym4r3INMdY=
|
github.com/vmware/govmomi v0.30.6/go.mod h1:epgoslm97rLECMV4D+08ORzUBEU7boFSepKjt7AYVGg=
|
||||||
github.com/vmware/vmw-guestinfo v0.0.0-20170707015358-25eff159a728/go.mod h1:x9oS4Wk2s2u4tS29nEaDLdzvuHdB19CvSGJjPgkZJNk=
|
github.com/vmware/vmw-guestinfo v0.0.0-20170707015358-25eff159a728/go.mod h1:x9oS4Wk2s2u4tS29nEaDLdzvuHdB19CvSGJjPgkZJNk=
|
||||||
github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU=
|
github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU=
|
||||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8=
|
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8=
|
||||||
|
@ -15,7 +15,7 @@ require (
|
|||||||
github.com/google/go-cmp v0.5.9
|
github.com/google/go-cmp v0.5.9
|
||||||
github.com/rubiojr/go-vhd v0.0.0-20200706105327-02e210299021
|
github.com/rubiojr/go-vhd v0.0.0-20200706105327-02e210299021
|
||||||
github.com/stretchr/testify v1.8.2
|
github.com/stretchr/testify v1.8.2
|
||||||
github.com/vmware/govmomi v0.30.0
|
github.com/vmware/govmomi v0.30.6
|
||||||
golang.org/x/crypto v0.11.0
|
golang.org/x/crypto v0.11.0
|
||||||
golang.org/x/oauth2 v0.8.0
|
golang.org/x/oauth2 v0.8.0
|
||||||
google.golang.org/api v0.114.0
|
google.golang.org/api v0.114.0
|
||||||
|
4
staging/src/k8s.io/legacy-cloud-providers/go.sum
generated
4
staging/src/k8s.io/legacy-cloud-providers/go.sum
generated
@ -337,8 +337,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
|
|||||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
|
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
|
||||||
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
github.com/vmware/govmomi v0.30.0 h1:Fm8ugPnnlMSTSceDKY9goGvjmqc6eQLPUSUeNXdpeXA=
|
github.com/vmware/govmomi v0.30.6 h1:O3tjSwQBy0XwI5uK1/yVIfQ1LP9bAECEDUfifnyGs9U=
|
||||||
github.com/vmware/govmomi v0.30.0/go.mod h1:F7adsVewLNHsW/IIm7ziFURaXDaHEwcc+ym4r3INMdY=
|
github.com/vmware/govmomi v0.30.6/go.mod h1:epgoslm97rLECMV4D+08ORzUBEU7boFSepKjt7AYVGg=
|
||||||
github.com/vmware/vmw-guestinfo v0.0.0-20170707015358-25eff159a728/go.mod h1:x9oS4Wk2s2u4tS29nEaDLdzvuHdB19CvSGJjPgkZJNk=
|
github.com/vmware/vmw-guestinfo v0.0.0-20170707015358-25eff159a728/go.mod h1:x9oS4Wk2s2u4tS29nEaDLdzvuHdB19CvSGJjPgkZJNk=
|
||||||
github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU=
|
github.com/xhit/go-str2duration/v2 v2.1.0/go.mod h1:ohY8p+0f07DiV6Em5LKB0s2YpLtXVyJfNt1+BlmyAsU=
|
||||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||||
|
21
vendor/github.com/vmware/govmomi/.goreleaser.yml
generated
vendored
21
vendor/github.com/vmware/govmomi/.goreleaser.yml
generated
vendored
@ -34,13 +34,12 @@ archives:
|
|||||||
- id: govcbuild
|
- id: govcbuild
|
||||||
builds:
|
builds:
|
||||||
- govc
|
- govc
|
||||||
name_template: "govc_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
|
name_template: >-
|
||||||
replacements: &replacements
|
govc_
|
||||||
darwin: Darwin
|
{{- title .Os }}_
|
||||||
linux: Linux
|
{{- if eq .Arch "amd64" }}x86_64
|
||||||
windows: Windows
|
{{- else if eq .Arch "386" }}i386
|
||||||
freebsd: FreeBSD
|
{{- else }}{{ .Arch }}{{ end }}
|
||||||
amd64: x86_64
|
|
||||||
format_overrides: &overrides
|
format_overrides: &overrides
|
||||||
- goos: windows
|
- goos: windows
|
||||||
format: zip
|
format: zip
|
||||||
@ -52,8 +51,12 @@ archives:
|
|||||||
- id: vcsimbuild
|
- id: vcsimbuild
|
||||||
builds:
|
builds:
|
||||||
- vcsim
|
- vcsim
|
||||||
name_template: "vcsim_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
|
name_template: >-
|
||||||
replacements: *replacements
|
vcsim_
|
||||||
|
{{- title .Os }}_
|
||||||
|
{{- if eq .Arch "amd64" }}x86_64
|
||||||
|
{{- else if eq .Arch "386" }}i386
|
||||||
|
{{- else }}{{ .Arch }}{{ end }}
|
||||||
format_overrides: *overrides
|
format_overrides: *overrides
|
||||||
files: *extrafiles
|
files: *extrafiles
|
||||||
|
|
||||||
|
14
vendor/github.com/vmware/govmomi/find/finder.go
generated
vendored
14
vendor/github.com/vmware/govmomi/find/finder.go
generated
vendored
@ -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");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with 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 {
|
if len(ns) == 0 {
|
||||||
|
net, nerr := f.networkByID(ctx, path)
|
||||||
|
if nerr == nil {
|
||||||
|
return []object.NetworkReference{net}, nil
|
||||||
|
}
|
||||||
|
|
||||||
return nil, &NotFoundError{"network", path}
|
return nil, &NotFoundError{"network", path}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -798,18 +803,13 @@ func (f *Finder) NetworkList(ctx context.Context, path string) ([]object.Network
|
|||||||
// Examples:
|
// Examples:
|
||||||
// - Name: "dvpg-1"
|
// - Name: "dvpg-1"
|
||||||
// - Inventory Path: "vds-1/dvpg-1"
|
// - Inventory Path: "vds-1/dvpg-1"
|
||||||
|
// - Cluster Path: "/dc-1/host/cluster-1/dvpg-1"
|
||||||
// - ManagedObject ID: "DistributedVirtualPortgroup:dvportgroup-53"
|
// - ManagedObject ID: "DistributedVirtualPortgroup:dvportgroup-53"
|
||||||
// - Logical Switch UUID: "da2a59b8-2450-4cb2-b5cc-79c4c1d2144c"
|
// - Logical Switch UUID: "da2a59b8-2450-4cb2-b5cc-79c4c1d2144c"
|
||||||
// - Segment ID: "/infra/segments/vnet_ce50e69b-1784-4a14-9206-ffd7f1f146f7"
|
// - Segment ID: "/infra/segments/vnet_ce50e69b-1784-4a14-9206-ffd7f1f146f7"
|
||||||
func (f *Finder) Network(ctx context.Context, path string) (object.NetworkReference, error) {
|
func (f *Finder) Network(ctx context.Context, path string) (object.NetworkReference, error) {
|
||||||
networks, err := f.NetworkList(ctx, path)
|
networks, err := f.NetworkList(ctx, path)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if _, ok := err.(*NotFoundError); ok {
|
|
||||||
net, nerr := f.networkByID(ctx, path)
|
|
||||||
if nerr == nil {
|
|
||||||
return net, nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
vendor/github.com/vmware/govmomi/internal/version/version.go
generated
vendored
2
vendor/github.com/vmware/govmomi/internal/version/version.go
generated
vendored
@ -21,5 +21,5 @@ const (
|
|||||||
ClientName = "govmomi"
|
ClientName = "govmomi"
|
||||||
|
|
||||||
// ClientVersion is the version of this SDK
|
// ClientVersion is the version of this SDK
|
||||||
ClientVersion = "0.30.0"
|
ClientVersion = "0.30.6"
|
||||||
)
|
)
|
||||||
|
4
vendor/github.com/vmware/govmomi/list/lister.go
generated
vendored
4
vendor/github.com/vmware/govmomi/list/lister.go
generated
vendored
@ -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");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with 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{
|
fields := []string{
|
||||||
"host",
|
"host",
|
||||||
|
"network",
|
||||||
"resourcePool",
|
"resourcePool",
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,6 +328,7 @@ func (l Lister) ListComputeResource(ctx context.Context) ([]Element, error) {
|
|||||||
|
|
||||||
childTypes := []string{
|
childTypes := []string{
|
||||||
"HostSystem",
|
"HostSystem",
|
||||||
|
"Network",
|
||||||
"ResourcePool",
|
"ResourcePool",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
vendor/github.com/vmware/govmomi/lookup/client.go
generated
vendored
4
vendor/github.com/vmware/govmomi/lookup/client.go
generated
vendored
@ -125,7 +125,9 @@ func EndpointURL(ctx context.Context, c *vim25.Client, path string, filter *type
|
|||||||
path = endpoint.Url
|
path = endpoint.Url
|
||||||
|
|
||||||
if u, err := url.Parse(path); err == nil {
|
if u, err := url.Parse(path); err == nil {
|
||||||
if c.Thumbprint(u.Host) == "" {
|
// Set thumbprint only for endpoints on hosts outside this vCenter.
|
||||||
|
// Platform Services may live on multiple hosts.
|
||||||
|
if c.URL().Host != u.Host && c.Thumbprint(u.Host) == "" {
|
||||||
c.SetThumbprint(u.Host, endpointThumbprint(endpoint))
|
c.SetThumbprint(u.Host, endpointThumbprint(endpoint))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
5
vendor/github.com/vmware/govmomi/object/host_certificate_info.go
generated
vendored
5
vendor/github.com/vmware/govmomi/object/host_certificate_info.go
generated
vendored
@ -86,10 +86,7 @@ func (info *HostCertificateInfo) FromURL(u *url.URL, config *tls.Config) error {
|
|||||||
|
|
||||||
conn, err := tls.Dial("tcp", addr, config)
|
conn, err := tls.Dial("tcp", addr, config)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
switch err.(type) {
|
if !soap.IsCertificateUntrusted(err) {
|
||||||
case x509.UnknownAuthorityError:
|
|
||||||
case x509.HostnameError:
|
|
||||||
default:
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
13
vendor/github.com/vmware/govmomi/object/search_index.go
generated
vendored
13
vendor/github.com/vmware/govmomi/object/search_index.go
generated
vendored
@ -93,7 +93,18 @@ func (s SearchIndex) FindByInventoryPath(ctx context.Context, path string) (Refe
|
|||||||
if res.Returnval == nil {
|
if res.Returnval == nil {
|
||||||
return nil, 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.
|
// FindByIp finds a virtual machine or host by IP address.
|
||||||
|
47
vendor/github.com/vmware/govmomi/simulator/container.go
generated
vendored
47
vendor/github.com/vmware/govmomi/simulator/container.go
generated
vendored
@ -114,6 +114,20 @@ func (c *container) inspect(vm *VirtualMachine) error {
|
|||||||
net := &vm.Guest.Net[0]
|
net := &vm.Guest.Net[0]
|
||||||
net.IpAddress = []string{s.IPAddress}
|
net.IpAddress = []string{s.IPAddress}
|
||||||
net.MacAddress = s.MacAddress
|
net.MacAddress = s.MacAddress
|
||||||
|
net.IpConfig = &types.NetIpConfigInfo{
|
||||||
|
IpAddress: []types.NetIpConfigInfoIpAddress{{
|
||||||
|
IpAddress: s.IPAddress,
|
||||||
|
PrefixLength: int32(s.IPPrefixLen),
|
||||||
|
State: string(types.NetIpConfigInfoIpAddressStatusPreferred),
|
||||||
|
}},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, d := range vm.Config.Hardware.Device {
|
||||||
|
if eth, ok := d.(types.BaseVirtualEthernetCard); ok {
|
||||||
|
eth.GetVirtualEthernetCard().MacAddress = s.MacAddress
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,6 +249,8 @@ func (c *container) start(ctx *Context, vm *VirtualMachine) {
|
|||||||
|
|
||||||
var args []string
|
var args []string
|
||||||
var env []string
|
var env []string
|
||||||
|
mountDMI := true
|
||||||
|
ports := make(map[string]string)
|
||||||
|
|
||||||
for _, opt := range vm.Config.ExtraConfig {
|
for _, opt := range vm.Config.ExtraConfig {
|
||||||
val := opt.GetOptionValue()
|
val := opt.GetOptionValue()
|
||||||
@ -247,6 +263,23 @@ func (c *container) start(ctx *Context, vm *VirtualMachine) {
|
|||||||
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
if val.Key == "RUN.mountdmi" {
|
||||||
|
var mount bool
|
||||||
|
err := json.Unmarshal([]byte(val.Value.(string)), &mount)
|
||||||
|
if err == nil {
|
||||||
|
mountDMI = mount
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if strings.HasPrefix(val.Key, "RUN.port.") {
|
||||||
|
sKey := strings.Split(val.Key, ".")
|
||||||
|
containerPort := sKey[len(sKey)-1]
|
||||||
|
ports[containerPort] = val.Value.(string)
|
||||||
|
}
|
||||||
|
if strings.HasPrefix(val.Key, "RUN.env.") {
|
||||||
|
sKey := strings.Split(val.Key, ".")
|
||||||
|
envKey := sKey[len(sKey)-1]
|
||||||
|
env = append(env, "--env", fmt.Sprintf("%s=%s", envKey, val.Value.(string)))
|
||||||
|
}
|
||||||
if strings.HasPrefix(val.Key, "guestinfo.") {
|
if strings.HasPrefix(val.Key, "guestinfo.") {
|
||||||
key := strings.Replace(strings.ToUpper(val.Key), ".", "_", -1)
|
key := strings.Replace(strings.ToUpper(val.Key), ".", "_", -1)
|
||||||
env = append(env, "--env", fmt.Sprintf("VMX_%s=%s", key, val.Value.(string)))
|
env = append(env, "--env", fmt.Sprintf("VMX_%s=%s", key, val.Value.(string)))
|
||||||
@ -260,14 +293,22 @@ func (c *container) start(ctx *Context, vm *VirtualMachine) {
|
|||||||
// Configure env as the data access method for cloud-init-vmware-guestinfo
|
// Configure env as the data access method for cloud-init-vmware-guestinfo
|
||||||
env = append(env, "--env", "VMX_GUESTINFO=true")
|
env = append(env, "--env", "VMX_GUESTINFO=true")
|
||||||
}
|
}
|
||||||
|
if len(ports) != 0 {
|
||||||
|
// Publish the specified container ports
|
||||||
|
for containerPort, hostPort := range ports {
|
||||||
|
env = append(env, "-p", fmt.Sprintf("%s:%s", hostPort, containerPort))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
c.name = fmt.Sprintf("vcsim-%s-%s", sanitizeName(vm.Name), vm.uid)
|
c.name = fmt.Sprintf("vcsim-%s-%s", sanitizeName(vm.Name), vm.uid)
|
||||||
run := append([]string{"docker", "run", "-d", "--name", c.name}, env...)
|
run := append([]string{"docker", "run", "-d", "--name", c.name}, env...)
|
||||||
|
|
||||||
if err := c.createDMI(vm, c.name); err != nil {
|
if mountDMI {
|
||||||
return
|
if err := c.createDMI(vm, c.name); err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
run = append(run, "-v", fmt.Sprintf("%s:%s:ro", c.name, "/sys/class/dmi/id"))
|
||||||
}
|
}
|
||||||
run = append(run, "-v", fmt.Sprintf("%s:%s:ro", c.name, "/sys/class/dmi/id"))
|
|
||||||
|
|
||||||
args = append(run, args...)
|
args = append(run, args...)
|
||||||
cmd := exec.Command(shell, "-c", strings.Join(args, " "))
|
cmd := exec.Command(shell, "-c", strings.Join(args, " "))
|
||||||
|
2
vendor/github.com/vmware/govmomi/simulator/esx/host_system.go
generated
vendored
2
vendor/github.com/vmware/govmomi/simulator/esx/host_system.go
generated
vendored
@ -52,7 +52,7 @@ var HostSystem = mo.HostSystem{
|
|||||||
DynamicData: types.DynamicData{},
|
DynamicData: types.DynamicData{},
|
||||||
ConnectionState: "connected",
|
ConnectionState: "connected",
|
||||||
PowerState: "poweredOn",
|
PowerState: "poweredOn",
|
||||||
StandbyMode: "",
|
StandbyMode: "none",
|
||||||
InMaintenanceMode: false,
|
InMaintenanceMode: false,
|
||||||
BootTime: (*time.Time)(nil),
|
BootTime: (*time.Time)(nil),
|
||||||
HealthSystemRuntime: &types.HealthSystemRuntime{
|
HealthSystemRuntime: &types.HealthSystemRuntime{
|
||||||
|
47
vendor/github.com/vmware/govmomi/simulator/guest_id.go
generated
vendored
47
vendor/github.com/vmware/govmomi/simulator/guest_id.go
generated
vendored
@ -53,9 +53,22 @@ var GuestID = []types.VirtualMachineGuestOsIdentifier{
|
|||||||
types.VirtualMachineGuestOsIdentifierWindows9Guest,
|
types.VirtualMachineGuestOsIdentifierWindows9Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierWindows9_64Guest,
|
types.VirtualMachineGuestOsIdentifierWindows9_64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierWindows9Server64Guest,
|
types.VirtualMachineGuestOsIdentifierWindows9Server64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierWindows11_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierWindows12_64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierWindowsHyperVGuest,
|
types.VirtualMachineGuestOsIdentifierWindowsHyperVGuest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierWindows2019srv_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierWindows2019srvNext_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierWindows2022srvNext_64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierFreebsdGuest,
|
types.VirtualMachineGuestOsIdentifierFreebsdGuest,
|
||||||
types.VirtualMachineGuestOsIdentifierFreebsd64Guest,
|
types.VirtualMachineGuestOsIdentifierFreebsd64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierFreebsd11Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierFreebsd11_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierFreebsd12Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierFreebsd12_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierFreebsd13Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierFreebsd13_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierFreebsd14Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierFreebsd14_64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierRedhatGuest,
|
types.VirtualMachineGuestOsIdentifierRedhatGuest,
|
||||||
types.VirtualMachineGuestOsIdentifierRhel2Guest,
|
types.VirtualMachineGuestOsIdentifierRhel2Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierRhel3Guest,
|
types.VirtualMachineGuestOsIdentifierRhel3Guest,
|
||||||
@ -68,18 +81,24 @@ var GuestID = []types.VirtualMachineGuestOsIdentifier{
|
|||||||
types.VirtualMachineGuestOsIdentifierRhel6_64Guest,
|
types.VirtualMachineGuestOsIdentifierRhel6_64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierRhel7Guest,
|
types.VirtualMachineGuestOsIdentifierRhel7Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierRhel7_64Guest,
|
types.VirtualMachineGuestOsIdentifierRhel7_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierRhel8_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierRhel9_64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierCentosGuest,
|
types.VirtualMachineGuestOsIdentifierCentosGuest,
|
||||||
types.VirtualMachineGuestOsIdentifierCentos64Guest,
|
types.VirtualMachineGuestOsIdentifierCentos64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierCentos6Guest,
|
types.VirtualMachineGuestOsIdentifierCentos6Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierCentos6_64Guest,
|
types.VirtualMachineGuestOsIdentifierCentos6_64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierCentos7Guest,
|
types.VirtualMachineGuestOsIdentifierCentos7Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierCentos7_64Guest,
|
types.VirtualMachineGuestOsIdentifierCentos7_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierCentos8_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierCentos9_64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierOracleLinuxGuest,
|
types.VirtualMachineGuestOsIdentifierOracleLinuxGuest,
|
||||||
types.VirtualMachineGuestOsIdentifierOracleLinux64Guest,
|
types.VirtualMachineGuestOsIdentifierOracleLinux64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierOracleLinux6Guest,
|
types.VirtualMachineGuestOsIdentifierOracleLinux6Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierOracleLinux6_64Guest,
|
types.VirtualMachineGuestOsIdentifierOracleLinux6_64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierOracleLinux7Guest,
|
types.VirtualMachineGuestOsIdentifierOracleLinux7Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierOracleLinux7_64Guest,
|
types.VirtualMachineGuestOsIdentifierOracleLinux7_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierOracleLinux8_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierOracleLinux9_64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierSuseGuest,
|
types.VirtualMachineGuestOsIdentifierSuseGuest,
|
||||||
types.VirtualMachineGuestOsIdentifierSuse64Guest,
|
types.VirtualMachineGuestOsIdentifierSuse64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierSlesGuest,
|
types.VirtualMachineGuestOsIdentifierSlesGuest,
|
||||||
@ -90,6 +109,8 @@ var GuestID = []types.VirtualMachineGuestOsIdentifier{
|
|||||||
types.VirtualMachineGuestOsIdentifierSles11_64Guest,
|
types.VirtualMachineGuestOsIdentifierSles11_64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierSles12Guest,
|
types.VirtualMachineGuestOsIdentifierSles12Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierSles12_64Guest,
|
types.VirtualMachineGuestOsIdentifierSles12_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierSles15_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierSles16_64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierNld9Guest,
|
types.VirtualMachineGuestOsIdentifierNld9Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierOesGuest,
|
types.VirtualMachineGuestOsIdentifierOesGuest,
|
||||||
types.VirtualMachineGuestOsIdentifierSjdsGuest,
|
types.VirtualMachineGuestOsIdentifierSjdsGuest,
|
||||||
@ -114,12 +135,18 @@ var GuestID = []types.VirtualMachineGuestOsIdentifier{
|
|||||||
types.VirtualMachineGuestOsIdentifierDebian9_64Guest,
|
types.VirtualMachineGuestOsIdentifierDebian9_64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierDebian10Guest,
|
types.VirtualMachineGuestOsIdentifierDebian10Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierDebian10_64Guest,
|
types.VirtualMachineGuestOsIdentifierDebian10_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierDebian11Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierDebian11_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierDebian12Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierDebian12_64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierAsianux3Guest,
|
types.VirtualMachineGuestOsIdentifierAsianux3Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierAsianux3_64Guest,
|
types.VirtualMachineGuestOsIdentifierAsianux3_64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierAsianux4Guest,
|
types.VirtualMachineGuestOsIdentifierAsianux4Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierAsianux4_64Guest,
|
types.VirtualMachineGuestOsIdentifierAsianux4_64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierAsianux5_64Guest,
|
types.VirtualMachineGuestOsIdentifierAsianux5_64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierAsianux7_64Guest,
|
types.VirtualMachineGuestOsIdentifierAsianux7_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierAsianux8_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierAsianux9_64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierOpensuseGuest,
|
types.VirtualMachineGuestOsIdentifierOpensuseGuest,
|
||||||
types.VirtualMachineGuestOsIdentifierOpensuse64Guest,
|
types.VirtualMachineGuestOsIdentifierOpensuse64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierFedoraGuest,
|
types.VirtualMachineGuestOsIdentifierFedoraGuest,
|
||||||
@ -130,10 +157,16 @@ var GuestID = []types.VirtualMachineGuestOsIdentifier{
|
|||||||
types.VirtualMachineGuestOsIdentifierOther26xLinuxGuest,
|
types.VirtualMachineGuestOsIdentifierOther26xLinuxGuest,
|
||||||
types.VirtualMachineGuestOsIdentifierOtherLinuxGuest,
|
types.VirtualMachineGuestOsIdentifierOtherLinuxGuest,
|
||||||
types.VirtualMachineGuestOsIdentifierOther3xLinuxGuest,
|
types.VirtualMachineGuestOsIdentifierOther3xLinuxGuest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierOther4xLinuxGuest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierOther5xLinuxGuest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierOther6xLinuxGuest,
|
||||||
types.VirtualMachineGuestOsIdentifierGenericLinuxGuest,
|
types.VirtualMachineGuestOsIdentifierGenericLinuxGuest,
|
||||||
types.VirtualMachineGuestOsIdentifierOther24xLinux64Guest,
|
types.VirtualMachineGuestOsIdentifierOther24xLinux64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierOther26xLinux64Guest,
|
types.VirtualMachineGuestOsIdentifierOther26xLinux64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierOther3xLinux64Guest,
|
types.VirtualMachineGuestOsIdentifierOther3xLinux64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierOther4xLinux64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierOther5xLinux64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierOther6xLinux64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierOtherLinux64Guest,
|
types.VirtualMachineGuestOsIdentifierOtherLinux64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierSolaris6Guest,
|
types.VirtualMachineGuestOsIdentifierSolaris6Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierSolaris7Guest,
|
types.VirtualMachineGuestOsIdentifierSolaris7Guest,
|
||||||
@ -162,10 +195,24 @@ var GuestID = []types.VirtualMachineGuestOsIdentifier{
|
|||||||
types.VirtualMachineGuestOsIdentifierDarwin14_64Guest,
|
types.VirtualMachineGuestOsIdentifierDarwin14_64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierDarwin15_64Guest,
|
types.VirtualMachineGuestOsIdentifierDarwin15_64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierDarwin16_64Guest,
|
types.VirtualMachineGuestOsIdentifierDarwin16_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierDarwin17_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierDarwin18_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierDarwin19_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierDarwin20_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierDarwin21_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierDarwin22_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierDarwin23_64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierVmkernelGuest,
|
types.VirtualMachineGuestOsIdentifierVmkernelGuest,
|
||||||
types.VirtualMachineGuestOsIdentifierVmkernel5Guest,
|
types.VirtualMachineGuestOsIdentifierVmkernel5Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierVmkernel6Guest,
|
types.VirtualMachineGuestOsIdentifierVmkernel6Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierVmkernel65Guest,
|
types.VirtualMachineGuestOsIdentifierVmkernel65Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierVmkernel7Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierVmkernel8Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierAmazonlinux2_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierAmazonlinux3_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierCrxPod1Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierRockylinux_64Guest,
|
||||||
|
types.VirtualMachineGuestOsIdentifierAlmalinux_64Guest,
|
||||||
types.VirtualMachineGuestOsIdentifierOtherGuest,
|
types.VirtualMachineGuestOsIdentifierOtherGuest,
|
||||||
types.VirtualMachineGuestOsIdentifierOtherGuest64,
|
types.VirtualMachineGuestOsIdentifierOtherGuest64,
|
||||||
}
|
}
|
||||||
|
65
vendor/github.com/vmware/govmomi/simulator/performance_manager.go
generated
vendored
65
vendor/github.com/vmware/govmomi/simulator/performance_manager.go
generated
vendored
@ -19,6 +19,7 @@ package simulator
|
|||||||
import (
|
import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/vmware/govmomi/simulator/esx"
|
"github.com/vmware/govmomi/simulator/esx"
|
||||||
@ -174,9 +175,6 @@ func (p *PerformanceManager) QueryPerf(ctx *Context, req *types.QueryPerf) soap.
|
|||||||
body.Res.Returnval = make([]types.BasePerfEntityMetricBase, len(req.QuerySpec))
|
body.Res.Returnval = make([]types.BasePerfEntityMetricBase, len(req.QuerySpec))
|
||||||
|
|
||||||
for i, qs := range req.QuerySpec {
|
for i, qs := range req.QuerySpec {
|
||||||
metrics := new(types.PerfEntityMetric)
|
|
||||||
metrics.Entity = qs.Entity
|
|
||||||
|
|
||||||
// Get metric data for this entity type
|
// Get metric data for this entity type
|
||||||
metricData, ok := p.metricData[qs.Entity.Type]
|
metricData, ok := p.metricData[qs.Entity.Type]
|
||||||
if !ok {
|
if !ok {
|
||||||
@ -202,10 +200,13 @@ func (p *PerformanceManager) QueryPerf(ctx *Context, req *types.QueryPerf) soap.
|
|||||||
interval = 20 // TODO: Determine from entity type
|
interval = 20 // TODO: Determine from entity type
|
||||||
}
|
}
|
||||||
n := 1 + int32(end.Sub(start).Seconds())/interval
|
n := 1 + int32(end.Sub(start).Seconds())/interval
|
||||||
if n > qs.MaxSample {
|
if qs.MaxSample > 0 && n > qs.MaxSample {
|
||||||
n = qs.MaxSample
|
n = qs.MaxSample
|
||||||
}
|
}
|
||||||
|
|
||||||
|
metrics := new(types.PerfEntityMetric)
|
||||||
|
metrics.Entity = qs.Entity
|
||||||
|
|
||||||
// Loop through each interval "tick"
|
// Loop through each interval "tick"
|
||||||
metrics.SampleInfo = make([]types.PerfSampleInfo, n)
|
metrics.SampleInfo = make([]types.PerfSampleInfo, n)
|
||||||
metrics.Value = make([]types.BasePerfMetricSeries, len(qs.MetricId))
|
metrics.Value = make([]types.BasePerfMetricSeries, len(qs.MetricId))
|
||||||
@ -213,10 +214,11 @@ func (p *PerformanceManager) QueryPerf(ctx *Context, req *types.QueryPerf) soap.
|
|||||||
metrics.SampleInfo[tick] = types.PerfSampleInfo{Timestamp: end.Add(time.Duration(-interval*tick) * time.Second), Interval: interval}
|
metrics.SampleInfo[tick] = types.PerfSampleInfo{Timestamp: end.Add(time.Duration(-interval*tick) * time.Second), Interval: interval}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
series := make([]*types.PerfMetricIntSeries, len(qs.MetricId))
|
||||||
for j, mid := range qs.MetricId {
|
for j, mid := range qs.MetricId {
|
||||||
// Create list of metrics for this tick
|
// Create list of metrics for this tick
|
||||||
series := &types.PerfMetricIntSeries{Value: make([]int64, n)}
|
series[j] = &types.PerfMetricIntSeries{Value: make([]int64, n)}
|
||||||
series.Id = mid
|
series[j].Id = mid
|
||||||
points := metricData[mid.CounterId]
|
points := metricData[mid.CounterId]
|
||||||
offset := int64(start.Unix()) / int64(interval)
|
offset := int64(start.Unix()) / int64(interval)
|
||||||
|
|
||||||
@ -237,11 +239,56 @@ func (p *PerformanceManager) QueryPerf(ctx *Context, req *types.QueryPerf) soap.
|
|||||||
} else {
|
} else {
|
||||||
p = 0
|
p = 0
|
||||||
}
|
}
|
||||||
series.Value[tick] = p
|
series[j].Value[tick] = p
|
||||||
}
|
}
|
||||||
metrics.Value[j] = series
|
metrics.Value[j] = series[j]
|
||||||
|
}
|
||||||
|
|
||||||
|
if qs.Format == string(types.PerfFormatCsv) {
|
||||||
|
metricsCsv := new(types.PerfEntityMetricCSV)
|
||||||
|
metricsCsv.Entity = qs.Entity
|
||||||
|
|
||||||
|
//PerfSampleInfo encoded in the following CSV format: [interval1], [date1], [interval2], [date2], and so on.
|
||||||
|
metricsCsv.SampleInfoCSV = sampleInfoCSV(metrics)
|
||||||
|
metricsCsv.Value = make([]types.PerfMetricSeriesCSV, len(qs.MetricId))
|
||||||
|
|
||||||
|
for j, mid := range qs.MetricId {
|
||||||
|
seriesCsv := &types.PerfMetricSeriesCSV{Value: ""}
|
||||||
|
seriesCsv.Id = mid
|
||||||
|
seriesCsv.Value = valueCSV(series[j])
|
||||||
|
metricsCsv.Value[j] = *seriesCsv
|
||||||
|
}
|
||||||
|
|
||||||
|
body.Res.Returnval[i] = metricsCsv
|
||||||
|
} else {
|
||||||
|
body.Res.Returnval[i] = metrics
|
||||||
}
|
}
|
||||||
body.Res.Returnval[i] = metrics
|
|
||||||
}
|
}
|
||||||
return body
|
return body
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sampleInfoCSV converts the SampleInfo field to a CSV string
|
||||||
|
func sampleInfoCSV(m *types.PerfEntityMetric) string {
|
||||||
|
values := make([]string, len(m.SampleInfo)*2)
|
||||||
|
|
||||||
|
i := 0
|
||||||
|
for _, s := range m.SampleInfo {
|
||||||
|
values[i] = strconv.Itoa(int(s.Interval))
|
||||||
|
i++
|
||||||
|
values[i] = s.Timestamp.Format(time.RFC3339)
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.Join(values, ",")
|
||||||
|
}
|
||||||
|
|
||||||
|
// valueCSV converts the Value field to a CSV string
|
||||||
|
func valueCSV(s *types.PerfMetricIntSeries) string {
|
||||||
|
values := make([]string, len(s.Value))
|
||||||
|
|
||||||
|
for i := range s.Value {
|
||||||
|
values[i] = strconv.FormatInt(s.Value[i], 10)
|
||||||
|
}
|
||||||
|
|
||||||
|
return strings.Join(values, ",")
|
||||||
|
}
|
||||||
|
11
vendor/github.com/vmware/govmomi/simulator/search_index.go
generated
vendored
11
vendor/github.com/vmware/govmomi/simulator/search_index.go
generated
vendored
@ -53,6 +53,14 @@ func (s *SearchIndex) FindByDatastorePath(r *types.FindByDatastorePath) soap.Has
|
|||||||
func (s *SearchIndex) FindByInventoryPath(req *types.FindByInventoryPath) soap.HasFault {
|
func (s *SearchIndex) FindByInventoryPath(req *types.FindByInventoryPath) soap.HasFault {
|
||||||
body := &methods.FindByInventoryPathBody{Res: new(types.FindByInventoryPathResponse)}
|
body := &methods.FindByInventoryPathBody{Res: new(types.FindByInventoryPathResponse)}
|
||||||
|
|
||||||
|
root := Map.content().RootFolder
|
||||||
|
o := &root
|
||||||
|
|
||||||
|
if req.InventoryPath == "/" {
|
||||||
|
body.Res.Returnval = o
|
||||||
|
return body
|
||||||
|
}
|
||||||
|
|
||||||
split := func(c rune) bool {
|
split := func(c rune) bool {
|
||||||
return c == '/'
|
return c == '/'
|
||||||
}
|
}
|
||||||
@ -61,9 +69,6 @@ func (s *SearchIndex) FindByInventoryPath(req *types.FindByInventoryPath) soap.H
|
|||||||
return body
|
return body
|
||||||
}
|
}
|
||||||
|
|
||||||
root := Map.content().RootFolder
|
|
||||||
o := &root
|
|
||||||
|
|
||||||
for _, name := range path {
|
for _, name := range path {
|
||||||
f := s.FindChild(&types.FindChild{Entity: *o, Name: name})
|
f := s.FindChild(&types.FindChild{Entity: *o, Name: name})
|
||||||
|
|
||||||
|
25
vendor/github.com/vmware/govmomi/simulator/session_manager.go
generated
vendored
25
vendor/github.com/vmware/govmomi/simulator/session_manager.go
generated
vendored
@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2017-2018 VMware, Inc. All Rights Reserved.
|
Copyright (c) 2017-2023 VMware, Inc. All Rights Reserved.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
@ -20,6 +20,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
@ -41,6 +42,7 @@ type SessionManager struct {
|
|||||||
|
|
||||||
ServiceHostName string
|
ServiceHostName string
|
||||||
TLSCert func() string
|
TLSCert func() string
|
||||||
|
ValidLogin func(*types.Login) bool
|
||||||
|
|
||||||
sessions map[string]Session
|
sessions map[string]Session
|
||||||
}
|
}
|
||||||
@ -106,22 +108,23 @@ func (m *SessionManager) putSession(s Session) {
|
|||||||
m.sessions[s.Key] = s
|
m.sessions[s.Key] = s
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SessionManager) validLogin(ctx *Context, req *types.Login) bool {
|
func (s *SessionManager) Authenticate(u url.URL, req *types.Login) bool {
|
||||||
if ctx.Session != nil {
|
if u.User == nil || u.User == DefaultLogin {
|
||||||
return false
|
|
||||||
}
|
|
||||||
user := ctx.svc.Listen.User
|
|
||||||
if user == nil || user == DefaultLogin {
|
|
||||||
return req.UserName != "" && req.Password != ""
|
return req.UserName != "" && req.Password != ""
|
||||||
}
|
}
|
||||||
pass, _ := user.Password()
|
|
||||||
return req.UserName == user.Username() && req.Password == pass
|
if s.ValidLogin != nil {
|
||||||
|
return s.ValidLogin(req)
|
||||||
|
}
|
||||||
|
|
||||||
|
pass, _ := u.User.Password()
|
||||||
|
return req.UserName == u.User.Username() && req.Password == pass
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SessionManager) Login(ctx *Context, req *types.Login) soap.HasFault {
|
func (s *SessionManager) Login(ctx *Context, req *types.Login) soap.HasFault {
|
||||||
body := new(methods.LoginBody)
|
body := new(methods.LoginBody)
|
||||||
|
|
||||||
if s.validLogin(ctx, req) {
|
if ctx.Session == nil && s.Authenticate(*ctx.svc.Listen, req) {
|
||||||
body.Res = &types.LoginResponse{
|
body.Res = &types.LoginResponse{
|
||||||
Returnval: createSession(ctx, req.UserName, req.Locale),
|
Returnval: createSession(ctx, req.UserName, req.Locale),
|
||||||
}
|
}
|
||||||
|
4
vendor/github.com/vmware/govmomi/simulator/view_manager.go
generated
vendored
4
vendor/github.com/vmware/govmomi/simulator/view_manager.go
generated
vendored
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2017 VMware, Inc. All Rights Reserved.
|
Copyright (c) 2017-2023 VMware, Inc. All Rights Reserved.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
@ -154,6 +154,8 @@ func walk(root mo.Reference, f func(child types.ManagedObjectReference)) {
|
|||||||
children = []types.ManagedObjectReference{e.VmFolder, e.HostFolder, e.DatastoreFolder, e.NetworkFolder}
|
children = []types.ManagedObjectReference{e.VmFolder, e.HostFolder, e.DatastoreFolder, e.NetworkFolder}
|
||||||
case *mo.Folder:
|
case *mo.Folder:
|
||||||
children = e.ChildEntity
|
children = e.ChildEntity
|
||||||
|
case *mo.StoragePod:
|
||||||
|
children = e.ChildEntity
|
||||||
case *mo.ComputeResource:
|
case *mo.ComputeResource:
|
||||||
children = e.Host
|
children = e.Host
|
||||||
children = append(children, *e.ResourcePool)
|
children = append(children, *e.ResourcePool)
|
||||||
|
15
vendor/github.com/vmware/govmomi/vapi/simulator/simulator.go
generated
vendored
15
vendor/github.com/vmware/govmomi/vapi/simulator/simulator.go
generated
vendored
@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (c) 2018-2022 VMware, Inc. All Rights Reserved.
|
Copyright (c) 2018-2023 VMware, Inc. All Rights Reserved.
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
You may obtain a copy of the License at
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
@ -88,6 +88,7 @@ type download struct {
|
|||||||
|
|
||||||
type handler struct {
|
type handler struct {
|
||||||
sync.Mutex
|
sync.Mutex
|
||||||
|
sm *simulator.SessionManager
|
||||||
ServeMux *http.ServeMux
|
ServeMux *http.ServeMux
|
||||||
URL url.URL
|
URL url.URL
|
||||||
Category map[string]*tags.Category
|
Category map[string]*tags.Category
|
||||||
@ -104,7 +105,7 @@ type handler struct {
|
|||||||
func init() {
|
func init() {
|
||||||
simulator.RegisterEndpoint(func(s *simulator.Service, r *simulator.Registry) {
|
simulator.RegisterEndpoint(func(s *simulator.Service, r *simulator.Registry) {
|
||||||
if r.IsVPX() {
|
if r.IsVPX() {
|
||||||
patterns, h := New(s.Listen, r.OptionManager().Setting)
|
patterns, h := New(s.Listen, r)
|
||||||
for _, p := range patterns {
|
for _, p := range patterns {
|
||||||
s.Handle(p, h)
|
s.Handle(p, h)
|
||||||
}
|
}
|
||||||
@ -113,8 +114,9 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// New creates a vAPI simulator.
|
// New creates a vAPI simulator.
|
||||||
func New(u *url.URL, settings []vim.BaseOptionValue) ([]string, http.Handler) {
|
func New(u *url.URL, r *simulator.Registry) ([]string, http.Handler) {
|
||||||
s := &handler{
|
s := &handler{
|
||||||
|
sm: r.SessionManager(),
|
||||||
ServeMux: http.NewServeMux(),
|
ServeMux: http.NewServeMux(),
|
||||||
URL: *u,
|
URL: *u,
|
||||||
Category: make(map[string]*tags.Category),
|
Category: make(map[string]*tags.Category),
|
||||||
@ -237,10 +239,7 @@ func (s *handler) isAuthorized(r *http.Request) bool {
|
|||||||
func (s *handler) hasAuthorization(r *http.Request) (string, bool) {
|
func (s *handler) hasAuthorization(r *http.Request) (string, bool) {
|
||||||
u, p, ok := r.BasicAuth()
|
u, p, ok := r.BasicAuth()
|
||||||
if ok { // user+pass auth
|
if ok { // user+pass auth
|
||||||
if u == "" || p == "" {
|
return u, s.sm.Authenticate(s.URL, &vim.Login{UserName: u, Password: p})
|
||||||
return u, false
|
|
||||||
}
|
|
||||||
return u, true
|
|
||||||
}
|
}
|
||||||
auth := r.Header.Get("Authorization")
|
auth := r.Header.Get("Authorization")
|
||||||
return "TODO", strings.HasPrefix(auth, "SIGN ") // token auth
|
return "TODO", strings.HasPrefix(auth, "SIGN ") // token auth
|
||||||
|
26
vendor/github.com/vmware/govmomi/vim25/soap/client.go
generated
vendored
26
vendor/github.com/vmware/govmomi/vim25/soap/client.go
generated
vendored
@ -369,24 +369,10 @@ func (c *Client) dialTLSContext(
|
|||||||
return conn, nil
|
return conn, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
switch err.(type) {
|
// Allow a thumbprint verification attempt if the error indicates
|
||||||
case x509.UnknownAuthorityError:
|
// the failure was due to lack of trust.
|
||||||
case x509.HostnameError:
|
if !IsCertificateUntrusted(err) {
|
||||||
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)
|
thumbprint := c.Thumbprint(addr)
|
||||||
@ -411,10 +397,6 @@ func (c *Client) dialTLSContext(
|
|||||||
return conn, nil
|
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,
|
// splitHostPort is similar to net.SplitHostPort,
|
||||||
// but rather than return error if there isn't a ':port',
|
// but rather than return error if there isn't a ':port',
|
||||||
// return an empty string for the port.
|
// return an empty string for the port.
|
||||||
|
37
vendor/github.com/vmware/govmomi/vim25/soap/error.go
generated
vendored
37
vendor/github.com/vmware/govmomi/vim25/soap/error.go
generated
vendored
@ -17,9 +17,12 @@ limitations under the License.
|
|||||||
package soap
|
package soap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/x509"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/vmware/govmomi/vim25/types"
|
"github.com/vmware/govmomi/vim25/types"
|
||||||
)
|
)
|
||||||
@ -127,3 +130,37 @@ func IsVimFault(err error) bool {
|
|||||||
func ToVimFault(err error) types.BaseMethodFault {
|
func ToVimFault(err error) types.BaseMethodFault {
|
||||||
return err.(vimFaultError).fault
|
return err.(vimFaultError).fault
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsCertificateUntrusted(err error) bool {
|
||||||
|
// golang 1.20 introduce a new type to wrap 509 errors. So instead of
|
||||||
|
// casting the type, now we check the error chain contains the
|
||||||
|
// x509 error or not.
|
||||||
|
x509UnknownAuthorityErr := &x509.UnknownAuthorityError{}
|
||||||
|
ok := errors.As(err, x509UnknownAuthorityErr)
|
||||||
|
if ok {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
x509HostNameErr := &x509.HostnameError{}
|
||||||
|
ok = errors.As(err, x509HostNameErr)
|
||||||
|
if ok {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// The err variable may not be a special type of x509 or HTTP
|
||||||
|
// error that can be validated by a type assertion. The err variable is
|
||||||
|
// in fact be an *errors.errorString.
|
||||||
|
|
||||||
|
msgs := []string{
|
||||||
|
"certificate is not trusted",
|
||||||
|
"certificate signed by unknown authority",
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, msg := range msgs {
|
||||||
|
if strings.HasSuffix(err.Error(), msg) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
4
vendor/modules.txt
vendored
4
vendor/modules.txt
vendored
@ -678,8 +678,8 @@ github.com/vishvananda/netlink/nl
|
|||||||
# github.com/vishvananda/netns v0.0.4
|
# github.com/vishvananda/netns v0.0.4
|
||||||
## explicit; go 1.17
|
## explicit; go 1.17
|
||||||
github.com/vishvananda/netns
|
github.com/vishvananda/netns
|
||||||
# github.com/vmware/govmomi v0.30.0
|
# github.com/vmware/govmomi v0.30.6
|
||||||
## explicit; go 1.17
|
## explicit; go 1.19
|
||||||
github.com/vmware/govmomi
|
github.com/vmware/govmomi
|
||||||
github.com/vmware/govmomi/find
|
github.com/vmware/govmomi/find
|
||||||
github.com/vmware/govmomi/history
|
github.com/vmware/govmomi/history
|
||||||
|
Loading…
Reference in New Issue
Block a user