Commit graph

36032 commits

Author SHA1 Message Date
Andrew Hsu
5749d5ae79
Merge pull request #202 from thaJeztah/18.09_backport_update_docker_py
[18.09 backport] Update docker-py to 3.7.0
2019-06-18 09:46:14 -07:00
Andrew Hsu
bb54c5bf2a
Merge pull request #230 from thaJeztah/18.09_backport_windows_tag
[18.09 backport] Consider WINDOWS_BASE_IMAGE_TAG override when setting Windows base image for tests
2019-06-18 09:44:44 -07:00
Andrew Hsu
41fbd15273
Merge pull request #236 from thaJeztah/18.09_backport_thanks_brian_now_im_hungry
[18.09 backport] Fix error handling for bind mount spec parser.
2019-06-18 09:43:19 -07:00
Andrew Hsu
3bacaaded9
Merge pull request #194 from thaJeztah/18.09_backport_bump_containerd_v1.2.6
[18.09 backport] Bump containerd v1.2.6, runc v1.0.0-rc8
2019-06-18 09:41:42 -07:00
Andrew Hsu
605119d7b0
Merge pull request #205 from thaJeztah/18.09_backport_remove_stale_lb_ep
[18.09 backport] Remove a network during task SHUTDOWN instead of REMOVE
2019-06-18 09:25:24 -07:00
Sebastiaan van Stijn
b92e9e9da9
Update docker-py to 3.7.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit c0c05affc7)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-18 13:42:20 +01:00
Arko Dasgupta
75887d37e1
Network not deleted after stack is removed
Make sure adapter.removeNetworks executes during task Remove
adapter.removeNetworks was being skipped for cases when
isUnknownContainer(err) was true after adapter.remove was executed

This fix eliminates the nil return case forcing the function
to continue executing unless there is a true error

Fixes https://github.com/moby/moby/issues/39225

Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
(cherry picked from commit 70fa7b6a3f)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-18 13:34:02 +01:00
Arko Dasgupta
280b8dff7d
Remove a network during task SHUTDOWN instead of REMOVE to
make sure the LB sandbox is removed when a service is updated
with a --network-rm option

