mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-25 19:05:13 +00:00
Fix for Support selection of datastore for dynamic provisioning in vSphere
This commit is contained in:
committed by
Ritesh H Shukla
parent
b201ac2f8f
commit
12f75f0b86
35
vendor/github.com/vmware/govmomi/vim25/mo/ancestors.go
generated
vendored
35
vendor/github.com/vmware/govmomi/vim25/mo/ancestors.go
generated
vendored
@@ -17,11 +17,11 @@ limitations under the License.
|
||||
package mo
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/vmware/govmomi/vim25/soap"
|
||||
"github.com/vmware/govmomi/vim25/types"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// Ancestors returns the entire ancestry tree of a specified managed object.
|
||||
@@ -39,13 +39,28 @@ func Ancestors(ctx context.Context, rt soap.RoundTripper, pc, obj types.ManagedO
|
||||
&types.SelectionSpec{Name: "traverseParent"},
|
||||
},
|
||||
},
|
||||
&types.TraversalSpec{
|
||||
SelectionSpec: types.SelectionSpec{},
|
||||
Type: "VirtualMachine",
|
||||
Path: "parentVApp",
|
||||
Skip: types.NewBool(false),
|
||||
SelectSet: []types.BaseSelectionSpec{
|
||||
&types.SelectionSpec{Name: "traverseParent"},
|
||||
},
|
||||
},
|
||||
},
|
||||
Skip: types.NewBool(false),
|
||||
}
|
||||
|
||||
pspec := types.PropertySpec{
|
||||
Type: "ManagedEntity",
|
||||
PathSet: []string{"name", "parent"},
|
||||
pspec := []types.PropertySpec{
|
||||
{
|
||||
Type: "ManagedEntity",
|
||||
PathSet: []string{"name", "parent"},
|
||||
},
|
||||
{
|
||||
Type: "VirtualMachine",
|
||||
PathSet: []string{"parentVApp"},
|
||||
},
|
||||
}
|
||||
|
||||
req := types.RetrieveProperties{
|
||||
@@ -53,13 +68,12 @@ func Ancestors(ctx context.Context, rt soap.RoundTripper, pc, obj types.ManagedO
|
||||
SpecSet: []types.PropertyFilterSpec{
|
||||
{
|
||||
ObjectSet: []types.ObjectSpec{ospec},
|
||||
PropSet: []types.PropertySpec{pspec},
|
||||
PropSet: pspec,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var ifaces []interface{}
|
||||
|
||||
err := RetrievePropertiesForRequest(ctx, rt, req, &ifaces)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -96,6 +110,15 @@ func Ancestors(ctx context.Context, rt soap.RoundTripper, pc, obj types.ManagedO
|
||||
}
|
||||
}
|
||||
|
||||
if me.Parent == nil {
|
||||
// Special case for VirtualMachine within VirtualApp,
|
||||
// unlikely to hit this other than via Finder.Element()
|
||||
switch x := iface.(type) {
|
||||
case VirtualMachine:
|
||||
me.Parent = x.ParentVApp
|
||||
}
|
||||
}
|
||||
|
||||
if me.Parent == nil {
|
||||
out = append(out, me)
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user