godep: update vmware/govmomi
This commit is contained in:
25
vendor/github.com/vmware/govmomi/vim25/progress/reader.go
generated
vendored
25
vendor/github.com/vmware/govmomi/vim25/progress/reader.go
generated
vendored
@@ -18,6 +18,7 @@ package progress
|
||||
|
||||
import (
|
||||
"container/list"
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"sync/atomic"
|
||||
@@ -75,16 +76,16 @@ type reader struct {
|
||||
|
||||
pos int64
|
||||
size int64
|
||||
bps uint64
|
||||
|
||||
bps uint64
|
||||
|
||||
ch chan<- Report
|
||||
ch chan<- Report
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
func NewReader(s Sinker, r io.Reader, size int64) *reader {
|
||||
func NewReader(ctx context.Context, s Sinker, r io.Reader, size int64) *reader {
|
||||
pr := reader{
|
||||
r: r,
|
||||
|
||||
r: r,
|
||||
ctx: ctx,
|
||||
size: size,
|
||||
}
|
||||
|
||||
@@ -111,7 +112,10 @@ func (r *reader) Read(b []byte) (int, error) {
|
||||
bps: &r.bps,
|
||||
}
|
||||
|
||||
r.ch <- q
|
||||
select {
|
||||
case r.ch <- q:
|
||||
case <-r.ctx.Done():
|
||||
}
|
||||
|
||||
return n, err
|
||||
}
|
||||
@@ -127,8 +131,11 @@ func (r *reader) Done(err error) {
|
||||
err: err,
|
||||
}
|
||||
|
||||
r.ch <- q
|
||||
close(r.ch)
|
||||
select {
|
||||
case r.ch <- q:
|
||||
close(r.ch)
|
||||
case <-r.ctx.Done():
|
||||
}
|
||||
}
|
||||
|
||||
// newBpsLoop returns a sink that monitors and stores throughput.
|
||||
|
||||
35
vendor/github.com/vmware/govmomi/vim25/soap/client.go
generated
vendored
35
vendor/github.com/vmware/govmomi/vim25/soap/client.go
generated
vendored
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright (c) 2014-2017 VMware, Inc. All Rights Reserved.
|
||||
Copyright (c) 2014-2018 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.
|
||||
@@ -56,6 +56,7 @@ const (
|
||||
DefaultVimNamespace = "urn:vim25"
|
||||
DefaultVimVersion = "6.5"
|
||||
DefaultMinVimVersion = "5.5"
|
||||
SessionCookieName = "vmware_soap_session"
|
||||
)
|
||||
|
||||
type header struct {
|
||||
@@ -168,7 +169,7 @@ func (c *Client) NewServiceClient(path string, namespace string) *Client {
|
||||
|
||||
// Set SOAP Header cookie
|
||||
for _, cookie := range client.Jar.Cookies(u) {
|
||||
if cookie.Name == "vmware_soap_session" {
|
||||
if cookie.Name == SessionCookieName {
|
||||
client.cookie = cookie.Value
|
||||
break
|
||||
}
|
||||
@@ -458,6 +459,8 @@ func (c *Client) RoundTrip(ctx context.Context, reqBody, resBody HasFault) error
|
||||
panic(err)
|
||||
}
|
||||
|
||||
req = req.WithContext(ctx)
|
||||
|
||||
req.Header.Set(`Content-Type`, `text/xml; charset="utf-8"`)
|
||||
soapAction := fmt.Sprintf("%s/%s", c.Namespace, c.Version)
|
||||
req.Header.Set(`SOAPAction`, soapAction)
|
||||
@@ -548,11 +551,11 @@ var DefaultUpload = Upload{
|
||||
}
|
||||
|
||||
// Upload PUTs the local file to the given URL
|
||||
func (c *Client) Upload(f io.Reader, u *url.URL, param *Upload) error {
|
||||
func (c *Client) Upload(ctx context.Context, f io.Reader, u *url.URL, param *Upload) error {
|
||||
var err error
|
||||
|
||||
if param.Progress != nil {
|
||||
pr := progress.NewReader(param.Progress, f, param.ContentLength)
|
||||
pr := progress.NewReader(ctx, param.Progress, f, param.ContentLength)
|
||||
f = pr
|
||||
|
||||
// Mark progress reader as done when returning from this function.
|
||||
@@ -566,6 +569,8 @@ func (c *Client) Upload(f io.Reader, u *url.URL, param *Upload) error {
|
||||
return err
|
||||
}
|
||||
|
||||
req = req.WithContext(ctx)
|
||||
|
||||
req.ContentLength = param.ContentLength
|
||||
req.Header.Set("Content-Type", param.Type)
|
||||
|
||||
@@ -593,7 +598,7 @@ func (c *Client) Upload(f io.Reader, u *url.URL, param *Upload) error {
|
||||
}
|
||||
|
||||
// UploadFile PUTs the local file to the given URL
|
||||
func (c *Client) UploadFile(file string, u *url.URL, param *Upload) error {
|
||||
func (c *Client) UploadFile(ctx context.Context, file string, u *url.URL, param *Upload) error {
|
||||
if param == nil {
|
||||
p := DefaultUpload // Copy since we set ContentLength
|
||||
param = &p
|
||||
@@ -612,7 +617,7 @@ func (c *Client) UploadFile(file string, u *url.URL, param *Upload) error {
|
||||
|
||||
param.ContentLength = s.Size()
|
||||
|
||||
return c.Upload(f, u, param)
|
||||
return c.Upload(ctx, f, u, param)
|
||||
}
|
||||
|
||||
type Download struct {
|
||||
@@ -628,12 +633,14 @@ var DefaultDownload = Download{
|
||||
}
|
||||
|
||||
// DownloadRequest wraps http.Client.Do, returning the http.Response without checking its StatusCode
|
||||
func (c *Client) DownloadRequest(u *url.URL, param *Download) (*http.Response, error) {
|
||||
func (c *Client) DownloadRequest(ctx context.Context, u *url.URL, param *Download) (*http.Response, error) {
|
||||
req, err := http.NewRequest(param.Method, u.String(), nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
req = req.WithContext(ctx)
|
||||
|
||||
for k, v := range param.Headers {
|
||||
req.Header.Add(k, v)
|
||||
}
|
||||
@@ -646,8 +653,8 @@ func (c *Client) DownloadRequest(u *url.URL, param *Download) (*http.Response, e
|
||||
}
|
||||
|
||||
// Download GETs the remote file from the given URL
|
||||
func (c *Client) Download(u *url.URL, param *Download) (io.ReadCloser, int64, error) {
|
||||
res, err := c.DownloadRequest(u, param)
|
||||
func (c *Client) Download(ctx context.Context, u *url.URL, param *Download) (io.ReadCloser, int64, error) {
|
||||
res, err := c.DownloadRequest(ctx, u, param)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
@@ -667,7 +674,7 @@ func (c *Client) Download(u *url.URL, param *Download) (io.ReadCloser, int64, er
|
||||
return r, res.ContentLength, nil
|
||||
}
|
||||
|
||||
func (c *Client) WriteFile(file string, src io.Reader, size int64, s progress.Sinker, w io.Writer) error {
|
||||
func (c *Client) WriteFile(ctx context.Context, file string, src io.Reader, size int64, s progress.Sinker, w io.Writer) error {
|
||||
var err error
|
||||
|
||||
r := src
|
||||
@@ -678,7 +685,7 @@ func (c *Client) WriteFile(file string, src io.Reader, size int64, s progress.Si
|
||||
}
|
||||
|
||||
if s != nil {
|
||||
pr := progress.NewReader(s, src, size)
|
||||
pr := progress.NewReader(ctx, s, src, size)
|
||||
src = pr
|
||||
|
||||
// Mark progress reader as done when returning from this function.
|
||||
@@ -705,16 +712,16 @@ func (c *Client) WriteFile(file string, src io.Reader, size int64, s progress.Si
|
||||
}
|
||||
|
||||
// DownloadFile GETs the given URL to a local file
|
||||
func (c *Client) DownloadFile(file string, u *url.URL, param *Download) error {
|
||||
func (c *Client) DownloadFile(ctx context.Context, file string, u *url.URL, param *Download) error {
|
||||
var err error
|
||||
if param == nil {
|
||||
param = &DefaultDownload
|
||||
}
|
||||
|
||||
rc, contentLength, err := c.Download(u, param)
|
||||
rc, contentLength, err := c.Download(ctx, u, param)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return c.WriteFile(file, rc, contentLength, param.Progress, param.Writer)
|
||||
return c.WriteFile(ctx, file, rc, contentLength, param.Progress, param.Writer)
|
||||
}
|
||||
|
||||
7
vendor/github.com/vmware/govmomi/vim25/types/helpers.go
generated
vendored
7
vendor/github.com/vmware/govmomi/vim25/types/helpers.go
generated
vendored
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package types
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -86,3 +87,9 @@ func DefaultResourceConfigSpec() ResourceConfigSpec {
|
||||
MemoryAllocation: defaultResourceAllocationInfo(),
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
// Known 6.5 issue where this event type is sent even though it is internal.
|
||||
// This workaround allows us to unmarshal and avoid NPEs.
|
||||
t["HostSubSpecificationUpdateEvent"] = reflect.TypeOf((*HostEvent)(nil)).Elem()
|
||||
}
|
||||
|
||||
2
vendor/github.com/vmware/govmomi/vim25/types/types.go
generated
vendored
2
vendor/github.com/vmware/govmomi/vim25/types/types.go
generated
vendored
@@ -48188,7 +48188,7 @@ func init() {
|
||||
type VirtualMachineAffinityInfo struct {
|
||||
DynamicData
|
||||
|
||||
AffinitySet []int32 `xml:"affinitySet,omitempty"`
|
||||
AffinitySet []int32 `xml:"affinitySet"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
Reference in New Issue
Block a user