Signed-off-by: Arko Dasgupta <arko.dasgupta@docker.com>
(cherry picked from commit 680d0ba4ab)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-18 13:33:58 +01:00
Yong Tang
c087f681d4
Move serviceRunningTasksCount to integration/internal/swarm
This fix moves multiple places of serviceRunningTasksCount
to one location in integration/internal/swarm, so that
code duplication could be removed.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
(cherry picked from commit e485a60e2b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-18 13:33:14 +01:00
Olli Janatuinen
ccc1abea09
integration: Corrected service update tests logic
Tests which will re-deploy containers uses function serviceIsUpdated() to
make sure that service update really reached state UpdateStateCompleted.

Tests which will not re-deploy container uses function
serviceSpecIsUpdated to make sure that service version is increased.

Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
(cherry picked from commit b868ada474)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-18 13:33:06 +01:00
Sebastiaan van Stijn
2ae0365c99
integration: wait for service update to be completed
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 8edcd4c3cd)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-18 13:33:02 +01:00
Arash Deshmeh
4fe4e89172
migrated service integration tests from integration-cli/docker_cli_service_update_test.go to integration/service
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit be151a73f0)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-18 13:32:59 +01:00
Andrew Hsu
ce2e2b672a
Merge pull request #257 from thaJeztah/18.09_backport_increase_swarmkit_grpc
[18.09 backport] Increase max recv gRPC message size for nodes and secrets
2019-06-17 12:31:27 -07:00
Andrew Hsu
423f39ab05
Merge pull request #244 from thaJeztah/18.09_backport_fix_copying
[18.09 backport] image: do actual RootFS.DiffIDs copying in Clone()
2019-06-17 12:30:32 -07:00
Andrew Hsu
51ebfcbe42
Merge pull request #218 from thaJeztah/18.09_backport_EDGE374_TestDaemonNoSpaceLeftOnDeviceError
[18.09 backport] explicitly set filesystem type for mount to avoid 'invalid argument' error on arm
2019-06-17 12:28:35 -07:00
Andrew Hsu
b236a1e78d
Merge pull request #223 from thaJeztah/18.09_backport_devno
[18.09 backport] bugfix: fetch the right device number which great than 255
2019-06-17 12:27:17 -07:00
Andrew Hsu
49a4899c79
Merge pull request #276 from thaJeztah/18.09_backport_enable_new_integration_tests_for_win
[18.09 backport] Enable integrations API tests for Windows CI
2019-06-17 12:26:34 -07:00
Andrew Hsu
556456701d
Merge pull request #242 from thaJeztah/18.09_swagger_fixes
[18.09 backport] Swagger fixes
2019-06-17 12:24:38 -07:00
Andrew Hsu
ab9db72ae8
Merge pull request #263 from thaJeztah/18.09_backport_39290alternate
[18.09 backport] Windows: Don't attempt detach VHD for R/O layers
2019-06-17 12:23:41 -07:00
Andrew Hsu
d86fe18fc2
Merge pull request #250 from thaJeztah/18.09_backport_fix_fix_win_tmp
[18.09 backport] Windows CI - Corrected LOCALAPPDATA location
2019-06-17 12:23:09 -07:00
Andrew Hsu
87c3750877
Merge pull request #237 from thaJeztah/18.09_backport_remove_TestSearchCmdOptions
[18.09 backport] Remove TestSearchCmdOptions test
2019-06-17 12:16:19 -07:00
Andrew Hsu
08f6e9c14f
Merge pull request #246 from thaJeztah/18.09_backport_log-daemon-exit-before-tests-finish
[18.09 backport] Ensure all integration daemon logging happens before test exit
2019-06-17 12:15:43 -07:00
Andrew Hsu
6799eea8c8
Merge pull request #269 from thaJeztah/18.09_backport_test_fixes
[18.09 backport] Harden TestPsListContainersFilterExited
2019-06-17 12:15:02 -07:00
Andrew Hsu
6809464a63
Merge pull request #233 from thaJeztah/18.09_backport_update_seccomp_test_for_aarch64
[18.09 backport] Update TestRunWithDaemonDefaultSeccompProfile for ARM64
2019-06-17 12:13:46 -07:00
Andrew Hsu
f07e469327
Merge pull request #245 from thaJeztah/18.09_backport_allow_version_overwrite
[18.09 backport] Add ability to override the version in make.ps1
2019-06-17 12:11:50 -07:00
Andrew Hsu
8ec9dcfad7
Merge pull request #243 from thaJeztah/18.09_skip_test_info_warnings
[18.09 backport] Skip TestInfoAPIWarnings on remote daemons
2019-06-17 12:11:14 -07:00
Andrew Hsu
95d8b395a9
Merge pull request #262 from kolyshkin/18.09-backport-aufs-lock
[18.09 backport ENGCORE-830] aufs optimizations #39107
2019-06-17 11:57:12 -07:00
Andrew Hsu
6b1354c52b
Merge pull request #248 from thaJeztah/18.09_backport_aufs_fixes
[18.09 backport ENGCORE-830] layer store optimizations
2019-06-17 11:56:50 -07:00
Sebastiaan van Stijn
1a1bf23d17
bump runc binary v1.0.0-rc8
full diff: 029124da7a...425e105d5a

