Update osbuild/images to v0.79.0
Signed-off-by: Tomáš Hozza <thozza@redhat.com>
This commit is contained in:
parent
9fcbcdb5dc
commit
62d8ad4efe
340 changed files with 15526 additions and 2999 deletions
2
vendor/github.com/vmware/govmomi/govc/flags/datacenter.go
generated
vendored
2
vendor/github.com/vmware/govmomi/govc/flags/datacenter.go
generated
vendored
|
|
@ -174,7 +174,7 @@ func (flag *DatacenterFlag) ManagedObject(ctx context.Context, arg string) (type
|
|||
for _, o := range l {
|
||||
objs = append(objs, o.Object.Reference())
|
||||
}
|
||||
return ref, fmt.Errorf("%d objects at path %q: %s", len(l), arg, objs)
|
||||
return ref, fmt.Errorf("%d objects match %q: %s (unique inventory path required)", len(l), arg, objs)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
14
vendor/github.com/vmware/govmomi/internal/helpers.go
generated
vendored
14
vendor/github.com/vmware/govmomi/internal/helpers.go
generated
vendored
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
Copyright (c) 2020-2023 VMware, Inc. All Rights Reserved.
|
||||
Copyright (c) 2020-2024 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
|
||||
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,
|
||||
|
|
@ -24,6 +24,7 @@ import (
|
|||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"slices"
|
||||
|
||||
"github.com/vmware/govmomi/vim25"
|
||||
"github.com/vmware/govmomi/vim25/mo"
|
||||
|
|
@ -51,6 +52,15 @@ func InventoryPath(entities []mo.ManagedEntity) string {
|
|||
return val
|
||||
}
|
||||
|
||||
var vsanFS = []string{
|
||||
string(types.HostFileSystemVolumeFileSystemTypeVsan),
|
||||
string(types.HostFileSystemVolumeFileSystemTypeVVOL),
|
||||
}
|
||||
|
||||
func IsDatastoreVSAN(ds mo.Datastore) bool {
|
||||
return slices.Contains(vsanFS, ds.Summary.Type)
|
||||
}
|
||||
|
||||
func HostSystemManagementIPs(config []types.VirtualNicManagerNetConfig) []net.IP {
|
||||
var ips []net.IP
|
||||
|
||||
|
|
|
|||
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"
|
||||
|
||||
// ClientVersion is the version of this SDK
|
||||
ClientVersion = "0.39.0"
|
||||
ClientVersion = "0.42.0"
|
||||
)
|
||||
|
|
|
|||
23
vendor/github.com/vmware/govmomi/object/namespace_manager.go
generated
vendored
23
vendor/github.com/vmware/govmomi/object/namespace_manager.go
generated
vendored
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
Copyright (c) 2015 VMware, Inc. All Rights Reserved.
|
||||
Copyright (c) 2016-2024 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
|
||||
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,
|
||||
|
|
@ -74,3 +74,22 @@ func (nm DatastoreNamespaceManager) DeleteDirectory(ctx context.Context, dc *Dat
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (nm DatastoreNamespaceManager) ConvertNamespacePathToUuidPath(ctx context.Context, dc *Datacenter, datastoreURL string) (string, error) {
|
||||
req := &types.ConvertNamespacePathToUuidPath{
|
||||
This: nm.Reference(),
|
||||
NamespaceUrl: datastoreURL,
|
||||
}
|
||||
|
||||
if dc != nil {
|
||||
ref := dc.Reference()
|
||||
req.Datacenter = &ref
|
||||
}
|
||||
|
||||
res, err := methods.ConvertNamespacePathToUuidPath(ctx, nm.c, req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return res.Returnval, nil
|
||||
}
|
||||
|
|
|
|||
61
vendor/github.com/vmware/govmomi/object/option_value_list.go
generated
vendored
61
vendor/github.com/vmware/govmomi/object/option_value_list.go
generated
vendored
|
|
@ -19,6 +19,8 @@ package object
|
|||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"slices"
|
||||
"strings"
|
||||
|
||||
"github.com/vmware/govmomi/vim25/types"
|
||||
)
|
||||
|
|
@ -44,6 +46,65 @@ func OptionValueListFromMap[T any](in map[string]T) OptionValueList {
|
|||
return out
|
||||
}
|
||||
|
||||
// IsTrue returns true if the specified key exists with an empty value or value
|
||||
// equal to 1, "1", "on", "t", true, "true", "y", or "yes".
|
||||
// All string comparisons are case-insensitive.
|
||||
func (ov OptionValueList) IsTrue(key string) bool {
|
||||
return ov.isTrueOrFalse(key, true, 1, "", "1", "on", "t", "true", "y", "yes")
|
||||
}
|
||||
|
||||
// IsFalse returns true if the specified key exists and has a value equal to
|
||||
// 0, "0", "f", false, "false", "n", "no", or "off".
|
||||
// All string comparisons are case-insensitive.
|
||||
func (ov OptionValueList) IsFalse(key string) bool {
|
||||
return ov.isTrueOrFalse(key, false, 0, "0", "f", "false", "n", "no", "off")
|
||||
}
|
||||
|
||||
func (ov OptionValueList) isTrueOrFalse(
|
||||
key string,
|
||||
boolVal bool,
|
||||
numVal int,
|
||||
strVals ...string) bool {
|
||||
|
||||
val, ok := ov.Get(key)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
|
||||
switch tval := val.(type) {
|
||||
case string:
|
||||
return slices.Contains(strVals, strings.ToLower(tval))
|
||||
case bool:
|
||||
return tval == boolVal
|
||||
case uint:
|
||||
return tval == uint(numVal)
|
||||
case uint8:
|
||||
return tval == uint8(numVal)
|
||||
case uint16:
|
||||
return tval == uint16(numVal)
|
||||
case uint32:
|
||||
return tval == uint32(numVal)
|
||||
case uint64:
|
||||
return tval == uint64(numVal)
|
||||
case int:
|
||||
return tval == int(numVal)
|
||||
case int8:
|
||||
return tval == int8(numVal)
|
||||
case int16:
|
||||
return tval == int16(numVal)
|
||||
case int32:
|
||||
return tval == int32(numVal)
|
||||
case int64:
|
||||
return tval == int64(numVal)
|
||||
case float32:
|
||||
return tval == float32(numVal)
|
||||
case float64:
|
||||
return tval == float64(numVal)
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// Get returns the value if exists, otherwise nil is returned. The second return
|
||||
// value is a flag indicating whether the value exists or nil was the actual
|
||||
// value.
|
||||
|
|
|
|||
6
vendor/github.com/vmware/govmomi/ovf/importer/spec.go
generated
vendored
6
vendor/github.com/vmware/govmomi/ovf/importer/spec.go
generated
vendored
|
|
@ -99,9 +99,9 @@ func Spec(fpath string, a Archive, hidden, verbose bool) (*Options, error) {
|
|||
}
|
||||
|
||||
o := Options{
|
||||
DiskProvisioning: allDiskProvisioningOptions[0],
|
||||
IPAllocationPolicy: allIPAllocationPolicyOptions[0],
|
||||
IPProtocol: allIPProtocolOptions[0],
|
||||
DiskProvisioning: string(types.OvfCreateImportSpecParamsDiskProvisioningTypeFlat),
|
||||
IPAllocationPolicy: string(types.VAppIPAssignmentInfoIpAllocationPolicyDhcpPolicy),
|
||||
IPProtocol: string(types.VAppIPAssignmentInfoProtocolsIPv4),
|
||||
MarkAsTemplate: false,
|
||||
PowerOn: false,
|
||||
WaitForIP: false,
|
||||
|
|
|
|||
253
vendor/github.com/vmware/govmomi/ovf/parser.go
generated
vendored
Normal file
253
vendor/github.com/vmware/govmomi/ovf/parser.go
generated
vendored
Normal file
|
|
@ -0,0 +1,253 @@
|
|||
/*
|
||||
Copyright (c) 2024-2024 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 ovf
|
||||
|
||||
import (
|
||||
"math"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// These are used to validate the overall structure of the string being parsed and to differentiate tokens as we are
|
||||
// processing them
|
||||
var (
|
||||
blankRegexp = regexp.MustCompile(`[[:blank:]]`)
|
||||
validIntegerRegexp = regexp.MustCompile(`^([1-9]\d*)$`)
|
||||
validExponentRegexp = regexp.MustCompile(`^([1-9]\d*\^[1-9]\d*)$`)
|
||||
validByteUnitRegexp = regexp.MustCompile(`((^|kilo|kibi|mega|mebi|giga|gibi)byte(s?)$)`)
|
||||
validCapacityRegexp = regexp.MustCompile(`^[[:blank:]]*((([1-9]\d*\^[1-9]\d*)|([1-9]\d*))($|[[:blank:]]*\*[[:blank:]]*))*(([a-zA-Z]*(b|B)(y|Y)(t|T)(e|E)(s|S)?)($|([[:blank:]]*\*[[:blank:]]*(([1-9]\d*\^[1-9]\d*)|([1-9]\d*)))*))?$`)
|
||||
)
|
||||
|
||||
// We only handle kilo, kibi, mega, mebi, giga, gibi prefixes due to size constraints of int64/uint64, but more
|
||||
// importantly because prefixes larger than giga & gibi don't make sense for our use-case
|
||||
var prefixMultipliers = map[string]int64{
|
||||
"byte": 1, // byte
|
||||
"kilobyte": 1 * 1000, // byte * 1000
|
||||
"kibibyte": 1 * 1024, // byte * 1024
|
||||
"megabyte": 1 * 1000 * 1000, // byte * 1000 * 1000 = kilobyte * 1000
|
||||
"mebibyte": 1 * 1024 * 1024, // byte * 1024 * 1024 = kibibyte * 1024
|
||||
"gigabyte": 1 * 1000 * 1000 * 1000, // byte * 1000 * 1000 * 1000 = kilobyte * 1000 * 1000 = megabyte * 1000
|
||||
"gibibyte": 1 * 1024 * 1024 * 1024, // byte * 1024 * 1024 * 1024 = kibibyte * 1024 * 1024 = mebibyte * 1024
|
||||
}
|
||||
|
||||
// ParseCapacityAllocationUnits validates the string s is a valid programmatic unit with respect to the base unit 'byte'
|
||||
// and parses the string to return the number of bytes s represents
|
||||
func ParseCapacityAllocationUnits(s string) int64 {
|
||||
// Any strings which don't match against the regular expression are deemed invalid and zero is returned as the result
|
||||
if !validCapacityString(s) {
|
||||
return 0
|
||||
}
|
||||
var capacityBytes int64 = 1
|
||||
// Remove any whitespace in s and lowercase any alphabetic characters. Removal of whitespace is done after
|
||||
// validating against the regular expression because whitespace is valid for the most part, but is not valid
|
||||
// for exponential terms, e.g 2 ^ 10
|
||||
s = strings.ToLower(blankRegexp.ReplaceAllString(s, ""))
|
||||
// Split s on multiplication operator (*) so that we can just calculate integer multipliers. Each token will
|
||||
// then be either an integer, an exponential term to be converted to an integer, or a unit term to be converted
|
||||
// to an integer
|
||||
tokens := strings.Split(s, "*")
|
||||
|
||||
// Loop through all tokens and convert any to integers if necessary and use to compute a running product
|
||||
for _, token := range tokens {
|
||||
switch {
|
||||
// "" should be treated identically to "byte". capacityBytes is already set to 1 so there is nothing to do
|
||||
case len(token) == 0:
|
||||
continue
|
||||
case validByteUnitString(token):
|
||||
capacityBytes = capacityBytes * prefixMultipliers[strings.TrimSuffix(token, "s")]
|
||||
case validExponentString(token):
|
||||
p := strings.Split(token, "^")
|
||||
b, _ := strconv.ParseInt(p[0], 10, 64)
|
||||
e, _ := strconv.ParseInt(p[1], 10, 64)
|
||||
capacityBytes = capacityBytes * int64(math.Pow(float64(b), float64(e)))
|
||||
case validIntegerString(token):
|
||||
n, _ := strconv.ParseInt(token, 10, 64)
|
||||
capacityBytes = capacityBytes * n
|
||||
default:
|
||||
// This should be unreachable. validCapacityString should have filtered out anything that cannot be
|
||||
// matched by the non-default cases
|
||||
capacityBytes = 0
|
||||
}
|
||||
}
|
||||
return capacityBytes
|
||||
}
|
||||
|
||||
// validIntegerString matches the string s against the regular expression `^([1-9]\d*)$`; i.e. s should be of the form:
|
||||
// any non-zero digit ([1-9]), followed by zero or more digits (\d*)
|
||||
func validIntegerString(s string) bool {
|
||||
return validIntegerRegexp.MatchString(s)
|
||||
}
|
||||
|
||||
// validExponentString matches the string s against the regular expression `^([1-9]\d*\^[1-9]\d*)$`; i.e. s should be of
|
||||
// the form: any non-zero digit ([1-9]), followed by a caret (^) followed by any non-zero digit ([1-9]), followed by zero
|
||||
// or more digits (\d*)
|
||||
func validExponentString(s string) bool {
|
||||
return validExponentRegexp.MatchString(s)
|
||||
}
|
||||
|
||||
// validByteUnitString matches the string s against a regular expression which only allows a unit of byte
|
||||
// (optionally plural) with a valid decimal or binary prefix. See prefixMultipliers
|
||||
func validByteUnitString(s string) bool {
|
||||
return validByteUnitRegexp.MatchString(s)
|
||||
}
|
||||
|
||||
// validCapacityString matches the string s against the regular expression validCapacityRegexp and verifies that s is a
|
||||
// valid programmatic unit with respect to the base unit 'byte'.
|
||||
//
|
||||
// Per the OVF schema defined in DSP8023: "If not specified default value is bytes. Value shall match a recognized value
|
||||
// for the UNITS qualifier in DSP0004"
|
||||
//
|
||||
// DSP004 defines a programmatic unit as:
|
||||
//
|
||||
// programmatic-unit = [ sign ] *S unit-element *( *S unit-operator *S unit-element )
|
||||
// sign = HYPHEN
|
||||
// unit-element = number / [ prefix ] base-unit [ CARET exponent ]
|
||||
// unit-operator = "*" / "/"
|
||||
// number = floatingpoint-number / exponent-number
|
||||
//
|
||||
// ; An exponent shall be interpreted as a floating point number
|
||||
// ; with the specified decimal base and exponent and a mantissa of 1
|
||||
// exponent-number = base CARET exponent
|
||||
// base = integer-number
|
||||
// exponent = [ sign ] integer-number
|
||||
//
|
||||
// ; An integer shall be interpreted as a decimal integer number
|
||||
// integer-number = NON-ZERO-DIGIT *( DIGIT )
|
||||
//
|
||||
// ; A float shall be interpreted as a decimal floating point number
|
||||
// floatingpoint-number = 1*( DIGIT ) [ "." ] *( DIGIT )
|
||||
//
|
||||
// ; A prefix for a base unit (e.g. "kilo"). The numeric equivalents of
|
||||
// ; these prefixes shall be interpreted as multiplication factors for the
|
||||
// ; directly succeeding base unit. In other words, if a prefixed base
|
||||
// ; unit is in the denominator of the overall programmatic unit, the
|
||||
// ; numeric equivalent of that prefix is also in the denominator
|
||||
// prefix = decimal-prefix / binary-prefix
|
||||
//
|
||||
// ; SI decimal prefixes as defined in ISO 1000
|
||||
// decimal-prefix =
|
||||
//
|
||||
// "deca" ; 10^1
|
||||
// / "hecto" ; 10^2
|
||||
// / "kilo" ; 10^3
|
||||
// / "mega" ; 10^6
|
||||
// / "giga" ; 10^9
|
||||
// / "tera" ; 10^12
|
||||
// / "peta" ; 10^15
|
||||
// / "exa" ; 10^18
|
||||
// / "zetta" ; 10^21
|
||||
// / "yotta" ; 10^24
|
||||
// / "deci" ; 10^-1
|
||||
// / "centi" ; 10^-2
|
||||
// / "milli" ; 10^-3
|
||||
// / "micro" ; 10^-6
|
||||
// / "nano" ; 10^-9
|
||||
// / "pico" ; 10^-12
|
||||
// / "femto" ; 10^-15
|
||||
// / "atto" ; 10^-18
|
||||
// / "zepto" ; 10^-21
|
||||
// / "yocto" ; 10^-24
|
||||
//
|
||||
// ; IEC binary prefixes as defined in IEC 80000-13
|
||||
// binary-prefix =
|
||||
//
|
||||
// "kibi" ; 2^10
|
||||
// / "mebi" ´ ; 2^20
|
||||
// / "gibi" ; 2^30
|
||||
// / "tebi" ; 2^40
|
||||
// / "pebi" ; 2^50
|
||||
// / "exbi" ; 2^60
|
||||
// / "zebi" ; 2^70
|
||||
// / "yobi" ; 2^80
|
||||
//
|
||||
// ; The name of a base unit
|
||||
// base-unit = standard-unit / extension-unit
|
||||
//
|
||||
// ; The name of a standard base unit
|
||||
// standard-unit = UNIT-IDENTIFIER
|
||||
//
|
||||
// ; The name of an extension base unit. If UNIT-IDENTIFIER begins with a
|
||||
// ; prefix (see prefix ABNF rule), the meaning of that prefix shall not be
|
||||
// ; changed by the extension base unit (examples of this for standard base
|
||||
// ; units are "decibel" or "kilogram")
|
||||
// ; extension-unit = org-id COLON UNIT-IDENTIFIER
|
||||
//
|
||||
// ; org-id shall include a copyrighted, trademarked, or otherwise unique
|
||||
// ; name that is owned by the business entity that is defining the
|
||||
// ; extension unit, or that is a registered ID assigned to the business
|
||||
// ; entity by a recognized global authority. org-id shall not begin with
|
||||
// ; a prefix (see prefix ABNF rule)
|
||||
// org-id = UNIT-IDENTIFIER
|
||||
// UNIT-IDENTIFIER = FIRST-UNIT-CHAR [ *( MID-UNIT-CHAR )
|
||||
// LAST-UNIT-CHAR ]
|
||||
// FIRST-UNIT-CHAR = UPPERALPHA / LOWERALPHA / UNDERSCORE
|
||||
// LAST-UNIT-CHAR = FIRST-UNIT-CHAR / DIGIT / PARENS
|
||||
// MID-UNIT-CHAR = LAST-UNIT-CHAR / HYPHEN / S
|
||||
//
|
||||
// DIGIT = ZERO / NON-ZERO-DIGIT
|
||||
// ZERO = "0"
|
||||
// NON-ZERO-DIGIT = "1"-"9"
|
||||
// HYPHEN = U+002D ; "-"
|
||||
// CARET = U+005E ; "^"
|
||||
// COLON = U+003A ; ":"
|
||||
// UPPERALPHA = U+0041-005A ; "A" ... "Z"
|
||||
// LOWERALPHA = U+0061-007A ; "a" ... "z"
|
||||
// UNDERSCORE = U+005F ; "_"
|
||||
// PARENS = U+0028 / U+0029 ; "(", ")"
|
||||
// S = U+0020 ; " "
|
||||
//
|
||||
// This definition is further restricted as such a broad definition by the above grammar does not make sense in the
|
||||
// context of virtual disk capacity.
|
||||
//
|
||||
// We do not allow for negative values, division operations, floating-point numbers, negative exponents, nor the use of
|
||||
// multiple units. Furthermore, we limit the allowed decimal and binary prefixes. This gives us:
|
||||
//
|
||||
// programmatic-unit =
|
||||
//
|
||||
// number
|
||||
// / [prefix] base-unit
|
||||
// / number *( *S unit-operator *S number) *S unit-operator *S [prefix] base-unit
|
||||
// / [prefix] base-unit *( *S unit-operator *S number)
|
||||
// / number *( *S unit-operator *S number) *S unit-operator *S [prefix] base-unit *( *S unit-operator *S number)
|
||||
//
|
||||
// unit-operator = "*"
|
||||
// number = integer-number / exponent-number
|
||||
// exponent-number = base CARET exponent
|
||||
// base = integer-number
|
||||
// exponent = integer-number
|
||||
// integer-number = NON-ZERO-DIGIT *( DIGIT )
|
||||
// prefix = decimal-prefix / binary-prefix
|
||||
//
|
||||
// decimal-prefix =
|
||||
//
|
||||
// "kilo" ; 10^3
|
||||
// / "mega" ; 10^6
|
||||
// / "giga" ; 10^9
|
||||
//
|
||||
// binary-prefix =
|
||||
//
|
||||
// "kibi" ; 2^10
|
||||
// / "mebi" ; 2^20
|
||||
// / "gibi" ; 2^30
|
||||
//
|
||||
// This function and the regular expression validCapacityRegexp are used to verify that the string we are parsing follows
|
||||
// our above restricted grammar
|
||||
func validCapacityString(s string) bool {
|
||||
// Integer followed by a trailing '*' is not handled by the regular expression and so is explicitly checked
|
||||
return validCapacityRegexp.MatchString(s) && !strings.HasSuffix(s, "*")
|
||||
}
|
||||
2
vendor/github.com/vmware/govmomi/property/collector.go
generated
vendored
2
vendor/github.com/vmware/govmomi/property/collector.go
generated
vendored
|
|
@ -276,7 +276,7 @@ func (p *Collector) RetrieveOne(ctx context.Context, obj types.ManagedObjectRefe
|
|||
// propagation.
|
||||
func (p *Collector) WaitForUpdatesEx(
|
||||
ctx context.Context,
|
||||
opts WaitOptions,
|
||||
opts *WaitOptions,
|
||||
onUpdatesFn func([]types.ObjectUpdate) bool) error {
|
||||
|
||||
if !p.mu.TryLock() {
|
||||
|
|
|
|||
4
vendor/github.com/vmware/govmomi/property/wait.go
generated
vendored
4
vendor/github.com/vmware/govmomi/property/wait.go
generated
vendored
|
|
@ -123,7 +123,7 @@ func WaitForUpdates(
|
|||
return err
|
||||
}
|
||||
|
||||
return pc.WaitForUpdatesEx(ctx, filter.WaitOptions, onUpdatesFn)
|
||||
return pc.WaitForUpdatesEx(ctx, &filter.WaitOptions, onUpdatesFn)
|
||||
}
|
||||
|
||||
// WaitForUpdates waits for any of the specified properties of the specified
|
||||
|
|
@ -166,5 +166,5 @@ func WaitForUpdatesEx(
|
|||
|
||||
}()
|
||||
|
||||
return pc.WaitForUpdatesEx(ctx, filter.WaitOptions, onUpdatesFn)
|
||||
return pc.WaitForUpdatesEx(ctx, &filter.WaitOptions, onUpdatesFn)
|
||||
}
|
||||
|
|
|
|||
16
vendor/github.com/vmware/govmomi/session/manager.go
generated
vendored
16
vendor/github.com/vmware/govmomi/session/manager.go
generated
vendored
|
|
@ -291,3 +291,19 @@ func (sm *Manager) UpdateServiceMessage(ctx context.Context, message string) err
|
|||
|
||||
return err
|
||||
}
|
||||
|
||||
func (sm *Manager) ImpersonateUser(ctx context.Context, name string) error {
|
||||
req := types.ImpersonateUser{
|
||||
This: sm.Reference(),
|
||||
UserName: name,
|
||||
Locale: Locale,
|
||||
}
|
||||
|
||||
res, err := methods.ImpersonateUser(ctx, sm.client, &req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
sm.userSession = &res.Returnval
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
42
vendor/github.com/vmware/govmomi/vapi/library/finder/path.go
generated
vendored
42
vendor/github.com/vmware/govmomi/vapi/library/finder/path.go
generated
vendored
|
|
@ -23,6 +23,7 @@ import (
|
|||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/vmware/govmomi/internal"
|
||||
"github.com/vmware/govmomi/object"
|
||||
"github.com/vmware/govmomi/property"
|
||||
"github.com/vmware/govmomi/vapi/library"
|
||||
|
|
@ -134,6 +135,29 @@ func (f *PathFinder) datastoreName(ctx context.Context, id string) (string, erro
|
|||
return name, nil
|
||||
}
|
||||
|
||||
func (f *PathFinder) convertPath(ctx context.Context, b *mo.Datastore, path string) (string, error) {
|
||||
if !internal.IsDatastoreVSAN(*b) {
|
||||
return path, nil
|
||||
}
|
||||
|
||||
var dc *object.Datacenter
|
||||
|
||||
entities, err := mo.Ancestors(ctx, f.c, f.c.ServiceContent.PropertyCollector, b.Self)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
for _, entity := range entities {
|
||||
if entity.Self.Type == "Datacenter" {
|
||||
dc = object.NewDatacenter(f.c, entity.Self)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
m := object.NewDatastoreNamespaceManager(f.c)
|
||||
return m.ConvertNamespacePathToUuidPath(ctx, dc, path)
|
||||
}
|
||||
|
||||
// ResolveLibraryItemStorage transforms StorageURIs Datastore url (uuid) to Datastore name.
|
||||
func (f *PathFinder) ResolveLibraryItemStorage(ctx context.Context, storage []library.Storage) error {
|
||||
// TODO:
|
||||
|
|
@ -154,7 +178,8 @@ func (f *PathFinder) ResolveLibraryItemStorage(ctx context.Context, storage []li
|
|||
|
||||
var ds []mo.Datastore
|
||||
pc := property.DefaultCollector(f.c)
|
||||
if err := pc.Retrieve(ctx, ids, []string{"name", "info.url"}, &ds); err != nil {
|
||||
props := []string{"name", "summary.url", "summary.type"}
|
||||
if err := pc.Retrieve(ctx, ids, props, &ds); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
@ -164,12 +189,21 @@ func (f *PathFinder) ResolveLibraryItemStorage(ctx context.Context, storage []li
|
|||
|
||||
for _, item := range storage {
|
||||
b := backing[item.StorageBacking.DatastoreID]
|
||||
dsurl := b.Info.GetDatastoreInfo().Url
|
||||
dsurl := b.Summary.Url
|
||||
|
||||
for i := range item.StorageURIs {
|
||||
u := strings.TrimPrefix(item.StorageURIs[i], dsurl)
|
||||
uri, err := url.Parse(item.StorageURIs[i])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
uri.Path = path.Clean(uri.Path) // required for ConvertNamespacePathToUuidPath()
|
||||
uri.RawQuery = ""
|
||||
u, err := f.convertPath(ctx, b, uri.String())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
u = strings.TrimPrefix(u, dsurl)
|
||||
u = strings.TrimPrefix(u, "/")
|
||||
u = strings.SplitN(u, "?", 2)[0] // strip query, if any
|
||||
|
||||
item.StorageURIs[i] = (&object.DatastorePath{
|
||||
Datastore: b.Name,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue