Commit Graph

11956 Commits

Author SHA1 Message Date
Derek McGowan
f0b3d5a2c5
Move image creation after unpack
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-05-07 15:50:51 -07:00
Derek McGowan
2bc9f49ffd
Retry image creation after update not found
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-05-07 15:50:51 -07:00
Derek McGowan
28caf9027e
Add recursive apply layer function
Update apply layers to recursive from the top layer.
Update apply layer to check for exists and apply single layer.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-05-07 15:50:04 -07:00
Lantao Liu
a5d1332e8f Explicitly set rw for privileged container.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-05-07 15:13:14 -07:00
Derek McGowan
70d629fc1d
Add missing return statement on pull unpack
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-05-07 14:18:22 -07:00
Derek McGowan
6eee2a0785
Merge pull request #2324 from kolyshkin/mountinfo
mount/mountinfo_linux: parser speed up
2018-05-07 13:46:39 -07:00
Kir Kolyshkin
8eec9259e6 mount/mountinfo_linux: parser speed up
The mountinfo parser implemented via `fmt.Sscanf()` is slower than the one
using `strings.Split()` and `strconv.Atoi()`. This rewrite helps to speed it
up to a factor of 8x, here is a result from `go bench`:

> BenchmarkParsingScanf-4            300          22294112 ns/op
> BenchmarkParsingSplit-4           3000           2780703 ns/op

I tried other approaches, such as using `fmt.Sscanf()` for the first
three (integer) fields and `strings.Split()` for the rest, but it slows
things down considerably:

> BenchmarkParsingMixed-4           1000           8827058 ns/op

Note the old code uses `fmt.Sscanf` first, then a linear search for the
'-' field, then a split for the last 3 fields. The new code relies
on a single split.

One other thing is, the new code is more future proof as it skips
extra optional fields before the separator (currently there are none).

I have also added more comments to aid in future development.

Finally, the test data is fixed to not have white space before
the first field.

Based on a similar change in Moby,
 https://github.com/moby/moby/pull/36091

[v2: remove no-op break statement to silence staticcheck]
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-05-07 11:38:37 -07:00
Derek McGowan
f701b3b960
Fix race in ctr pull
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-05-07 10:29:24 -07:00
Derek McGowan
e017143dde
Merge pull request #2328 from crosbymichael/client-clean
Move import/export code to separate client file
2018-05-04 13:31:47 -07:00
Michael Crosby
8ee52bfca9 Move import/export code to separate client file
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-05-04 15:48:41 -04:00
Michael Crosby
e22c827cf5
Merge pull request #2323 from stevvooe/ping-snapshots-from-cli
cmd/snapshots: add gc.root to created snapshots
2018-05-04 13:27:44 -04:00
Derek McGowan
fc1d936f2c
Merge pull request #2326 from cloudfoundry-incubator/pr-oom-score
Don't fail on setting -ve oom score when rootless
2018-05-04 10:23:59 -07:00
Claudia Beresford
544b985ff2 Don't fail on setting -ve oom score when rootless
This allows non-privileged users to use containerd.
If a non root user tried to set a negative oom score adjustment,
it will fail. Containerd should not fail if running rootless.

This is part of a larger track of work integrating containerd
into Cloudfoundry's garden with support for rootless.

