mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-12-03 14:53:52 +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
20
vendor/github.com/vmware/govmomi/property/wait.go
generated
vendored
20
vendor/github.com/vmware/govmomi/property/wait.go
generated
vendored
@@ -17,8 +17,9 @@ limitations under the License.
|
||||
package property
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/vmware/govmomi/vim25/types"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
// Wait waits for any of the specified properties of the specified managed
|
||||
@@ -60,11 +61,17 @@ func Wait(ctx context.Context, c *Collector, obj types.ManagedObjectReference, p
|
||||
},
|
||||
}
|
||||
|
||||
if len(ps) == 0 {
|
||||
req.Spec.PropSet[0].All = types.NewBool(true)
|
||||
}
|
||||
|
||||
err = p.CreateFilter(ctx, req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return waitLoop(ctx, p, f)
|
||||
return waitLoop(ctx, p, func(_ types.ManagedObjectReference, pc []types.PropertyChange) bool {
|
||||
return f(pc)
|
||||
})
|
||||
}
|
||||
|
||||
// WaitForView waits for any of the specified properties of the managed
|
||||
@@ -81,7 +88,7 @@ func Wait(ctx context.Context, c *Collector, obj types.ManagedObjectReference, p
|
||||
// in case of success or error).
|
||||
//
|
||||
// The code assumes that all objects in the View are the same type
|
||||
func WaitForView(ctx context.Context, c *Collector, view types.ManagedObjectReference, obj types.ManagedObjectReference, ps []string, f func([]types.PropertyChange) bool) error {
|
||||
func WaitForView(ctx context.Context, c *Collector, view types.ManagedObjectReference, obj types.ManagedObjectReference, ps []string, f func(types.ManagedObjectReference, []types.PropertyChange) bool) error {
|
||||
p, err := c.Create(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -92,7 +99,6 @@ func WaitForView(ctx context.Context, c *Collector, view types.ManagedObjectRefe
|
||||
defer p.Destroy(context.Background())
|
||||
|
||||
req := types.CreateFilter{
|
||||
|
||||
Spec: types.PropertyFilterSpec{
|
||||
ObjectSet: []types.ObjectSpec{
|
||||
{
|
||||
@@ -107,7 +113,7 @@ func WaitForView(ctx context.Context, c *Collector, view types.ManagedObjectRefe
|
||||
},
|
||||
},
|
||||
PropSet: []types.PropertySpec{
|
||||
types.PropertySpec{
|
||||
{
|
||||
Type: obj.Type,
|
||||
PathSet: ps,
|
||||
},
|
||||
@@ -121,7 +127,7 @@ func WaitForView(ctx context.Context, c *Collector, view types.ManagedObjectRefe
|
||||
return waitLoop(ctx, p, f)
|
||||
}
|
||||
|
||||
func waitLoop(ctx context.Context, c *Collector, f func([]types.PropertyChange) bool) error {
|
||||
func waitLoop(ctx context.Context, c *Collector, f func(types.ManagedObjectReference, []types.PropertyChange) bool) error {
|
||||
for version := ""; ; {
|
||||
res, err := c.WaitForUpdates(ctx, version)
|
||||
if err != nil {
|
||||
@@ -137,7 +143,7 @@ func waitLoop(ctx context.Context, c *Collector, f func([]types.PropertyChange)
|
||||
|
||||
for _, fs := range res.FilterSet {
|
||||
for _, os := range fs.ObjectSet {
|
||||
if f(os.ChangeSet) {
|
||||
if f(os.Obj, os.ChangeSet) {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user