- opencontainers/runc#2043 Vendor in latest selinux code for keycreate errors

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 4bc310c11b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-14 13:42:53 +02:00
Jintao Zhang
ce875b746b
Update runc 029124da7af7360afa781a0234d1b083550f797c
Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
(cherry picked from commit d43a41d7af)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-14 13:42:46 +02:00
Jintao Zhang
6ae2ec3fbe
Update containerd v1.2.6
Signed-off-by: Jintao Zhang <zhangjintao9020@gmail.com>
(cherry picked from commit 8092cfb6e7)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-14 13:42:42 +02:00
Olli Janatuinen
69503ef832
Enable integrations API tests for Windows CI
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
(cherry picked from commit 2f22247cad)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-12 10:15:29 +02:00
zhangyue
705cc95eb1
fix: fix lack of copyUIDGID in swagger.yaml
Signed-off-by: Zhang Yue <zy675793960@yeah.net>
Signed-off-by: zhangyue <zy675793960@yeah.net>
(cherry picked from commit a4f828cb89)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-07 14:38:39 +02:00
Dominic Tubach
c3bf976a20
API: Set format of body parameter in operation PutContainerArchive to "binary"
Signed-off-by: Dominic Tubach <dominic.tubach@to.com>
(cherry picked from commit fa6f63e79b)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-07 14:38:27 +02:00
Adam Dobrawy
2d1aa033a3
Update docs to remove restriction of tty resize
Signed-off-by: Adam Dobrawy <naczelnik@jawnosc.tk>
(cherry picked from commit 4898f493d8)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-07 14:38:21 +02:00
Dominic Tubach
3ee1e060fc
API: Move "x-nullable: true" from type PortBinding to type PortMap
Currently the API spec would allow `"443/tcp": [null]`, but what should
be allowed is `"443/tcp": null`
Signed-off-by: Dominic Tubach <dominic.tubach@to.com>
(cherry picked from commit 32b5d296ea)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-07 14:38:18 +02:00
Dominic Tubach
d359834555
API: Change type of RemotrAddrs to array of strings in operation SwarmJoin
Signed-off-by: Dominic Tubach <dominic.tubach@to.com>
(cherry picked from commit d5f6bdb027)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-07 14:38:16 +02:00
Sebastiaan van Stijn
0559980415
Harden TestPsListContainersFilterExited
This test runs on a daemon also used by other tests
so make sure we don't get failures if another test
doesn't cleanup or is running in parallel.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 915acffdb4)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-07 14:32:51 +02:00
Kir Kolyshkin
c303e63ca6 aufs: retry auplink flush
Running a bundled aufs benchmark sometimes results in this warning:

> WARN[0001] Couldn't run auplink before unmount /tmp/aufs-tests/aufs/mnt/XXXXX  error="exit status 22" storage-driver=aufs

If we take a look at what aulink utility produces on stderr, we'll see:

> auplink:proc_mnt.c:96: /tmp/aufs-tests/aufs/mnt/XXXXX: Invalid argument

and auplink exits with exit code of 22 (EINVAL).

Looking into auplink source code, what happens is it tries to find a
record in /proc/self/mounts corresponding to the mount point (by using
setmntent()/getmntent_r() glibc functions), and it fails.

Some manual testing, as well as runtime testing with lots of printf
added on mount/unmount, as well as calls to check the superblock fs
magic on mount point (as in graphdriver.Mounted(graphdriver.FsMagicAufs, target)
confirmed that this record is in fact there, but sometimes auplink
can't find it. I was also able to reproduce the same error (inability
to find a mount in /proc/self/mounts that should definitely be there)
using a small C program, mocking what `auplink` does:

```c
 #include <stdio.h>
 #include <err.h>
 #include <mntent.h>
 #include <string.h>
 #include <stdlib.h>

int main(int argc, char **argv)
{
	FILE *fp;
	struct mntent m, *p;
	char a[4096];
	char buf[4096 + 1024];
	int found =0, lines = 0;

	if (argc != 2) {
		fprintf(stderr, "Usage: %s <mountpoint>\n", argv[0]);
		exit(1);
	}

	fp = setmntent("/proc/self/mounts", "r");
	if (!fp) {
		err(1, "setmntent");
	}
	setvbuf(fp, a, _IOLBF, sizeof(a));
	while ((p = getmntent_r(fp, &m, buf, sizeof(buf)))) {
		lines++;
		if (!strcmp(p->mnt_dir, argv[1])) {
			found++;
		}
	}
	printf("found %d entries for %s (%d lines seen)\n", found, argv[1], lines);
	return !found;
}
```

I have also wrote a few other C proggies -- one that reads
/proc/self/mounts directly, one that reads /proc/self/mountinfo instead.
They are also prone to the same occasional error.

It is not perfectly clear why this happens, but so far my best theory
is when a lot of mounts/unmounts happen in parallel with reading
contents of /proc/self/mounts, sometimes the kernel fails to provide
continuity (i.e. it skips some part of file or mixes it up in some
other way). In other words, this is a kernel bug (which is probably
hard to fix unless some other interface to get a mount entry is added).

