go.mod: update osbuild/images to v0.69.0
This commit is contained in:
parent
1cc90c6a0b
commit
8ac80e8abc
611 changed files with 28281 additions and 32629 deletions
2
vendor/github.com/vmware/govmomi/vim25/client.go
generated
vendored
2
vendor/github.com/vmware/govmomi/vim25/client.go
generated
vendored
|
|
@ -28,7 +28,7 @@ import (
|
|||
|
||||
const (
|
||||
Namespace = "vim25"
|
||||
Version = "8.0.2.0"
|
||||
Version = "8.0.3.0"
|
||||
Path = "/sdk"
|
||||
)
|
||||
|
||||
|
|
|
|||
162
vendor/github.com/vmware/govmomi/vim25/methods/methods.go
generated
vendored
162
vendor/github.com/vmware/govmomi/vim25/methods/methods.go
generated
vendored
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved.
|
||||
Copyright (c) 2014-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.
|
||||
|
|
@ -2543,6 +2543,26 @@ func CreateCollectorForTasks(ctx context.Context, r soap.RoundTripper, req *type
|
|||
return resBody.Res, nil
|
||||
}
|
||||
|
||||
type CreateCollectorWithInfoFilterForTasksBody struct {
|
||||
Req *types.CreateCollectorWithInfoFilterForTasks `xml:"urn:vim25 CreateCollectorWithInfoFilterForTasks,omitempty"`
|
||||
Res *types.CreateCollectorWithInfoFilterForTasksResponse `xml:"CreateCollectorWithInfoFilterForTasksResponse,omitempty"`
|
||||
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
|
||||
}
|
||||
|
||||
func (b *CreateCollectorWithInfoFilterForTasksBody) Fault() *soap.Fault { return b.Fault_ }
|
||||
|
||||
func CreateCollectorWithInfoFilterForTasks(ctx context.Context, r soap.RoundTripper, req *types.CreateCollectorWithInfoFilterForTasks) (*types.CreateCollectorWithInfoFilterForTasksResponse, error) {
|
||||
var reqBody, resBody CreateCollectorWithInfoFilterForTasksBody
|
||||
|
||||
reqBody.Req = req
|
||||
|
||||
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resBody.Res, nil
|
||||
}
|
||||
|
||||
type CreateContainerViewBody struct {
|
||||
Req *types.CreateContainerView `xml:"urn:vim25 CreateContainerView,omitempty"`
|
||||
Res *types.CreateContainerViewResponse `xml:"CreateContainerViewResponse,omitempty"`
|
||||
|
|
@ -6883,6 +6903,26 @@ func HostProfileResetValidationState(ctx context.Context, r soap.RoundTripper, r
|
|||
return resBody.Res, nil
|
||||
}
|
||||
|
||||
type HostQueryVirtualDiskUuidBody struct {
|
||||
Req *types.HostQueryVirtualDiskUuid `xml:"urn:vim25 HostQueryVirtualDiskUuid,omitempty"`
|
||||
Res *types.HostQueryVirtualDiskUuidResponse `xml:"HostQueryVirtualDiskUuidResponse,omitempty"`
|
||||
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
|
||||
}
|
||||
|
||||
func (b *HostQueryVirtualDiskUuidBody) Fault() *soap.Fault { return b.Fault_ }
|
||||
|
||||
func HostQueryVirtualDiskUuid(ctx context.Context, r soap.RoundTripper, req *types.HostQueryVirtualDiskUuid) (*types.HostQueryVirtualDiskUuidResponse, error) {
|
||||
var reqBody, resBody HostQueryVirtualDiskUuidBody
|
||||
|
||||
reqBody.Req = req
|
||||
|
||||
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resBody.Res, nil
|
||||
}
|
||||
|
||||
type HostReconcileDatastoreInventory_TaskBody struct {
|
||||
Req *types.HostReconcileDatastoreInventory_Task `xml:"urn:vim25 HostReconcileDatastoreInventory_Task,omitempty"`
|
||||
Res *types.HostReconcileDatastoreInventory_TaskResponse `xml:"HostReconcileDatastoreInventory_TaskResponse,omitempty"`
|
||||
|
|
@ -7123,6 +7163,26 @@ func HostSetVStorageObjectControlFlags(ctx context.Context, r soap.RoundTripper,
|
|||
return resBody.Res, nil
|
||||
}
|
||||
|
||||
type HostSetVirtualDiskUuid_TaskBody struct {
|
||||
Req *types.HostSetVirtualDiskUuid_Task `xml:"urn:vim25 HostSetVirtualDiskUuid_Task,omitempty"`
|
||||
Res *types.HostSetVirtualDiskUuid_TaskResponse `xml:"HostSetVirtualDiskUuid_TaskResponse,omitempty"`
|
||||
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
|
||||
}
|
||||
|
||||
func (b *HostSetVirtualDiskUuid_TaskBody) Fault() *soap.Fault { return b.Fault_ }
|
||||
|
||||
func HostSetVirtualDiskUuid_Task(ctx context.Context, r soap.RoundTripper, req *types.HostSetVirtualDiskUuid_Task) (*types.HostSetVirtualDiskUuid_TaskResponse, error) {
|
||||
var reqBody, resBody HostSetVirtualDiskUuid_TaskBody
|
||||
|
||||
reqBody.Req = req
|
||||
|
||||
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resBody.Res, nil
|
||||
}
|
||||
|
||||
type HostSpecGetUpdatedHostsBody struct {
|
||||
Req *types.HostSpecGetUpdatedHosts `xml:"urn:vim25 HostSpecGetUpdatedHosts,omitempty"`
|
||||
Res *types.HostSpecGetUpdatedHostsResponse `xml:"HostSpecGetUpdatedHostsResponse,omitempty"`
|
||||
|
|
@ -8963,6 +9023,26 @@ func MoveVirtualDisk_Task(ctx context.Context, r soap.RoundTripper, req *types.M
|
|||
return resBody.Res, nil
|
||||
}
|
||||
|
||||
type NotifyAffectedServicesBody struct {
|
||||
Req *types.NotifyAffectedServices `xml:"urn:vim25 NotifyAffectedServices,omitempty"`
|
||||
Res *types.NotifyAffectedServicesResponse `xml:"NotifyAffectedServicesResponse,omitempty"`
|
||||
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
|
||||
}
|
||||
|
||||
func (b *NotifyAffectedServicesBody) Fault() *soap.Fault { return b.Fault_ }
|
||||
|
||||
func NotifyAffectedServices(ctx context.Context, r soap.RoundTripper, req *types.NotifyAffectedServices) (*types.NotifyAffectedServicesResponse, error) {
|
||||
var reqBody, resBody NotifyAffectedServicesBody
|
||||
|
||||
reqBody.Req = req
|
||||
|
||||
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resBody.Res, nil
|
||||
}
|
||||
|
||||
type OpenInventoryViewFolderBody struct {
|
||||
Req *types.OpenInventoryViewFolder `xml:"urn:vim25 OpenInventoryViewFolder,omitempty"`
|
||||
Res *types.OpenInventoryViewFolderResponse `xml:"OpenInventoryViewFolderResponse,omitempty"`
|
||||
|
|
@ -9323,6 +9403,26 @@ func PromoteDisks_Task(ctx context.Context, r soap.RoundTripper, req *types.Prom
|
|||
return resBody.Res, nil
|
||||
}
|
||||
|
||||
type ProvisionServerPrivateKeyBody struct {
|
||||
Req *types.ProvisionServerPrivateKey `xml:"urn:vim25 ProvisionServerPrivateKey,omitempty"`
|
||||
Res *types.ProvisionServerPrivateKeyResponse `xml:"ProvisionServerPrivateKeyResponse,omitempty"`
|
||||
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
|
||||
}
|
||||
|
||||
func (b *ProvisionServerPrivateKeyBody) Fault() *soap.Fault { return b.Fault_ }
|
||||
|
||||
func ProvisionServerPrivateKey(ctx context.Context, r soap.RoundTripper, req *types.ProvisionServerPrivateKey) (*types.ProvisionServerPrivateKeyResponse, error) {
|
||||
var reqBody, resBody ProvisionServerPrivateKeyBody
|
||||
|
||||
reqBody.Req = req
|
||||
|
||||
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resBody.Res, nil
|
||||
}
|
||||
|
||||
type PutUsbScanCodesBody struct {
|
||||
Req *types.PutUsbScanCodes `xml:"urn:vim25 PutUsbScanCodes,omitempty"`
|
||||
Res *types.PutUsbScanCodesResponse `xml:"PutUsbScanCodesResponse,omitempty"`
|
||||
|
|
@ -11523,6 +11623,26 @@ func QueryVirtualDiskUuid(ctx context.Context, r soap.RoundTripper, req *types.Q
|
|||
return resBody.Res, nil
|
||||
}
|
||||
|
||||
type QueryVirtualDiskUuidExBody struct {
|
||||
Req *types.QueryVirtualDiskUuidEx `xml:"urn:vim25 QueryVirtualDiskUuidEx,omitempty"`
|
||||
Res *types.QueryVirtualDiskUuidExResponse `xml:"QueryVirtualDiskUuidExResponse,omitempty"`
|
||||
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
|
||||
}
|
||||
|
||||
func (b *QueryVirtualDiskUuidExBody) Fault() *soap.Fault { return b.Fault_ }
|
||||
|
||||
func QueryVirtualDiskUuidEx(ctx context.Context, r soap.RoundTripper, req *types.QueryVirtualDiskUuidEx) (*types.QueryVirtualDiskUuidExResponse, error) {
|
||||
var reqBody, resBody QueryVirtualDiskUuidExBody
|
||||
|
||||
reqBody.Req = req
|
||||
|
||||
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resBody.Res, nil
|
||||
}
|
||||
|
||||
type QueryVmfsConfigOptionBody struct {
|
||||
Req *types.QueryVmfsConfigOption `xml:"urn:vim25 QueryVmfsConfigOption,omitempty"`
|
||||
Res *types.QueryVmfsConfigOptionResponse `xml:"QueryVmfsConfigOptionResponse,omitempty"`
|
||||
|
|
@ -15763,6 +15883,26 @@ func SetVirtualDiskUuid(ctx context.Context, r soap.RoundTripper, req *types.Set
|
|||
return resBody.Res, nil
|
||||
}
|
||||
|
||||
type SetVirtualDiskUuidEx_TaskBody struct {
|
||||
Req *types.SetVirtualDiskUuidEx_Task `xml:"urn:vim25 SetVirtualDiskUuidEx_Task,omitempty"`
|
||||
Res *types.SetVirtualDiskUuidEx_TaskResponse `xml:"SetVirtualDiskUuidEx_TaskResponse,omitempty"`
|
||||
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
|
||||
}
|
||||
|
||||
func (b *SetVirtualDiskUuidEx_TaskBody) Fault() *soap.Fault { return b.Fault_ }
|
||||
|
||||
func SetVirtualDiskUuidEx_Task(ctx context.Context, r soap.RoundTripper, req *types.SetVirtualDiskUuidEx_Task) (*types.SetVirtualDiskUuidEx_TaskResponse, error) {
|
||||
var reqBody, resBody SetVirtualDiskUuidEx_TaskBody
|
||||
|
||||
reqBody.Req = req
|
||||
|
||||
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resBody.Res, nil
|
||||
}
|
||||
|
||||
type ShrinkVirtualDisk_TaskBody struct {
|
||||
Req *types.ShrinkVirtualDisk_Task `xml:"urn:vim25 ShrinkVirtualDisk_Task,omitempty"`
|
||||
Res *types.ShrinkVirtualDisk_TaskResponse `xml:"ShrinkVirtualDisk_TaskResponse,omitempty"`
|
||||
|
|
@ -18943,6 +19083,26 @@ func SetCustomValue(ctx context.Context, r soap.RoundTripper, req *types.SetCust
|
|||
return resBody.Res, nil
|
||||
}
|
||||
|
||||
type StartDpuFailoverBody struct {
|
||||
Req *types.StartDpuFailover `xml:"urn:vim25 startDpuFailover,omitempty"`
|
||||
Res *types.StartDpuFailoverResponse `xml:"startDpuFailoverResponse,omitempty"`
|
||||
Fault_ *soap.Fault `xml:"http://schemas.xmlsoap.org/soap/envelope/ Fault,omitempty"`
|
||||
}
|
||||
|
||||
func (b *StartDpuFailoverBody) Fault() *soap.Fault { return b.Fault_ }
|
||||
|
||||
func StartDpuFailover(ctx context.Context, r soap.RoundTripper, req *types.StartDpuFailover) (*types.StartDpuFailoverResponse, error) {
|
||||
var reqBody, resBody StartDpuFailoverBody
|
||||
|
||||
reqBody.Req = req
|
||||
|
||||
if err := r.RoundTrip(ctx, &reqBody, &resBody); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resBody.Res, nil
|
||||
}
|
||||
|
||||
type UnregisterVApp_TaskBody struct {
|
||||
Req *types.UnregisterVApp_Task `xml:"urn:vim25 unregisterVApp_Task,omitempty"`
|
||||
Res *types.UnregisterVApp_TaskResponse `xml:"unregisterVApp_TaskResponse,omitempty"`
|
||||
|
|
|
|||
6
vendor/github.com/vmware/govmomi/vim25/mo/mo.go
generated
vendored
6
vendor/github.com/vmware/govmomi/vim25/mo/mo.go
generated
vendored
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved.
|
||||
Copyright (c) 2014-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,
|
||||
|
|
@ -210,7 +210,7 @@ type CustomizationSpecManager struct {
|
|||
Self types.ManagedObjectReference `json:"self"`
|
||||
|
||||
Info []types.CustomizationSpecInfo `json:"info"`
|
||||
EncryptionKey []byte `json:"encryptionKey"`
|
||||
EncryptionKey types.ByteSlice `json:"encryptionKey"`
|
||||
}
|
||||
|
||||
func (m CustomizationSpecManager) Reference() types.ManagedObjectReference {
|
||||
|
|
|
|||
23
vendor/github.com/vmware/govmomi/vim25/mo/retrieve.go
generated
vendored
23
vendor/github.com/vmware/govmomi/vim25/mo/retrieve.go
generated
vendored
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
Copyright (c) 2014-2015 VMware, Inc. All Rights Reserved.
|
||||
Copyright (c) 2014-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,
|
||||
|
|
@ -75,16 +75,19 @@ func ApplyPropertyChange(obj Reference, changes []types.PropertyChange) {
|
|||
v := reflect.ValueOf(obj)
|
||||
|
||||
for _, p := range changes {
|
||||
rv, ok := t.props[p.Name]
|
||||
if !ok {
|
||||
// For now, skip unknown properties allowing PC updates to be triggered
|
||||
// for partial updates (e.g. extensionList["my.extension"]).
|
||||
// Ultimately we should support partial updates by assigning the value
|
||||
// reflectively in assignValue.
|
||||
continue
|
||||
var field Field
|
||||
if !field.FromString(p.Name) {
|
||||
panic(p.Name + ": invalid property path")
|
||||
}
|
||||
|
||||
assignValue(v, rv, reflect.ValueOf(p.Val))
|
||||
rv, ok := t.props[field.Path]
|
||||
if !ok {
|
||||
panic(field.Path + ": property not found")
|
||||
}
|
||||
|
||||
if field.Key == nil { // Key is only used for notifications
|
||||
assignValue(v, rv, reflect.ValueOf(p.Val))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
153
vendor/github.com/vmware/govmomi/vim25/mo/type_info.go
generated
vendored
153
vendor/github.com/vmware/govmomi/vim25/mo/type_info.go
generated
vendored
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
Copyright (c) 2014 VMware, Inc. All Rights Reserved.
|
||||
Copyright (c) 2014-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,
|
||||
|
|
@ -20,6 +20,7 @@ import (
|
|||
"fmt"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
|
|
@ -34,6 +35,9 @@ type typeInfo struct {
|
|||
|
||||
// Map property names to field indices.
|
||||
props map[string][]int
|
||||
|
||||
// Use base type for interface indices.
|
||||
base bool
|
||||
}
|
||||
|
||||
var typeInfoLock sync.RWMutex
|
||||
|
|
@ -62,12 +66,22 @@ func typeInfoForType(tname string) *typeInfo {
|
|||
return ti
|
||||
}
|
||||
|
||||
func newTypeInfo(typ reflect.Type) *typeInfo {
|
||||
func baseType(ftyp reflect.Type) reflect.Type {
|
||||
base := strings.TrimPrefix(ftyp.Name(), "Base")
|
||||
if kind, ok := types.TypeFunc()(base); ok {
|
||||
return kind
|
||||
}
|
||||
return ftyp
|
||||
}
|
||||
|
||||
func newTypeInfo(typ reflect.Type, base ...bool) *typeInfo {
|
||||
t := typeInfo{
|
||||
typ: typ,
|
||||
props: make(map[string][]int),
|
||||
}
|
||||
|
||||
if len(base) == 1 {
|
||||
t.base = base[0]
|
||||
}
|
||||
t.build(typ, "", []int{})
|
||||
|
||||
return &t
|
||||
|
|
@ -155,6 +169,15 @@ func (t *typeInfo) build(typ reflect.Type, fn string, fi []int) {
|
|||
if ftyp.Kind() == reflect.Struct {
|
||||
t.build(ftyp, fnc, fic)
|
||||
}
|
||||
|
||||
// Indexed property path may traverse into array element fields.
|
||||
// When interface, use the base type to index fields.
|
||||
// For example, BaseVirtualDevice:
|
||||
// config.hardware.device[4000].deviceInfo.label
|
||||
if t.base && ftyp.Kind() == reflect.Interface {
|
||||
base := baseType(ftyp)
|
||||
t.build(base, fnc, fic)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -164,7 +187,14 @@ var nilValue reflect.Value
|
|||
// slice of field indices. It recurses into the struct until it finds the field
|
||||
// specified by the indices. It creates new values for pointer types where
|
||||
// needed.
|
||||
func assignValue(val reflect.Value, fi []int, pv reflect.Value) {
|
||||
func assignValue(val reflect.Value, fi []int, pv reflect.Value, field ...string) {
|
||||
// Indexed property path can only use base types
|
||||
if val.Kind() == reflect.Interface {
|
||||
base := baseType(val.Type())
|
||||
val.Set(reflect.New(base))
|
||||
val = val.Elem()
|
||||
}
|
||||
|
||||
// Create new value if necessary.
|
||||
if val.Kind() == reflect.Ptr {
|
||||
if val.IsNil() {
|
||||
|
|
@ -230,6 +260,43 @@ func assignValue(val reflect.Value, fi []int, pv reflect.Value) {
|
|||
rv.Set(pv)
|
||||
} else if rt.ConvertibleTo(pt) {
|
||||
rv.Set(pv.Convert(rt))
|
||||
} else if rt.Kind() == reflect.Slice {
|
||||
// Indexed array value
|
||||
path := field[0]
|
||||
isInterface := rt.Elem().Kind() == reflect.Interface
|
||||
|
||||
if len(path) == 0 {
|
||||
// Append item (pv) directly to the array, converting to pointer if interface
|
||||
if isInterface {
|
||||
npv := reflect.New(pt)
|
||||
npv.Elem().Set(pv)
|
||||
pv = npv
|
||||
pt = pv.Type()
|
||||
}
|
||||
} else {
|
||||
// Construct item to be appended to the array, setting field within to value of pv
|
||||
var item reflect.Value
|
||||
if isInterface {
|
||||
base := baseType(rt.Elem())
|
||||
item = reflect.New(base)
|
||||
} else {
|
||||
item = reflect.New(rt.Elem())
|
||||
}
|
||||
|
||||
field := newTypeInfo(item.Type(), true)
|
||||
if ix, ok := field.props[path]; ok {
|
||||
assignValue(item, ix, pv)
|
||||
}
|
||||
|
||||
if rt.Elem().Kind() == reflect.Struct {
|
||||
pv = item.Elem()
|
||||
} else {
|
||||
pv = item
|
||||
}
|
||||
pt = pv.Type()
|
||||
}
|
||||
|
||||
rv.Set(reflect.Append(rv, pv))
|
||||
} else {
|
||||
panic(fmt.Sprintf("cannot assign %q (%s) to %q (%s)", rt.Name(), rt.Kind(), pt.Name(), pt.Kind()))
|
||||
}
|
||||
|
|
@ -237,7 +304,7 @@ func assignValue(val reflect.Value, fi []int, pv reflect.Value) {
|
|||
return
|
||||
}
|
||||
|
||||
assignValue(rv, fi, pv)
|
||||
assignValue(rv, fi, pv, field...)
|
||||
}
|
||||
|
||||
var arrayOfRegexp = regexp.MustCompile("ArrayOf(.*)$")
|
||||
|
|
@ -250,11 +317,14 @@ func (t *typeInfo) LoadFromObjectContent(o types.ObjectContent) (reflect.Value,
|
|||
assignValue(v, t.self, reflect.ValueOf(o.Obj))
|
||||
|
||||
for _, p := range o.PropSet {
|
||||
rv, ok := t.props[p.Name]
|
||||
var field Field
|
||||
field.FromString(p.Name)
|
||||
|
||||
rv, ok := t.props[field.Path]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
assignValue(v, rv, reflect.ValueOf(p.Val))
|
||||
assignValue(v, rv, reflect.ValueOf(p.Val), field.Item)
|
||||
}
|
||||
|
||||
return v, nil
|
||||
|
|
@ -264,3 +334,70 @@ func IsManagedObjectType(kind string) bool {
|
|||
_, ok := t[kind]
|
||||
return ok
|
||||
}
|
||||
|
||||
// Field of a ManagedObject in string form.
|
||||
type Field struct {
|
||||
Path string
|
||||
Key any
|
||||
Item string
|
||||
}
|
||||
|
||||
func (f *Field) String() string {
|
||||
if f.Key == nil {
|
||||
return f.Path
|
||||
}
|
||||
|
||||
var key, item string
|
||||
|
||||
switch f.Key.(type) {
|
||||
case string:
|
||||
key = fmt.Sprintf("%q", f.Key)
|
||||
default:
|
||||
key = fmt.Sprintf("%d", f.Key)
|
||||
}
|
||||
|
||||
if f.Item != "" {
|
||||
item = "." + f.Item
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s[%s]%s", f.Path, key, item)
|
||||
}
|
||||
|
||||
func (f *Field) FromString(spec string) bool {
|
||||
s := strings.SplitN(spec, "[", 2)
|
||||
f.Path = s[0]
|
||||
f.Key = nil
|
||||
f.Item = ""
|
||||
if len(s) == 1 {
|
||||
return true
|
||||
}
|
||||
|
||||
parts := strings.SplitN(s[1], "]", 2)
|
||||
|
||||
if len(parts) != 2 {
|
||||
return false
|
||||
}
|
||||
|
||||
ix := strings.Trim(parts[0], `"`)
|
||||
|
||||
if ix == parts[0] {
|
||||
v, err := strconv.ParseInt(ix, 0, 32)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
f.Key = int32(v)
|
||||
} else {
|
||||
f.Key = ix
|
||||
}
|
||||
|
||||
if parts[1] == "" {
|
||||
return true
|
||||
}
|
||||
|
||||
if parts[1][0] != '.' {
|
||||
return false
|
||||
}
|
||||
f.Item = parts[1][1:]
|
||||
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
67
vendor/github.com/vmware/govmomi/vim25/types/byte_slice.go
generated
vendored
Normal file
67
vendor/github.com/vmware/govmomi/vim25/types/byte_slice.go
generated
vendored
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
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 types
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"strconv"
|
||||
|
||||
"github.com/vmware/govmomi/vim25/xml"
|
||||
)
|
||||
|
||||
// ByteSlice implements vCenter compatibile xml encoding and decoding for a byte slice.
|
||||
// vCenter encodes each byte of the array in its own xml element, whereas
|
||||
// Go encodes the entire byte array in a single xml element.
|
||||
type ByteSlice []byte
|
||||
|
||||
// MarshalXML implements xml.Marshaler
|
||||
func (b ByteSlice) MarshalXML(e *xml.Encoder, field xml.StartElement) error {
|
||||
start := xml.StartElement{
|
||||
Name: field.Name,
|
||||
}
|
||||
for i := range b {
|
||||
if err := e.EncodeElement(b[i], start); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// UnmarshalXML implements xml.Unmarshaler
|
||||
func (b *ByteSlice) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
|
||||
for {
|
||||
t, err := d.Token()
|
||||
if err == io.EOF {
|
||||
break
|
||||
}
|
||||
|
||||
if c, ok := t.(xml.CharData); ok {
|
||||
n, err := strconv.ParseInt(string(c), 10, 16)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if n > math.MaxUint8 {
|
||||
return fmt.Errorf("parsing %q: uint8 overflow", start.Name.Local)
|
||||
}
|
||||
*b = append(*b, byte(n))
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
609
vendor/github.com/vmware/govmomi/vim25/types/configspec.go
generated
vendored
Normal file
609
vendor/github.com/vmware/govmomi/vim25/types/configspec.go
generated
vendored
Normal file
|
|
@ -0,0 +1,609 @@
|
|||
/*
|
||||
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 types
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// EnsureDisksHaveControllers ensures that all disks in the provided
|
||||
// ConfigSpec point to a controller. If no controller exists, LSILogic SCSI
|
||||
// controllers are added to the ConfigSpec as necessary for the disks.
|
||||
//
|
||||
// Please note the following table for the number of controllers of each type
|
||||
// that are supported as well as how many disks (per controller) each supports:
|
||||
//
|
||||
// SATA
|
||||
// - controllers 4
|
||||
// - disks 30
|
||||
//
|
||||
// SCSI
|
||||
// - controllers 4
|
||||
// - disks (non-paravirtual) 16
|
||||
// - disks (paravirtual, hardware version <14) 16
|
||||
// - disks (paravirtual, hardware version >=14) 256
|
||||
//
|
||||
// NVME
|
||||
// - controllers 4
|
||||
// - disks (hardware version <20) 15
|
||||
// - disks (hardware version >=21) 255
|
||||
func (cs *VirtualMachineConfigSpec) EnsureDisksHaveControllers(
|
||||
existingDevices ...BaseVirtualDevice) error {
|
||||
|
||||
if cs == nil {
|
||||
panic("configSpec is nil")
|
||||
}
|
||||
|
||||
var (
|
||||
disks []*VirtualDisk
|
||||
newDeviceKey int32
|
||||
pciController *VirtualPCIController
|
||||
diskControllers = ensureDiskControllerData{
|
||||
controllerKeys: map[int32]BaseVirtualController{},
|
||||
controllerKeysToAttachedDisks: map[int32]int{},
|
||||
}
|
||||
)
|
||||
|
||||
// Inspect the ConfigSpec
|
||||
for i := range cs.DeviceChange {
|
||||
var (
|
||||
bdc BaseVirtualDeviceConfigSpec
|
||||
bvd BaseVirtualDevice
|
||||
dc *VirtualDeviceConfigSpec
|
||||
d *VirtualDevice
|
||||
)
|
||||
|
||||
if bdc = cs.DeviceChange[i]; bdc == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
if dc = bdc.GetVirtualDeviceConfigSpec(); dc == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
if dc.Operation == VirtualDeviceConfigSpecOperationRemove {
|
||||
// Do not consider devices being removed.
|
||||
continue
|
||||
}
|
||||
|
||||
bvd = dc.Device
|
||||
if bvd == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
if d = bvd.GetVirtualDevice(); d == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
switch tvd := bvd.(type) {
|
||||
case *VirtualPCIController:
|
||||
pciController = tvd
|
||||
|
||||
case
|
||||
// SCSI
|
||||
*ParaVirtualSCSIController,
|
||||
*VirtualBusLogicController,
|
||||
*VirtualLsiLogicController,
|
||||
*VirtualLsiLogicSASController,
|
||||
*VirtualSCSIController,
|
||||
|
||||
// SATA
|
||||
*VirtualSATAController,
|
||||
*VirtualAHCIController,
|
||||
|
||||
// NVME
|
||||
*VirtualNVMEController:
|
||||
|
||||
diskControllers.add(bvd)
|
||||
|
||||
case *VirtualDisk:
|
||||
|
||||
disks = append(disks, tvd)
|
||||
|
||||
if controllerKey := d.ControllerKey; controllerKey != 0 {
|
||||
// If the disk points to a controller key, then increment
|
||||
// the number of devices attached to that controller.
|
||||
//
|
||||
// Please note that at this point it is not yet known if the
|
||||
// controller key is a *valid* controller.
|
||||
diskControllers.attach(controllerKey)
|
||||
}
|
||||
}
|
||||
|
||||
// Keep track of the smallest device key used. Please note, because
|
||||
// device keys in a ConfigSpec are negative numbers, -200 going to be
|
||||
// smaller than -1.
|
||||
if d.Key < newDeviceKey {
|
||||
newDeviceKey = d.Key
|
||||
}
|
||||
}
|
||||
|
||||
if len(disks) == 0 {
|
||||
// If there are no disks, then go ahead and return early.
|
||||
return nil
|
||||
}
|
||||
|
||||
// Categorize any controllers that already exist.
|
||||
for i := range existingDevices {
|
||||
var (
|
||||
d *VirtualDevice
|
||||
bvd = existingDevices[i]
|
||||
)
|
||||
|
||||
if bvd == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
if d = bvd.GetVirtualDevice(); d == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
switch tvd := bvd.(type) {
|
||||
case *VirtualPCIController:
|
||||
pciController = tvd
|
||||
case
|
||||
// SCSI
|
||||
*ParaVirtualSCSIController,
|
||||
*VirtualBusLogicController,
|
||||
*VirtualLsiLogicController,
|
||||
*VirtualLsiLogicSASController,
|
||||
*VirtualSCSIController,
|
||||
|
||||
// SATA
|
||||
*VirtualSATAController,
|
||||
*VirtualAHCIController,
|
||||
|
||||
// NVME
|
||||
*VirtualNVMEController:
|
||||
|
||||
diskControllers.add(bvd)
|
||||
|
||||
case *VirtualDisk:
|
||||
diskControllers.attach(tvd.ControllerKey)
|
||||
}
|
||||
}
|
||||
|
||||
// Decrement the newDeviceKey so the next device has a unique key.
|
||||
newDeviceKey--
|
||||
|
||||
if pciController == nil {
|
||||
// Add a PCI controller if one is not present.
|
||||
pciController = &VirtualPCIController{
|
||||
VirtualController: VirtualController{
|
||||
VirtualDevice: VirtualDevice{
|
||||
Key: newDeviceKey,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
// Decrement the newDeviceKey so the next device has a unique key.
|
||||
newDeviceKey--
|
||||
|
||||
// Add the new PCI controller to the ConfigSpec.
|
||||
cs.DeviceChange = append(
|
||||
cs.DeviceChange,
|
||||
&VirtualDeviceConfigSpec{
|
||||
Operation: VirtualDeviceConfigSpecOperationAdd,
|
||||
Device: pciController,
|
||||
})
|
||||
}
|
||||
|
||||
// Ensure all the recorded controller keys that point to disks are actually
|
||||
// valid controller keys.
|
||||
diskControllers.validateAttachments()
|
||||
|
||||
for i := range disks {
|
||||
disk := disks[i]
|
||||
|
||||
// If the disk already points to a controller then skip to the next
|
||||
// disk.
|
||||
if diskControllers.exists(disk.ControllerKey) {
|
||||
continue
|
||||
}
|
||||
|
||||
// The disk does not point to a controller, so try to locate one.
|
||||
if ensureDiskControllerFind(disk, &diskControllers) {
|
||||
// A controller was located for the disk, so go ahead and skip to
|
||||
// the next disk.
|
||||
continue
|
||||
}
|
||||
|
||||
// No controller was located for the disk, so a controller must be
|
||||
// created.
|
||||
if err := ensureDiskControllerCreate(
|
||||
cs,
|
||||
pciController,
|
||||
newDeviceKey,
|
||||
&diskControllers); err != nil {
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// Point the disk to the new controller.
|
||||
disk.ControllerKey = newDeviceKey
|
||||
|
||||
// Add the controller key to the map that tracks how many disks are
|
||||
// attached to a given controller.
|
||||
diskControllers.attach(newDeviceKey)
|
||||
|
||||
// Decrement the newDeviceKey so the next device has a unique key.
|
||||
newDeviceKey--
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
const (
|
||||
maxSCSIControllers = 4
|
||||
maxSATAControllers = 4
|
||||
maxNVMEControllers = 4
|
||||
maxDisksPerSCSIController = 16
|
||||
maxDisksPerPVSCSIControllerHWVersion14 = 256 // TODO(akutz)
|
||||
maxDisksPerSATAController = 30
|
||||
maxDisksPerNVMEController = 15
|
||||
maxDisksPerNVMEControllerHWVersion21 = 255 // TODO(akutz)
|
||||
)
|
||||
|
||||
type ensureDiskControllerBusNumbers struct {
|
||||
zero bool
|
||||
one bool
|
||||
two bool
|
||||
}
|
||||
|
||||
func (d ensureDiskControllerBusNumbers) free() int32 {
|
||||
switch {
|
||||
case !d.zero:
|
||||
return 0
|
||||
case !d.one:
|
||||
return 1
|
||||
case !d.two:
|
||||
return 2
|
||||
default:
|
||||
return 3
|
||||
}
|
||||
}
|
||||
|
||||
func (d *ensureDiskControllerBusNumbers) set(busNumber int32) {
|
||||
switch busNumber {
|
||||
case 0:
|
||||
d.zero = true
|
||||
case 1:
|
||||
d.one = true
|
||||
case 2:
|
||||
d.two = true
|
||||
}
|
||||
}
|
||||
|
||||
type ensureDiskControllerData struct {
|
||||
// TODO(akutz) Use the hardware version when calculating the max disks for
|
||||
// a given controller type.
|
||||
// hardwareVersion int
|
||||
|
||||
controllerKeys map[int32]BaseVirtualController
|
||||
controllerKeysToAttachedDisks map[int32]int
|
||||
|
||||
// SCSI
|
||||
scsiBusNumbers ensureDiskControllerBusNumbers
|
||||
pvSCSIControllerKeys []int32
|
||||
busLogicSCSIControllerKeys []int32
|
||||
lsiLogicControllerKeys []int32
|
||||
lsiLogicSASControllerKeys []int32
|
||||
scsiControllerKeys []int32
|
||||
|
||||
// SATA
|
||||
sataBusNumbers ensureDiskControllerBusNumbers
|
||||
sataControllerKeys []int32
|
||||
ahciControllerKeys []int32
|
||||
|
||||
// NVME
|
||||
nvmeBusNumbers ensureDiskControllerBusNumbers
|
||||
nvmeControllerKeys []int32
|
||||
}
|
||||
|
||||
func (d ensureDiskControllerData) numSCSIControllers() int {
|
||||
return len(d.pvSCSIControllerKeys) +
|
||||
len(d.busLogicSCSIControllerKeys) +
|
||||
len(d.lsiLogicControllerKeys) +
|
||||
len(d.lsiLogicSASControllerKeys) +
|
||||
len(d.scsiControllerKeys)
|
||||
}
|
||||
|
||||
func (d ensureDiskControllerData) numSATAControllers() int {
|
||||
return len(d.sataControllerKeys) + len(d.ahciControllerKeys)
|
||||
}
|
||||
|
||||
func (d ensureDiskControllerData) numNVMEControllers() int {
|
||||
return len(d.nvmeControllerKeys)
|
||||
}
|
||||
|
||||
// validateAttachments ensures the attach numbers are correct by removing any
|
||||
// keys from controllerKeysToAttachedDisks that do not also exist in
|
||||
// controllerKeys.
|
||||
func (d ensureDiskControllerData) validateAttachments() {
|
||||
// Remove any invalid controllers from controllerKeyToNumDiskMap.
|
||||
for key := range d.controllerKeysToAttachedDisks {
|
||||
if _, ok := d.controllerKeys[key]; !ok {
|
||||
delete(d.controllerKeysToAttachedDisks, key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// exists returns true if a controller with the provided key exists.
|
||||
func (d ensureDiskControllerData) exists(key int32) bool {
|
||||
return d.controllerKeys[key] != nil
|
||||
}
|
||||
|
||||
// add records the provided controller in the map that relates keys to
|
||||
// controllers as well as appends the key to the list of controllers of that
|
||||
// given type.
|
||||
func (d *ensureDiskControllerData) add(controller BaseVirtualDevice) {
|
||||
|
||||
// Get the controller's device key.
|
||||
bvc := controller.(BaseVirtualController)
|
||||
key := bvc.GetVirtualController().Key
|
||||
busNumber := bvc.GetVirtualController().BusNumber
|
||||
|
||||
// Record the controller's device key in the controller key map.
|
||||
d.controllerKeys[key] = bvc
|
||||
|
||||
// Record the controller's device key in the list for that type of
|
||||
// controller.
|
||||
switch controller.(type) {
|
||||
|
||||
// SCSI
|
||||
case *ParaVirtualSCSIController:
|
||||
d.pvSCSIControllerKeys = append(d.pvSCSIControllerKeys, key)
|
||||
d.scsiBusNumbers.set(busNumber)
|
||||
case *VirtualBusLogicController:
|
||||
d.busLogicSCSIControllerKeys = append(d.busLogicSCSIControllerKeys, key)
|
||||
d.scsiBusNumbers.set(busNumber)
|
||||
case *VirtualLsiLogicController:
|
||||
d.lsiLogicControllerKeys = append(d.lsiLogicControllerKeys, key)
|
||||
d.scsiBusNumbers.set(busNumber)
|
||||
case *VirtualLsiLogicSASController:
|
||||
d.lsiLogicSASControllerKeys = append(d.lsiLogicSASControllerKeys, key)
|
||||
d.scsiBusNumbers.set(busNumber)
|
||||
case *VirtualSCSIController:
|
||||
d.scsiControllerKeys = append(d.scsiControllerKeys, key)
|
||||
d.scsiBusNumbers.set(busNumber)
|
||||
|
||||
// SATA
|
||||
case *VirtualSATAController:
|
||||
d.sataControllerKeys = append(d.sataControllerKeys, key)
|
||||
d.sataBusNumbers.set(busNumber)
|
||||
case *VirtualAHCIController:
|
||||
d.ahciControllerKeys = append(d.ahciControllerKeys, key)
|
||||
d.sataBusNumbers.set(busNumber)
|
||||
|
||||
// NVME
|
||||
case *VirtualNVMEController:
|
||||
d.nvmeControllerKeys = append(d.nvmeControllerKeys, key)
|
||||
d.nvmeBusNumbers.set(busNumber)
|
||||
}
|
||||
}
|
||||
|
||||
// attach increments the number of disks attached to the controller identified
|
||||
// by the provided controller key.
|
||||
func (d *ensureDiskControllerData) attach(controllerKey int32) {
|
||||
d.controllerKeysToAttachedDisks[controllerKey]++
|
||||
}
|
||||
|
||||
// hasFreeSlot returns whether or not the controller identified by the provided
|
||||
// controller key has a free slot to attach a disk.
|
||||
//
|
||||
// TODO(akutz) Consider the hardware version when calculating these values.
|
||||
func (d *ensureDiskControllerData) hasFreeSlot(controllerKey int32) bool {
|
||||
|
||||
var maxDisksForType int
|
||||
|
||||
switch d.controllerKeys[controllerKey].(type) {
|
||||
case
|
||||
// SCSI (paravirtual)
|
||||
*ParaVirtualSCSIController:
|
||||
|
||||
maxDisksForType = maxDisksPerSCSIController
|
||||
|
||||
case
|
||||
// SCSI (non-paravirtual)
|
||||
*VirtualBusLogicController,
|
||||
*VirtualLsiLogicController,
|
||||
*VirtualLsiLogicSASController,
|
||||
*VirtualSCSIController:
|
||||
|
||||
maxDisksForType = maxDisksPerSCSIController
|
||||
|
||||
case
|
||||
// SATA
|
||||
*VirtualSATAController,
|
||||
*VirtualAHCIController:
|
||||
|
||||
maxDisksForType = maxDisksPerSATAController
|
||||
|
||||
case
|
||||
// NVME
|
||||
*VirtualNVMEController:
|
||||
|
||||
maxDisksForType = maxDisksPerNVMEController
|
||||
}
|
||||
|
||||
return d.controllerKeysToAttachedDisks[controllerKey] < maxDisksForType-1
|
||||
}
|
||||
|
||||
// ensureDiskControllerFind attempts to locate a controller for the provided
|
||||
// disk.
|
||||
//
|
||||
// Please note this function is written to preserve the order in which
|
||||
// controllers are located by preferring controller types in the order in which
|
||||
// they are listed in this function. This prevents the following situation:
|
||||
//
|
||||
// - A ConfigSpec has three controllers in the following order: PVSCSI-1,
|
||||
// NVME-1, and PVSCSI-2.
|
||||
// - The controller PVSCSI-1 is full while NVME-1 and PVSCSI-2 have free
|
||||
// slots.
|
||||
// - The *desired* behavior is to look at all, possible PVSCSI controllers
|
||||
// before moving onto SATA and then finally NVME controllers.
|
||||
// - If the function iterated over the device list in list-order, then the
|
||||
// NVME-1 controller would be located first.
|
||||
// - Instead, this function iterates over each *type* of controller first
|
||||
// before moving onto the next type.
|
||||
// - This means that even though NVME-1 has free slots, PVSCSI-2 is checked
|
||||
// first.
|
||||
//
|
||||
// The order of preference is as follows:
|
||||
//
|
||||
// * SCSI
|
||||
// - ParaVirtualSCSIController
|
||||
// - VirtualBusLogicController
|
||||
// - VirtualLsiLogicController
|
||||
// - VirtualLsiLogicSASController
|
||||
// - VirtualSCSIController
|
||||
//
|
||||
// * SATA
|
||||
// - VirtualSATAController
|
||||
// - VirtualAHCIController
|
||||
//
|
||||
// * NVME
|
||||
// - VirtualNVMEController
|
||||
func ensureDiskControllerFind(
|
||||
disk *VirtualDisk,
|
||||
diskControllers *ensureDiskControllerData) bool {
|
||||
|
||||
return false ||
|
||||
// SCSI
|
||||
ensureDiskControllerFindWith(
|
||||
disk,
|
||||
diskControllers,
|
||||
diskControllers.pvSCSIControllerKeys) ||
|
||||
ensureDiskControllerFindWith(
|
||||
disk,
|
||||
diskControllers,
|
||||
diskControllers.busLogicSCSIControllerKeys) ||
|
||||
ensureDiskControllerFindWith(
|
||||
disk,
|
||||
diskControllers,
|
||||
diskControllers.lsiLogicControllerKeys) ||
|
||||
ensureDiskControllerFindWith(
|
||||
disk,
|
||||
diskControllers,
|
||||
diskControllers.lsiLogicSASControllerKeys) ||
|
||||
ensureDiskControllerFindWith(
|
||||
disk,
|
||||
diskControllers,
|
||||
diskControllers.scsiControllerKeys) ||
|
||||
|
||||
// SATA
|
||||
ensureDiskControllerFindWith(
|
||||
disk,
|
||||
diskControllers,
|
||||
diskControllers.sataControllerKeys) ||
|
||||
ensureDiskControllerFindWith(
|
||||
disk,
|
||||
diskControllers,
|
||||
diskControllers.ahciControllerKeys) ||
|
||||
|
||||
// NVME
|
||||
ensureDiskControllerFindWith(
|
||||
disk,
|
||||
diskControllers,
|
||||
diskControllers.nvmeControllerKeys)
|
||||
}
|
||||
|
||||
func ensureDiskControllerFindWith(
|
||||
disk *VirtualDisk,
|
||||
diskControllers *ensureDiskControllerData,
|
||||
controllerKeys []int32) bool {
|
||||
|
||||
for i := range controllerKeys {
|
||||
controllerKey := controllerKeys[i]
|
||||
if diskControllers.hasFreeSlot(controllerKey) {
|
||||
// If the controller has room for another disk, then use this
|
||||
// controller for the current disk.
|
||||
disk.ControllerKey = controllerKey
|
||||
diskControllers.attach(controllerKey)
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func ensureDiskControllerCreate(
|
||||
configSpec *VirtualMachineConfigSpec,
|
||||
pciController *VirtualPCIController,
|
||||
newDeviceKey int32,
|
||||
diskControllers *ensureDiskControllerData) error {
|
||||
|
||||
var controller BaseVirtualDevice
|
||||
switch {
|
||||
case diskControllers.numSCSIControllers() < maxSCSIControllers:
|
||||
// Prefer creating a new SCSI controller.
|
||||
controller = &ParaVirtualSCSIController{
|
||||
VirtualSCSIController: VirtualSCSIController{
|
||||
VirtualController: VirtualController{
|
||||
VirtualDevice: VirtualDevice{
|
||||
ControllerKey: pciController.Key,
|
||||
Key: newDeviceKey,
|
||||
},
|
||||
BusNumber: diskControllers.scsiBusNumbers.free(),
|
||||
},
|
||||
HotAddRemove: NewBool(true),
|
||||
SharedBus: VirtualSCSISharingNoSharing,
|
||||
},
|
||||
}
|
||||
case diskControllers.numSATAControllers() < maxSATAControllers:
|
||||
// If there are no more SCSI controllers, create a SATA
|
||||
// controller.
|
||||
controller = &VirtualAHCIController{
|
||||
VirtualSATAController: VirtualSATAController{
|
||||
VirtualController: VirtualController{
|
||||
VirtualDevice: VirtualDevice{
|
||||
ControllerKey: pciController.Key,
|
||||
Key: newDeviceKey,
|
||||
},
|
||||
BusNumber: diskControllers.sataBusNumbers.free(),
|
||||
},
|
||||
},
|
||||
}
|
||||
case diskControllers.numNVMEControllers() < maxNVMEControllers:
|
||||
// If there are no more SATA controllers, create an NVME
|
||||
// controller.
|
||||
controller = &VirtualNVMEController{
|
||||
VirtualController: VirtualController{
|
||||
VirtualDevice: VirtualDevice{
|
||||
ControllerKey: pciController.Key,
|
||||
Key: newDeviceKey,
|
||||
},
|
||||
BusNumber: diskControllers.nvmeBusNumbers.free(),
|
||||
},
|
||||
SharedBus: string(VirtualNVMEControllerSharingNoSharing),
|
||||
}
|
||||
default:
|
||||
return fmt.Errorf("no controllers available")
|
||||
}
|
||||
|
||||
// Add the new controller to the ConfigSpec.
|
||||
configSpec.DeviceChange = append(
|
||||
configSpec.DeviceChange,
|
||||
&VirtualDeviceConfigSpec{
|
||||
Operation: VirtualDeviceConfigSpecOperationAdd,
|
||||
Device: controller,
|
||||
})
|
||||
|
||||
// Record the new controller.
|
||||
diskControllers.add(controller)
|
||||
|
||||
return nil
|
||||
}
|
||||
7412
vendor/github.com/vmware/govmomi/vim25/types/enum.go
generated
vendored
7412
vendor/github.com/vmware/govmomi/vim25/types/enum.go
generated
vendored
File diff suppressed because it is too large
Load diff
55
vendor/github.com/vmware/govmomi/vim25/types/hardware_version.go
generated
vendored
55
vendor/github.com/vmware/govmomi/vim25/types/hardware_version.go
generated
vendored
|
|
@ -25,6 +25,10 @@ import (
|
|||
// HardwareVersion is a VMX hardware version.
|
||||
type HardwareVersion uint8
|
||||
|
||||
const (
|
||||
invalidHardwareVersion HardwareVersion = 0
|
||||
)
|
||||
|
||||
const (
|
||||
VMX3 HardwareVersion = iota + 3
|
||||
VMX4
|
||||
|
|
@ -59,12 +63,24 @@ const (
|
|||
MaxValidHardwareVersion = VMX21
|
||||
)
|
||||
|
||||
func (hv HardwareVersion) IsValid() bool {
|
||||
return hv != vmx5 &&
|
||||
// IsSupported returns true if the hardware version is known to and supported by
|
||||
// GoVmomi's generated types.
|
||||
func (hv HardwareVersion) IsSupported() bool {
|
||||
return hv.IsValid() &&
|
||||
hv != vmx5 &&
|
||||
hv >= MinValidHardwareVersion &&
|
||||
hv <= MaxValidHardwareVersion
|
||||
}
|
||||
|
||||
// IsValid returns true if the hardware version is not valid.
|
||||
// Unlike IsSupported, this function returns true as long as the hardware
|
||||
// version is greater than 0.
|
||||
// For example, the result of parsing "abc" or "vmx-abc" is an invalid hardware
|
||||
// version, whereas the result of parsing "vmx-99" is valid, just not supported.
|
||||
func (hv HardwareVersion) IsValid() bool {
|
||||
return hv != invalidHardwareVersion
|
||||
}
|
||||
|
||||
func (hv HardwareVersion) String() string {
|
||||
if hv.IsValid() {
|
||||
return fmt.Sprintf("vmx-%d", hv)
|
||||
|
|
@ -85,7 +101,10 @@ func (hv *HardwareVersion) UnmarshalText(text []byte) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
var vmxRe = regexp.MustCompile(`(?i)^vmx-(\d+)$`)
|
||||
var (
|
||||
vmxRe = regexp.MustCompile(`(?i)^vmx-(\d+)$`)
|
||||
vmxNumOnlyRe = regexp.MustCompile(`^(\d+)$`)
|
||||
)
|
||||
|
||||
// MustParseHardwareVersion parses the provided string into a hardware version.
|
||||
func MustParseHardwareVersion(s string) HardwareVersion {
|
||||
|
|
@ -97,25 +116,35 @@ func MustParseHardwareVersion(s string) HardwareVersion {
|
|||
}
|
||||
|
||||
// ParseHardwareVersion parses the provided string into a hardware version.
|
||||
// Supported formats include vmx-123 or 123. Please note that the parser will
|
||||
// only return an error if the supplied version does not match the supported
|
||||
// formats.
|
||||
// Once parsed, use the function IsSupported to determine if the hardware
|
||||
// version falls into the range of versions known to GoVmomi.
|
||||
func ParseHardwareVersion(s string) (HardwareVersion, error) {
|
||||
var u uint64
|
||||
if m := vmxRe.FindStringSubmatch(s); len(m) > 0 {
|
||||
u, _ = strconv.ParseUint(m[1], 10, 8)
|
||||
} else {
|
||||
u, _ = strconv.ParseUint(s, 10, 8)
|
||||
u, err := strconv.ParseUint(m[1], 10, 8)
|
||||
if err != nil {
|
||||
return invalidHardwareVersion, fmt.Errorf(
|
||||
"failed to parse %s from %q as uint8: %w", m[1], s, err)
|
||||
}
|
||||
return HardwareVersion(u), nil
|
||||
} else if m := vmxNumOnlyRe.FindStringSubmatch(s); len(m) > 0 {
|
||||
u, err := strconv.ParseUint(m[1], 10, 8)
|
||||
if err != nil {
|
||||
return invalidHardwareVersion, fmt.Errorf(
|
||||
"failed to parse %s as uint8: %w", m[1], err)
|
||||
}
|
||||
return HardwareVersion(u), nil
|
||||
}
|
||||
v := HardwareVersion(u)
|
||||
if !v.IsValid() {
|
||||
return 0, fmt.Errorf("invalid version: %q", s)
|
||||
}
|
||||
return v, nil
|
||||
return invalidHardwareVersion, fmt.Errorf("invalid version: %q", s)
|
||||
}
|
||||
|
||||
var hardwareVersions []HardwareVersion
|
||||
|
||||
func init() {
|
||||
for i := MinValidHardwareVersion; i <= MaxValidHardwareVersion; i++ {
|
||||
if i.IsValid() {
|
||||
if i.IsSupported() {
|
||||
hardwareVersions = append(hardwareVersions, i)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
85
vendor/github.com/vmware/govmomi/vim25/types/helpers.go
generated
vendored
85
vendor/github.com/vmware/govmomi/vim25/types/helpers.go
generated
vendored
|
|
@ -1,11 +1,11 @@
|
|||
/*
|
||||
Copyright (c) 2015-2022 VMware, Inc. All Rights Reserved.
|
||||
Copyright (c) 2015-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,
|
||||
|
|
@ -23,6 +23,14 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
func EnumValuesAsStrings[T ~string](enumValues []T) []string {
|
||||
stringValues := make([]string, len(enumValues))
|
||||
for i := range enumValues {
|
||||
stringValues[i] = string(enumValues[i])
|
||||
}
|
||||
return stringValues
|
||||
}
|
||||
|
||||
func NewBool(v bool) *bool {
|
||||
return &v
|
||||
}
|
||||
|
|
@ -120,6 +128,7 @@ func (ci VirtualMachineConfigInfo) ToConfigSpec() VirtualMachineConfigSpec {
|
|||
Flags: &ci.Flags,
|
||||
ConsolePreferences: ci.ConsolePreferences,
|
||||
PowerOpInfo: &ci.DefaultPowerOps,
|
||||
RebootPowerOff: ci.RebootPowerOff,
|
||||
NumCPUs: ci.Hardware.NumCPU,
|
||||
VcpuConfig: ci.VcpuConfig,
|
||||
NumCoresPerSocket: ci.Hardware.NumCoresPerSocket,
|
||||
|
|
@ -129,14 +138,14 @@ func (ci VirtualMachineConfigInfo) ToConfigSpec() VirtualMachineConfigSpec {
|
|||
CpuHotRemoveEnabled: ci.CpuHotRemoveEnabled,
|
||||
VirtualICH7MPresent: ci.Hardware.VirtualICH7MPresent,
|
||||
VirtualSMCPresent: ci.Hardware.VirtualSMCPresent,
|
||||
DeviceChange: make([]BaseVirtualDeviceConfigSpec, len(ci.Hardware.Device)),
|
||||
DeviceChange: nil, // See below
|
||||
CpuAllocation: ci.CpuAllocation,
|
||||
MemoryAllocation: ci.MemoryAllocation,
|
||||
LatencySensitivity: ci.LatencySensitivity,
|
||||
CpuAffinity: ci.CpuAffinity,
|
||||
MemoryAffinity: ci.MemoryAffinity,
|
||||
NetworkShaper: ci.NetworkShaper,
|
||||
CpuFeatureMask: make([]VirtualMachineCpuIdInfoSpec, len(ci.CpuFeatureMask)),
|
||||
CpuFeatureMask: nil, // See below
|
||||
ExtraConfig: ci.ExtraConfig,
|
||||
SwapPlacement: ci.SwapPlacement,
|
||||
BootOptions: ci.BootOptions,
|
||||
|
|
@ -155,20 +164,21 @@ func (ci VirtualMachineConfigInfo) ToConfigSpec() VirtualMachineConfigSpec {
|
|||
MigrateEncryption: ci.MigrateEncryption,
|
||||
FtEncryptionMode: ci.FtEncryptionMode,
|
||||
SevEnabled: ci.SevEnabled,
|
||||
PmemFailoverEnabled: ci.PmemFailoverEnabled,
|
||||
Pmem: ci.Pmem,
|
||||
NpivWorldWideNameOp: ci.NpivWorldWideNameType,
|
||||
RebootPowerOff: ci.RebootPowerOff,
|
||||
MotherboardLayout: ci.Hardware.MotherboardLayout,
|
||||
ScheduledHardwareUpgradeInfo: ci.ScheduledHardwareUpgradeInfo,
|
||||
SgxInfo: ci.SgxInfo,
|
||||
GuestMonitoringModeInfo: ci.GuestMonitoringModeInfo,
|
||||
PmemFailoverEnabled: ci.PmemFailoverEnabled,
|
||||
VmxStatsCollectionEnabled: ci.VmxStatsCollectionEnabled,
|
||||
VmOpNotificationToAppEnabled: ci.VmOpNotificationToAppEnabled,
|
||||
VmOpNotificationTimeout: ci.VmOpNotificationTimeout,
|
||||
DeviceSwap: ci.DeviceSwap,
|
||||
SimultaneousThreads: ci.Hardware.SimultaneousThreads,
|
||||
Pmem: ci.Pmem,
|
||||
DeviceGroups: ci.DeviceGroups,
|
||||
MotherboardLayout: ci.Hardware.MotherboardLayout,
|
||||
FixedPassthruHotPlugEnabled: ci.FixedPassthruHotPlugEnabled,
|
||||
MetroFtEnabled: ci.MetroFtEnabled,
|
||||
MetroFtHostGroup: ci.MetroFtHostGroup,
|
||||
}
|
||||
|
||||
// Unassign the Files field if all of its fields are empty.
|
||||
|
|
@ -210,39 +220,36 @@ func (ci VirtualMachineConfigInfo) ToConfigSpec() VirtualMachineConfigSpec {
|
|||
cs.PowerOpInfo = nil
|
||||
}
|
||||
|
||||
for i := 0; i < len(cs.CpuFeatureMask); i++ {
|
||||
cs.CpuFeatureMask[i] = VirtualMachineCpuIdInfoSpec{
|
||||
ArrayUpdateSpec: ArrayUpdateSpec{
|
||||
Operation: ArrayUpdateOperationAdd,
|
||||
},
|
||||
Info: &HostCpuIdInfo{
|
||||
// TODO: Does DynamicData need to be copied?
|
||||
// It is an empty struct...
|
||||
Level: ci.CpuFeatureMask[i].Level,
|
||||
Vendor: ci.CpuFeatureMask[i].Vendor,
|
||||
Eax: ci.CpuFeatureMask[i].Eax,
|
||||
Ebx: ci.CpuFeatureMask[i].Ebx,
|
||||
Ecx: ci.CpuFeatureMask[i].Ecx,
|
||||
Edx: ci.CpuFeatureMask[i].Edx,
|
||||
},
|
||||
if l := len(ci.CpuFeatureMask); l > 0 {
|
||||
cs.CpuFeatureMask = make([]VirtualMachineCpuIdInfoSpec, l)
|
||||
for i := 0; i < l; i++ {
|
||||
cs.CpuFeatureMask[i] = VirtualMachineCpuIdInfoSpec{
|
||||
ArrayUpdateSpec: ArrayUpdateSpec{
|
||||
Operation: ArrayUpdateOperationAdd,
|
||||
},
|
||||
Info: &HostCpuIdInfo{
|
||||
Level: ci.CpuFeatureMask[i].Level,
|
||||
Vendor: ci.CpuFeatureMask[i].Vendor,
|
||||
Eax: ci.CpuFeatureMask[i].Eax,
|
||||
Ebx: ci.CpuFeatureMask[i].Ebx,
|
||||
Ecx: ci.CpuFeatureMask[i].Ecx,
|
||||
Edx: ci.CpuFeatureMask[i].Edx,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for i := 0; i < len(cs.DeviceChange); i++ {
|
||||
cs.DeviceChange[i] = &VirtualDeviceConfigSpec{
|
||||
// TODO: Does DynamicData need to be copied?
|
||||
// It is an empty struct...
|
||||
Operation: VirtualDeviceConfigSpecOperationAdd,
|
||||
FileOperation: VirtualDeviceConfigSpecFileOperationCreate,
|
||||
Device: ci.Hardware.Device[i],
|
||||
// TODO: It is unclear how the profiles associated with the VM or
|
||||
// its hardware can be reintroduced/persisted in the
|
||||
// ConfigSpec.
|
||||
Profile: nil,
|
||||
// The backing will come from the device.
|
||||
Backing: nil,
|
||||
// TODO: Investigate futher.
|
||||
FilterSpec: nil,
|
||||
if l := len(ci.Hardware.Device); l > 0 {
|
||||
cs.DeviceChange = make([]BaseVirtualDeviceConfigSpec, l)
|
||||
for i := 0; i < l; i++ {
|
||||
cs.DeviceChange[i] = &VirtualDeviceConfigSpec{
|
||||
Operation: VirtualDeviceConfigSpecOperationAdd,
|
||||
FileOperation: VirtualDeviceConfigSpecFileOperationCreate,
|
||||
Device: ci.Hardware.Device[i],
|
||||
Profile: nil,
|
||||
Backing: nil,
|
||||
FilterSpec: nil,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
34
vendor/github.com/vmware/govmomi/vim25/types/if.go
generated
vendored
34
vendor/github.com/vmware/govmomi/vim25/types/if.go
generated
vendored
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 2014-2023 VMware, Inc. All Rights Reserved.
|
||||
Copyright (c) 2014-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.
|
||||
|
|
@ -616,6 +616,28 @@ func init() {
|
|||
t["BaseDVSFeatureCapability"] = reflect.TypeOf((*DVSFeatureCapability)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (b *DVSFilterSpecConnecteeSpec) GetDVSFilterSpecConnecteeSpec() *DVSFilterSpecConnecteeSpec {
|
||||
return b
|
||||
}
|
||||
|
||||
type BaseDVSFilterSpecConnecteeSpec interface {
|
||||
GetDVSFilterSpecConnecteeSpec() *DVSFilterSpecConnecteeSpec
|
||||
}
|
||||
|
||||
func init() {
|
||||
t["BaseDVSFilterSpecConnecteeSpec"] = reflect.TypeOf((*DVSFilterSpecConnecteeSpec)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (b *DVSFilterSpecVlanSpec) GetDVSFilterSpecVlanSpec() *DVSFilterSpecVlanSpec { return b }
|
||||
|
||||
type BaseDVSFilterSpecVlanSpec interface {
|
||||
GetDVSFilterSpecVlanSpec() *DVSFilterSpecVlanSpec
|
||||
}
|
||||
|
||||
func init() {
|
||||
t["BaseDVSFilterSpecVlanSpec"] = reflect.TypeOf((*DVSFilterSpecVlanSpec)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (b *DVSHealthCheckCapability) GetDVSHealthCheckCapability() *DVSHealthCheckCapability { return b }
|
||||
|
||||
type BaseDVSHealthCheckCapability interface {
|
||||
|
|
@ -1790,6 +1812,16 @@ func init() {
|
|||
t["BaseIoFilterInfo"] = reflect.TypeOf((*IoFilterInfo)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (b *IoFilterManagerSslTrust) GetIoFilterManagerSslTrust() *IoFilterManagerSslTrust { return b }
|
||||
|
||||
type BaseIoFilterManagerSslTrust interface {
|
||||
GetIoFilterManagerSslTrust() *IoFilterManagerSslTrust
|
||||
}
|
||||
|
||||
func init() {
|
||||
t["BaseIoFilterManagerSslTrust"] = reflect.TypeOf((*IoFilterManagerSslTrust)(nil)).Elem()
|
||||
}
|
||||
|
||||
func (b *IpAddress) GetIpAddress() *IpAddress { return b }
|
||||
|
||||
type BaseIpAddress interface {
|
||||
|
|
|
|||
7355
vendor/github.com/vmware/govmomi/vim25/types/types.go
generated
vendored
7355
vendor/github.com/vmware/govmomi/vim25/types/types.go
generated
vendored
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue