diff --git a/hack/vendor.sh b/hack/vendor.sh index 8e5ceeb7f9704a2121525a8e34bc119508bf1b66..1efa1b2dd9a8a54260c15e141034f70316a73dbe 100755 --- a/hack/vendor.sh +++ b/hack/vendor.sh @@ -60,7 +60,7 @@ clone git golang.org/x/net 78cb2c067747f08b343f20614155233ab4ea2ad3 https://gith clone git golang.org/x/sys eb2c74142fd19a79b3f237334c7384d5167b1b46 https://github.com/golang/sys.git clone git github.com/docker/go-units 651fc226e7441360384da338d0fd37f2440ffbe3 clone git github.com/docker/go-connections v0.2.0 -clone git github.com/docker/engine-api e374c4fb5b121a8fd4295ec5eb91a8068c6304f4 +clone git github.com/docker/engine-api 12fbeb3ac3ca5dc5d0f01d6bac9bda518d46d983 clone git github.com/RackSec/srslog 259aed10dfa74ea2961eddd1d9847619f6e98837 clone git github.com/imdario/mergo 0.2.1 diff --git a/vendor/src/github.com/docker/engine-api/client/checkpoint_create.go b/vendor/src/github.com/docker/engine-api/client/checkpoint_create.go new file mode 100644 index 0000000000000000000000000000000000000000..23883cc06c206f6b1234cdd583376111424e31b8 --- /dev/null +++ b/vendor/src/github.com/docker/engine-api/client/checkpoint_create.go @@ -0,0 +1,13 @@ +package client + +import ( + "github.com/docker/engine-api/types" + "golang.org/x/net/context" +) + +// CheckpointCreate creates a checkpoint from the given container with the given name +func (cli *Client) CheckpointCreate(ctx context.Context, container string, options types.CheckpointCreateOptions) error { + resp, err := cli.post(ctx, "/containers/"+container+"/checkpoints", nil, options, nil) + ensureReaderClosed(resp) + return err +} diff --git a/vendor/src/github.com/docker/engine-api/client/checkpoint_delete.go b/vendor/src/github.com/docker/engine-api/client/checkpoint_delete.go new file mode 100644 index 0000000000000000000000000000000000000000..a4e9ed0c062b81d6f99891043fe255ad4472e92d --- /dev/null +++ b/vendor/src/github.com/docker/engine-api/client/checkpoint_delete.go @@ -0,0 +1,12 @@ +package client + +import ( + "golang.org/x/net/context" +) + +// CheckpointDelete deletes the checkpoint with the given name from the given container +func (cli *Client) CheckpointDelete(ctx context.Context, containerID string, checkpointID string) error { + resp, err := cli.delete(ctx, "/containers/"+containerID+"/checkpoints/"+checkpointID, nil, nil) + ensureReaderClosed(resp) + return err +} diff --git a/vendor/src/github.com/docker/engine-api/client/checkpoint_list.go b/vendor/src/github.com/docker/engine-api/client/checkpoint_list.go new file mode 100644 index 0000000000000000000000000000000000000000..ef5ec261b697cc25503704d88caf29d2f36aa323 --- /dev/null +++ b/vendor/src/github.com/docker/engine-api/client/checkpoint_list.go @@ -0,0 +1,22 @@ +package client + +import ( + "encoding/json" + + "github.com/docker/engine-api/types" + "golang.org/x/net/context" +) + +// CheckpointList returns the volumes configured in the docker host. +func (cli *Client) CheckpointList(ctx context.Context, container string) ([]types.Checkpoint, error) { + var checkpoints []types.Checkpoint + + resp, err := cli.get(ctx, "/containers/"+container+"/checkpoints", nil, nil) + if err != nil { + return checkpoints, err + } + + err = json.NewDecoder(resp.body).Decode(&checkpoints) + ensureReaderClosed(resp) + return checkpoints, err +} diff --git a/vendor/src/github.com/docker/engine-api/client/container_inspect.go b/vendor/src/github.com/docker/engine-api/client/container_inspect.go index afd71eefcb0160451b4ecb859063a37564a38c65..bbf560e631778d02db77b51fa63e45a2c9d7e35b 100644 --- a/vendor/src/github.com/docker/engine-api/client/container_inspect.go +++ b/vendor/src/github.com/docker/engine-api/client/container_inspect.go @@ -52,14 +52,3 @@ func (cli *Client) ContainerInspectWithRaw(ctx context.Context, containerID stri err = json.NewDecoder(rdr).Decode(&response) return response, body, err } - -func (cli *Client) containerInspectWithResponse(ctx context.Context, containerID string, query url.Values) (types.ContainerJSON, *serverResponse, error) { - serverResp, err := cli.get(ctx, "/containers/"+containerID+"/json", nil, nil) - if err != nil { - return types.ContainerJSON{}, serverResp, err - } - - var response types.ContainerJSON - err = json.NewDecoder(serverResp.body).Decode(&response) - return response, serverResp, err -} diff --git a/vendor/src/github.com/docker/engine-api/client/container_start.go b/vendor/src/github.com/docker/engine-api/client/container_start.go index 12a979422eff12f815f72d44ce4a203f1058e4c2..ff11c4cf0e681c151250728d6046f7197891dff5 100644 --- a/vendor/src/github.com/docker/engine-api/client/container_start.go +++ b/vendor/src/github.com/docker/engine-api/client/container_start.go @@ -1,10 +1,17 @@ package client -import "golang.org/x/net/context" +import ( + "net/url" + + "golang.org/x/net/context" +) // ContainerStart sends a request to the docker daemon to start a container. -func (cli *Client) ContainerStart(ctx context.Context, containerID string) error { - resp, err := cli.post(ctx, "/containers/"+containerID+"/start", nil, nil, nil) +func (cli *Client) ContainerStart(ctx context.Context, containerID string, checkpointID string) error { + query := url.Values{} + query.Set("checkpoint", checkpointID) + + resp, err := cli.post(ctx, "/containers/"+containerID+"/start", query, nil, nil) ensureReaderClosed(resp) return err } diff --git a/vendor/src/github.com/docker/engine-api/client/events.go b/vendor/src/github.com/docker/engine-api/client/events.go index e379ce0a2945a461d0783faa6665ce065cb136d8..f22a18e1d33273b647019b1fce12b54b6803f0e2 100644 --- a/vendor/src/github.com/docker/engine-api/client/events.go +++ b/vendor/src/github.com/docker/engine-api/client/events.go @@ -33,7 +33,7 @@ func (cli *Client) Events(ctx context.Context, options types.EventsOptions) (io. query.Set("until", ts) } if options.Filters.Len() > 0 { - filterJSON, err := filters.ToParam(options.Filters) + filterJSON, err := filters.ToParamWithVersion(cli.version, options.Filters) if err != nil { return nil, err } diff --git a/vendor/src/github.com/docker/engine-api/client/image_list.go b/vendor/src/github.com/docker/engine-api/client/image_list.go index 347810e663d24390d525449a638a4040db16b70f..7408258231b3dfa85c6ead99666f20402810d40c 100644 --- a/vendor/src/github.com/docker/engine-api/client/image_list.go +++ b/vendor/src/github.com/docker/engine-api/client/image_list.go @@ -15,7 +15,7 @@ func (cli *Client) ImageList(ctx context.Context, options types.ImageListOptions query := url.Values{} if options.Filters.Len() > 0 { - filterJSON, err := filters.ToParam(options.Filters) + filterJSON, err := filters.ToParamWithVersion(cli.version, options.Filters) if err != nil { return images, err } diff --git a/vendor/src/github.com/docker/engine-api/client/interface.go b/vendor/src/github.com/docker/engine-api/client/interface.go index 2c6872f534be2dabf4c99ce170b10513fb5adb53..2dc9b229876880401e28effbd5600a030ec97f71 100644 --- a/vendor/src/github.com/docker/engine-api/client/interface.go +++ b/vendor/src/github.com/docker/engine-api/client/interface.go @@ -15,6 +15,9 @@ import ( // APIClient is an interface that clients that talk with a docker server must implement. type APIClient interface { ClientVersion() string + CheckpointCreate(ctx context.Context, container string, options types.CheckpointCreateOptions) error + CheckpointDelete(ctx context.Context, container string, checkpointID string) error + CheckpointList(ctx context.Context, container string) ([]types.Checkpoint, error) ContainerAttach(ctx context.Context, container string, options types.ContainerAttachOptions) (types.HijackedResponse, error) ContainerCommit(ctx context.Context, container string, options types.ContainerCommitOptions) (types.ContainerCommitResponse, error) ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig, networkingConfig *network.NetworkingConfig, containerName string) (types.ContainerCreateResponse, error) @@ -37,7 +40,7 @@ type APIClient interface { ContainerRestart(ctx context.Context, container string, timeout int) error ContainerStatPath(ctx context.Context, container, path string) (types.ContainerPathStat, error) ContainerStats(ctx context.Context, container string, stream bool) (io.ReadCloser, error) - ContainerStart(ctx context.Context, container string) error + ContainerStart(ctx context.Context, container string, checkpointID string) error ContainerStop(ctx context.Context, container string, timeout int) error ContainerTop(ctx context.Context, container string, arguments []string) (types.ContainerProcessList, error) ContainerUnpause(ctx context.Context, container string) error diff --git a/vendor/src/github.com/docker/engine-api/client/network_list.go b/vendor/src/github.com/docker/engine-api/client/network_list.go index 813109c1802c0e3dfca681957f7c1a3ac318066f..0569552496710a79b1f0da128cda3884e9efdc3a 100644 --- a/vendor/src/github.com/docker/engine-api/client/network_list.go +++ b/vendor/src/github.com/docker/engine-api/client/network_list.go @@ -13,7 +13,7 @@ import ( func (cli *Client) NetworkList(ctx context.Context, options types.NetworkListOptions) ([]types.NetworkResource, error) { query := url.Values{} if options.Filters.Len() > 0 { - filterJSON, err := filters.ToParam(options.Filters) + filterJSON, err := filters.ToParamWithVersion(cli.version, options.Filters) if err != nil { return nil, err } diff --git a/vendor/src/github.com/docker/engine-api/client/request.go b/vendor/src/github.com/docker/engine-api/client/request.go index 5b283a4f95cea742b284acc8ff8c8ac191b27761..21ed0d0fc9fe0d923ba57936d5a0fe487bc5bfc8 100644 --- a/vendor/src/github.com/docker/engine-api/client/request.go +++ b/vendor/src/github.com/docker/engine-api/client/request.go @@ -172,6 +172,8 @@ func encodeData(data interface{}) (*bytes.Buffer, error) { func ensureReaderClosed(response *serverResponse) { if response != nil && response.body != nil { + // Drain up to 512 bytes and close the body to let the Transport reuse the connection + io.CopyN(ioutil.Discard, response.body, 512) response.body.Close() } } diff --git a/vendor/src/github.com/docker/engine-api/client/volume_list.go b/vendor/src/github.com/docker/engine-api/client/volume_list.go index bb4c40d5f9815d3aadc4e7a5741780f45d266d02..7c6ccf834f14791aafe07cc8860162be32cd2365 100644 --- a/vendor/src/github.com/docker/engine-api/client/volume_list.go +++ b/vendor/src/github.com/docker/engine-api/client/volume_list.go @@ -15,7 +15,7 @@ func (cli *Client) VolumeList(ctx context.Context, filter filters.Args) (types.V query := url.Values{} if filter.Len() > 0 { - filterJSON, err := filters.ToParam(filter) + filterJSON, err := filters.ToParamWithVersion(cli.version, filter) if err != nil { return volumes, err } diff --git a/vendor/src/github.com/docker/engine-api/types/client.go b/vendor/src/github.com/docker/engine-api/types/client.go index fa3b2cfb458ca871a28956583570472d843f291d..1b529a905faece0c79b99965f2a14ea8f0af6bf1 100644 --- a/vendor/src/github.com/docker/engine-api/types/client.go +++ b/vendor/src/github.com/docker/engine-api/types/client.go @@ -10,6 +10,12 @@ import ( "github.com/docker/go-units" ) +// CheckpointCreateOptions holds parameters to create a checkpoint from a container +type CheckpointCreateOptions struct { + CheckpointID string + Exit bool +} + // ContainerAttachOptions holds parameters to attach to a container. type ContainerAttachOptions struct { Stream bool diff --git a/vendor/src/github.com/docker/engine-api/types/container/host_config.go b/vendor/src/github.com/docker/engine-api/types/container/host_config.go index 531408c94dc9c59b84adbcd2b246ed2e8d3354b6..039fa04e4e2b769a9288df31ee98897599b60fc5 100644 --- a/vendor/src/github.com/docker/engine-api/types/container/host_config.go +++ b/vendor/src/github.com/docker/engine-api/types/container/host_config.go @@ -257,11 +257,10 @@ type Resources struct { Ulimits []*units.Ulimit // List of ulimits to be set in the container // Applicable to Windows - CPUCount int64 `json:"CpuCount"` // CPU count - CPUPercent int64 `json:"CpuPercent"` // CPU percent - IOMaximumIOps uint64 // Maximum IOps for the container system drive - IOMaximumBandwidth uint64 // Maximum IO in bytes per second for the container system drive - NetworkMaximumBandwidth uint64 // Maximum bandwidth of the network endpoint in bytes per second + CPUCount int64 `json:"CpuCount"` // CPU count + CPUPercent int64 `json:"CpuPercent"` // CPU percent + IOMaximumIOps uint64 // Maximum IOps for the container system drive + IOMaximumBandwidth uint64 // Maximum IO in bytes per second for the container system drive } // UpdateConfig holds the mutable attributes of a Container. diff --git a/vendor/src/github.com/docker/engine-api/types/filters/parse.go b/vendor/src/github.com/docker/engine-api/types/filters/parse.go index 0e0d7e38054129a7e8c8ef3c9172afc74ebfcafc..dc2c48b89422c9e37c319f04b85a48eaa0d3f8b0 100644 --- a/vendor/src/github.com/docker/engine-api/types/filters/parse.go +++ b/vendor/src/github.com/docker/engine-api/types/filters/parse.go @@ -215,10 +215,22 @@ func (filters Args) ExactMatch(field, source string) bool { } // try to match full name value to avoid O(N) regular expression matching - if fieldValues[source] { + return fieldValues[source] +} + +// UniqueExactMatch returns true if there is only one filter and the source matches exactly this one. +func (filters Args) UniqueExactMatch(field, source string) bool { + fieldValues := filters.fields[field] + //do not filter if there is no filter set or cannot determine filter + if len(fieldValues) == 0 { return true } - return false + if len(filters.fields[field]) != 1 { + return false + } + + // try to match full name value to avoid O(N) regular expression matching + return fieldValues[source] } // FuzzyMatch returns true if the source matches exactly one of the filters, diff --git a/vendor/src/github.com/docker/engine-api/types/types.go b/vendor/src/github.com/docker/engine-api/types/types.go index cb2dc9ac9d7760f2d32707a40112bd8d369fd220..7994c11811c3e051625eccd8ba833966c322c33e 100644 --- a/vendor/src/github.com/docker/engine-api/types/types.go +++ b/vendor/src/github.com/docker/engine-api/types/types.go @@ -471,3 +471,8 @@ type NetworkDisconnect struct { Container string Force bool } + +// Checkpoint represents the details of a checkpoint +type Checkpoint struct { + Name string // Name is the name of the checkpoint +}