Now, there is no real fix, and a workaround I was able to come up
with is to retry when we got EINVAL. It usually works on the second
attempt, although I've once seen it took two attempts to go through.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit ae431b10a9)
2019-06-05 11:51:00 -07:00
Kir Kolyshkin
b85d4a4f09 aufs.Cleanup: optimize
Do not use filepath.Walk() as there's no requirement to recursively
go into every directory under mnt -- a (non-recursive) list of
directories in mnt is sufficient.

With filepath.Walk(), in case some container will fail to unmount,
it'll go through the whole container filesystem which is both
excessive and useless.

This is similar to commit f1a4592297 ("devmapper.shutdown:
optimize")

While at it, raise the priority of "unmount error" message from debug
to a warning. Note we don't have to explicitly add `m` as unmount error (from
pkg/mount) will have it.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 8fda12c607)
2019-06-05 11:51:00 -07:00
Kir Kolyshkin
7548852173 aufs: optimize lots of layers case
In case there are a big number of layers, so that mount data won't fit
into a single memory page (4096 bytes on most platforms, which is good
enough for about 40 layers, depending on how long graphdriver root path
is), we supply additional layers with O_REMOUNT, as described in aufs
documentation.

Problem is, the current implementation does that one layer at a time
(i.e. there is one mount syscall per each additional layer).

Optimize the code to supply as many layers as we can fit in one page
(basically reusing the same code as for the original mount).

Note, per aufs docs, "[a]t remount-time, the options are interpreted
in the given order, e.g. left to right" so we should be good.

Tested on an image with ~100 layers.

Before (35 syscalls):
> [pid 22756] 1556919088.686955 mount("none", "/mnt/volume_sfo2_09/docker-aufs/aufs/mnt/a86f8c9dd0ec2486293119c20b0ec026e19bbc4d51332c554f7cf05d777c9866", "aufs", 0, "br:/mnt/volume_sfo2_09/docker-au"...) = 0 <0.000504>
> [pid 22756] 1556919088.687643 mount("none", "/mnt/volume_sfo2_09/docker-aufs/aufs/mnt/a86f8c9dd0ec2486293119c20b0ec026e19bbc4d51332c554f7cf05d777c9866", 0xc000c451b0, MS_REMOUNT, "append:/mnt/volume_sfo2_09/docke"...) = 0 <0.000105>
> [pid 22756] 1556919088.687851 mount("none", "/mnt/volume_sfo2_09/docker-aufs/aufs/mnt/a86f8c9dd0ec2486293119c20b0ec026e19bbc4d51332c554f7cf05d777c9866", 0xc000c451ba, MS_REMOUNT, "append:/mnt/volume_sfo2_09/docke"...) = 0 <0.000098>
> ..... (~30 lines skipped for clarity)
> [pid 22756] 1556919088.696182 mount("none", "/mnt/volume_sfo2_09/docker-aufs/aufs/mnt/a86f8c9dd0ec2486293119c20b0ec026e19bbc4d51332c554f7cf05d777c9866", 0xc000c45310, MS_REMOUNT, "append:/mnt/volume_sfo2_09/docke"...) = 0 <0.000266>

After (2 syscalls):
> [pid 24352] 1556919361.799889 mount("none", "/mnt/volume_sfo2_09/docker-aufs/aufs/mnt/8e7ba189e347a834e99eea4ed568f95b86cec809c227516afdc7c70286ff9a20", "aufs", 0, "br:/mnt/volume_sfo2_09/docker-au"...) = 0 <0.001717>
> [pid 24352] 1556919361.801761 mount("none", "/mnt/volume_sfo2_09/docker-aufs/aufs/mnt/8e7ba189e347a834e99eea4ed568f95b86cec809c227516afdc7c70286ff9a20", 0xc000dbecb0, MS_REMOUNT, "append:/mnt/volume_sfo2_09/docke"...) = 0 <0.001358>

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit d58c434bff)
2019-06-05 11:51:00 -07:00
Kir Kolyshkin
bb4b9fe29e aufs: add lock around mount
Apparently there is some kind of race in aufs kernel module code,
which leads to the errors like:

[98221.158606] aufs au_xino_create2:186:dockerd[25801]: aufs.xino create err -17
[98221.162128] aufs au_xino_set:1229:dockerd[25801]: I/O Error, failed creating xino(-17).
[98362.239085] aufs au_xino_create2:186:dockerd[6348]: aufs.xino create err -17
[98362.243860] aufs au_xino_set:1229:dockerd[6348]: I/O Error, failed creating xino(-17).
[98373.775380] aufs au_xino_create:767:dockerd[27435]: open /dev/shm/aufs.xino(-17)
[98389.015640] aufs au_xino_create2:186:dockerd[26753]: aufs.xino create err -17
[98389.018776] aufs au_xino_set:1229:dockerd[26753]: I/O Error, failed creating xino(-17).
[98424.117584] aufs au_xino_create:767:dockerd[27105]: open /dev/shm/aufs.xino(-17)

So, we have to have a lock around mount syscall.

While at it, don't call the whole Unmount() on an error path, as
it leads to bogus error from auplink flush.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 5cd62852fa)
2019-06-05 11:51:00 -07:00
Kir Kolyshkin
4ab3020e8d aufs: aufsMount: better errors for unix.Mount()
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 5873768dbe)
2019-06-05 11:51:00 -07:00
Kir Kolyshkin
5b68d00abc aufs: use mount.Unmount
1. Use mount.Unmount() which ignores EINVAL ("not mounted") error,
and provides better error diagnostics (so we don't have to explicitly
add target to error messages).

2. Since we're ignoring "not mounted" error, we can call
multiple unmounts without any locking -- but since "auplink flush"
is still involved and can produce an error in logs, let's keep
the check for fs being mounted (it's just a statfs so should be fast).

2. While at it, improve the "can't unmount" error message in Put().

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 4beee98026)
2019-06-05 11:51:00 -07:00
Kir Kolyshkin
701939112e aufs: remove extra locking
Both mount and unmount calls are already protected by fine-grained
(per id) locks in Get()/Put() introduced in commit fc1cf1911b
("Add more locking to storage drivers"), so there's no point in
having a global lock in mount/unmount.

The only place from which unmount is called without any locking
is Cleanup() -- this is to be addressed in the next patch.

This reverts commit 824c24e680.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit f93750b2c4)
2019-06-05 11:51:00 -07:00
Kir Kolyshkin
023b63a0f2 aufs: get rid of mount()
The function is not needed as it's just a shallow wrapper around
unix.Mount().

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 2f98b5f51f)
2019-06-05 11:51:00 -07:00
Kir Kolyshkin
7f1c6bf5a7 pkg/mount: wrap mount/umount errors
The errors returned from Mount and Unmount functions are raw
syscall.Errno errors (like EPERM or EINVAL), which provides
no context about what has happened and why.

Similar to os.PathError type, introduce mount.Error type
with some context. The error messages will now look like this:

> mount /tmp/mount-tests/source:/tmp/mount-tests/target, flags: 0x1001: operation not permitted

or

> mount tmpfs:/tmp/mount-test-source-516297835: operation not permitted

Before this patch, it was just

> operation not permitted

[v2: add Cause()]
[v3: rename MountError to Error, document Cause()]
[v4: fixes; audited all users]
[v5: make Error type private; changes after @cpuguy83 reviews]

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 6533136961)
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2019-06-05 11:50:50 -07:00
John Howard
91f5be57af
Windows: Don't attempt detach VHD for R/O layers
Signed-off-by: John Howard <jhoward@microsoft.com>
(cherry picked from commit 293c74ba79)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-06-05 14:45:21 +02:00
Kir Kolyshkin
47c51447e1 pkg/mount: refactor Unmount()
It has been pointed out that we're ignoring EINVAL from umount(2)
everywhere, so let's move it to a lower-level function. Also, its
implementation should be the same for any UNIX incarnation, so
let's consolidate it.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
(cherry picked from commit 90be078fe5)
2019-06-04 15:22:52 -07:00
Omri Shiv
b941f08152 fix typo
Signed-off-by: Omri Shiv <Omri.Shiv@teradata.com>
(cherry picked from commit fe1083d462)
2019-06-04 15:22:46 -07:00