[#156343443]

Signed-off-by: Danail Branekov <danailster@gmail.com>
2018-05-04 17:06:01 +01:00
Michael Crosby
08b43d9200
Merge pull request #2325 from cloudfoundry-incubator/pr-tempdir
Use user-specific temp directory if set
2018-05-04 10:25:00 -04:00
Tom Godkin
fc8bce59b9 Use user-specific temp directory if set
This allows non-privileged users to use containerd. This is part of a
larger track of work integrating containerd into Cloudfoundry's garden
with support for rootless.

[#156343575]

Signed-off-by: Claudia Beresford <cberesford@pivotal.io>
2018-05-04 10:27:58 +01:00
Michael Crosby
40c3acd36c
Merge pull request #2322 from darrenstahlmsft/revendorHcsshim
Update hcsshim to v0.6.10
2018-05-03 13:10:39 -04:00
Stephen J Day
ed72059fac
cmd/snapshots: add gc.root to created snapshots
This adds gc.root label to snapshots created with prepare and commit via
the CLI. WIthout this, created snapshots get immediately garbage
collected. There may be a better solution but this seems to be a solid
stop gap.

We may also need to add more functionality around snapshot labeling for
the CLI but current use cases are unclear.

Signed-off-by: Stephen J Day <stevvooe@gmail.com>
2018-05-03 07:09:38 +02:00
Darren Stahl
07d8716004 Update hcsshim to v0.6.10
Signed-off-by: Darren Stahl <darst@microsoft.com>
2018-05-02 16:19:15 -07:00
Michael Crosby
cfba048bec
Merge pull request #2319 from ijc/update-go-digest
Bump to latest go-digest.
2018-05-01 10:57:13 -04:00
Ian Campbell
623407a399 Re-vndr with newest vndr
This seems to pickup a bunch of *.c files and some other changes which follow
from having included some new packages because of that.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2018-05-01 00:18:17 +01:00
Ian Campbell
388c73052a Bump to latest go-digest.
This renames the license file (so automated tooling can find it, which I care
about) and also pulls in some documentation and comment changes, plus some
functional changes:

PR#33 -- future-proof the algorithm field.
PR#34 -- disallow upper case in hex portion.

No changes appear to be required to containerd code.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
2018-04-30 23:38:02 +01:00
Lantao Liu
5f4035ae2f
Merge pull request #754 from kolyshkin/mount
os.Unmount: do not consult mountinfo
2018-04-30 14:41:57 -07:00
Kir Kolyshkin
daeab40b45 os.Unmount: do not consult mountinfo, drop flags
1. Currently, Unmount() call takes a burden to parse the whole nine yards
of /proc/self/mountinfo to figure out whether the given mount point is
mounted or not (and returns an error in case parsing fails somehow).

Instead, let's just call umount() and ignore EINVAL, which results
in the same behavior, but much better performance.

This also introduces a slight change: in case target does not exist,
the appropriate error (ENOENT) is returned -- document that.

2. As Unmount() is always used with MNT_DETACH flag, let's drop the
flags argument. This way, the only reason of EINVAL returned from
umount(2) can only be "target is not mounted".

3. While at it, remove the 'containerdmount' alias from the package.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-04-30 12:54:10 -07:00
Michael Crosby
4219f7ba3a
Merge pull request #2307 from avagin/tty
Allow to checkpoint and restore a container with console
2018-04-30 10:41:40 -04:00
Andrei Vagin
29c76b13d6 travis: update criu to 3.7
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-04-28 01:37:30 +03:00
Andrei Vagin
566389ade4 test: Check C/R for containers with TTYs
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-04-28 01:06:42 +03:00
Andrei Vagin
60daa414db Allow to checkpoint and restore a container with console
runc already supports this case, so we just need to run it with proper
options.

Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-04-28 01:06:42 +03:00
Andrei Vagin
0846d6f8e9 vendor: update go-runc
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2018-04-27 23:45:54 +03:00
Derek McGowan
cddd791c1c
Merge pull request #2315 from crosbymichael/logio
Add LogFile as a cio IO option
2018-04-27 11:05:57 -07:00
Lantao Liu
6bbbec5a8a
Merge pull request #755 from Random-Liu/always-mount-sysfs-rw
Always mount sysfs as `rw` for privileged container.
2018-04-27 11:03:19 -07:00
Lantao Liu
03bac61890
Merge pull request #756 from Random-Liu/update-cri-tools
Update cri-tools to fix `crictl logs` output.
2018-04-27 01:33:38 -07:00
Lantao Liu
2f370f6f5d Update cri-tools to fix crictl logs output.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-04-26 19:17:45 -07:00
Lantao Liu
279fa853a6 Always mount sysfs as rw.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-04-26 18:58:26 -07:00
Michael Crosby
1c263a7d5e Add LogFile as a cio IO option
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-04-26 17:04:01 -04:00
Stephen Day
c73794f8dc
Merge pull request #2314 from ehazlett/runc-shim-debug
Enable runc debug in shim
2018-04-26 12:09:16 -07:00
Evan Hazlett
530849fed4 enable runc debug in shim
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2018-04-26 11:11:46 -04:00
Michael Crosby
a70e26c64f
Merge pull request #2310 from ehazlett/directio-with-terminal
Add NewDirectIOWithTerminal
2018-04-25 17:01:35 -04:00
Evan Hazlett
6b4355d242 add NewDirectIOWithTerminal; add test for pty
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2018-04-25 16:17:10 -04:00
Derek McGowan
1a5e0df98f
Merge pull request #2305 from kolyshkin/context
Switch from x/net/context -> context
2018-04-25 10:44:22 -07:00
Michael Crosby
e073a48c7b
Merge pull request #2309 from crosbymichael/events-closed
Correctly handle reading from events channel
2018-04-25 13:42:14 -04:00
Michael Crosby
090687916d Correctly handle reading from events channel
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2018-04-25 11:21:22 -04:00
Lantao Liu
8fec0469d9
Merge pull request #751 from Random-Liu/fix-official-release
Fix tarball ownership and containerd binary path for containerd.
2018-04-24 16:04:03 -07:00
Kir Kolyshkin
bbe14f0a2e Switch from x/net/context to context
Since Go 1.7, context is a standard package, superceding the
"x/net/context". Since Go 1.9, the latter only provides a few type
aliases from the former. Therefore, it makes sense to switch to the
standard package.

This commit was generated by the following script (with a couple of
minor fixups to remove extra changes done by goimports):

	#!/bin/bash

	if [ $# -ge 1 ]; then
		FILES=$*
	else
		FILES=$(git ls-files \*.go | grep -vF ".pb.go" | grep -v
	^vendor/)
	fi

	for f in $FILES; do
		printf .
		sed -i -e 's|"golang.org/x/net/context"$|"context"|' $f
		goimports -w $f
		awk '	/^$/ {e=1; next;}
			/[[:space:]]"context"$/ {e=0;}
			{if (e) {print ""; e=0}; print;}' < $f > $f.new && \
				mv $f.new $f
		goimports -w $f
	done
	echo

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-04-24 14:33:34 -07:00
Kir Kolyshkin
9d0d4b806c context pkg: untangle
Since Go 1.7, "context" is a standard package, superceding the
"x/net/context". Since Go 1.9, the latter only provides type aliases
from the former. Therefore, it makes sense to switch to the standard
package, and the change is not disruptive in any sense.

This commit deals with a few cases where both packages happened to be
imported by the same source file. A choice between "context" and
"gocontext" was made for each file in order to minimize the patch.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-04-24 14:33:34 -07:00
Kir Kolyshkin
f337075620 Bump golang.org/x/net
This version includes "x/net/context" which is fully compatible with
the standard Go "context" package, so the two can be mixed together.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-04-24 14:33:20 -07:00
Lantao Liu
e0d7078251 Fix tarball ownership and containerd binary path for containerd.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-04-24 13:05:31 -07:00
Lantao Liu
825563b20c
Merge pull request #750 from Random-Liu/download-from-official-release
Download containerd binaries from official release.
2018-04-24 11:31:54 -07:00
Lantao Liu
e22ebf420f Down containerd binaries from official release.
Signed-off-by: Lantao Liu <lantaol@google.com>
2018-04-24 01:23:44 -07:00
Derek McGowan
209a7fc3e4
Merge pull request #2302 from dmcgowan/prepare-1.1
Prepare 1.1.0 release
2018-04-23 20:20:58 -07:00
Derek McGowan
1155371c7a
Prepare 1.1.0 release
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-04-23 18:29:33 -07:00