Commit graph

34839 commits

Author SHA1 Message Date
Stephen J Day
fd0e24b718
daemon/stats: more resilient cpu sampling
To avoid noise in sampling CPU usage metrics, we now sample the system
usage closer to the actual response from the underlying runtime. Because
the response from the runtime may be delayed, this makes the sampling
more resilient in loaded conditions. In addition to this, we also
replace the tick with a sleep to avoid situations where ticks can backup
under loaded conditions.

The trade off here is slightly more load reading the system CPU usage
for each container. There may be an optimization required for large
amounts of containers but the cost is on the order of 15 ms per 1000
containers. If this becomes a problem, we can time slot the sampling,
but the complexity may not be worth it unless we can test further.

Unfortunately, there aren't really any good tests for this condition.
Triggering this behavior is highly system dependent. As a matter of
course, we should qualify the fix with the users that are affected.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2018-03-07 13:20:21 -08:00
Tõnis Tiigi
bc7424b443
Merge pull request #36307 from kolyshkin/dm-misc
devmapper cleanup improvements
2018-03-07 12:57:21 -08:00
John Stephens
8cf8fe9cf8
Merge pull request #36451 from Microsoft/jjh/ubr
Windows: Report Version and UBR
2018-03-07 06:27:01 -08:00
Yong Tang
f3a3778808
Merge pull request #36502 from thaJeztah/remove-duplicate-test
Remove duplicate TestServiceUpdatePort
2018-03-06 15:18:30 -08:00
Kir Kolyshkin
a00310b54c pkg/mount: use sort.Slice
Sorting by mount point length can be implemented in a more
straightforward fashion since Go 1.8 introduced sort.Slice()
with an ability to provide a less() function in place.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-03-06 12:46:58 -08:00
Kir Kolyshkin
4aae77602a pkg/mount unit tests: skip some test under non-root
This makes `go test .` to pass if run as non-root user, skipping
those tests that require superuser privileges (for `mount`).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-03-06 12:37:27 -08:00
Yong Tang
4db41f1a69
Merge pull request #36494 from stevvooe/remove-unnecessary-types-file
daemon/stats: remove obnoxious types file
2018-03-06 11:52:56 -08:00
Derek McGowan
0aebcbc32d
Remove metadata store interface
Layer metadata storage has not been implemented outside of the layer
store and will be deprecated by containerd metadata storage. To prepare
for this and freeze the current metadata storage, remove the exported
interface and make it internal to the layer store.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-03-06 10:42:00 -08:00
Sebastiaan van Stijn
36e1646e4f
Remove duplicate TestServiceUpdatePort
The TestAPIServiceUpdatePort test performs exactly
the same steps.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-03-06 16:17:13 +01:00
Sebastiaan van Stijn
f0694e968f
Merge pull request #36417 from NobodyOnSE/patch-2
Whitelist statx syscall
2018-03-06 14:33:56 +01:00
Sebastiaan van Stijn
0b0af855ae
Merge pull request #36316 from selansen/36247
Fix to address regression caused by PR 30897
2018-03-06 13:40:29 +01:00
Sebastiaan van Stijn
390b74cb63
Merge pull request #36493 from cpuguy83/add_plugin_timeout_test
Adds a unit test for plugin request timeout
2018-03-06 12:45:17 +01:00
NobodyOnSE
b2a907c8ca Whitelist statx syscall for libseccomp-2.3.3 onward
Older seccomp versions will ignore this.

Signed-off-by: NobodyOnSE <ich@sektor.selfip.com>
2018-03-06 08:42:12 +01:00
Vincent Demeester
2f7a76a6a0
Merge pull request #36444 from yongtang/02142018-events-tests
Migrate events tests to api tests
2018-03-06 08:36:30 +01:00
Yong Tang
e02fa4a679
Merge pull request #36490 from yongtang/03052018-expected-actual
Address `expected` vs `actual` in integration tests
2018-03-05 19:40:53 -08:00
Brian Goff
a6b1d2ea29
Merge pull request #36437 from kolyshkin/dm-unused
devmapper.Mounted: remove
2018-03-05 18:14:36 -08:00
Yong Tang
da559d01d1
Merge pull request #36474 from yongtang/03022018-rm-test
Migrate docker rm tests to api tests
2018-03-05 17:15:26 -08:00
selansen
7cf8b20762 Fix to address regression caused by PR 30897
With the inclusion of PR 30897, creating service for host network
    fails in 18.02. Modified IsPreDefinedNetwork check and return
    NetworkNameError instead of errdefs.Forbidden to address this issue

Signed-off-by: selansen <elango.siva@docker.com>
2018-03-05 19:10:39 -05:00
Stephen J Day
244e59e94f
daemon/stats: remove obnoxious types file
While a `types.go` file is handly when there are a lot of record types,
it is completely obnoxious when used for concrete, utility types with a
struct, new function and method set in the same file. This change
removes the `types.go` file in favor of the simpler approach.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2018-03-05 15:59:04 -08:00
John Stephens
3e1505e3e6
Merge pull request #36327 from Microsoft/jjh/block-pulling-uplevel
Windows: Block pulling uplevel images
2018-03-05 15:12:52 -08:00
Sebastiaan van Stijn
d48392a35b
Fix definition of ErrSystem type
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-03-05 23:42:23 +01:00
Sebastiaan van Stijn
59854e407d
Change return for errdefs.getImplementer()
The types defined in the errdefs package do not
satisfy the `error` interface, because they do not
implement `Error()`.

Instead of returning the matched interface, return
the original error.

When matching _multiple_ interfaces/types, Golang doesn't complain:

    func getImplementer(err error) error {
        switch e := err.(type) {
        case
            ErrNotFound,
            ErrInvalidParameter:
            return e
        default:
            return err
        }
    }

But matching a single interface/type:

    func getImplementer(err error) error {
        switch e := err.(type) {
        case
            ErrNotFound:
            return e
        default:
            return err
        }
    }

Produces an error:

    cannot use e (type ErrNotFound) as type error in return argument: ErrNotFound does not implement error (missing Error method)

Return the original `err` instead of the matched interface/type instead.

Also added some additional tests

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-03-05 23:41:58 +01:00
Yong Tang
8a854e933b Address expected vs actual in integration tests
This fix addresses `expected` vs `actual` in integration tests
so that they match `assert.Equal(t, expected, actual)`

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-03-05 20:39:42 +00:00
Brian Goff
7ca971fb49 Adds a unit test for plugin request timeout
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2018-03-05 15:38:56 -05:00
Yong Tang
ed58ba99fb Migrate docker rm tests to api tests
This fix migrates docker rm test in integration-cli
to api tests.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-03-05 20:35:14 +00:00
Yong Tang
4b2fb7e394
Merge pull request #36468 from vdemeester/e2e-container-run
Fixes some integration/container tests to run on remote daemon
2018-03-05 12:23:24 -08:00
Kir Kolyshkin
f1a4592297 devmapper.shutdown: optimize
Move the "unmount and deactivate" code into a separate method, and
optimize it a bit:

1. Do not use filepath.Walk() as there's no requirement to recursively
   go into every directory under home/mnt; a 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
   excessive and useless.

2. Do not use GetMounts() and check if a directory is mounted; just
   unmount it and ignore "not mounted" error. Note the same error
   is returned in case of wrong flags set, but as flags are hardcoded
   we can safely ignore such case.

While at it, promote "can't unmount" log level from debug to warning.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-03-05 10:08:56 -08:00
Kir Kolyshkin
9d00aedebc devmapper cleanup: improve error msg
1. Make sure it's clear the error is from unmount.

2. Simplify the code a bit to make it more readable.

[v2: use errors.Wrap]
[v3: use errors.Wrapf]
[v4: lowercase the error message]

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-03-05 10:08:56 -08:00
Akihiro Suda
8830ef804f
Merge pull request #36407 from agawish/36395-mount-print
36395 mount print
2018-03-06 02:31:21 +09:00
Vincent Demeester
3af9b1d395
Merge pull request #36471 from yongtang/03022018-improvement
Improvement in integration tests
2018-03-05 17:54:09 +01:00
John Howard
6de9f90417 Windows: Report Version and UBR
Signed-off-by: John Howard <jhoward@microsoft.com>
2018-03-05 08:20:45 -08:00
Yong Tang
3a749157d2 Migrate events tests to api tests
This fix migrates events tests in integration-cli to api tests.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-03-05 16:13:48 +00:00
Vincent Demeester
18dd1d9aba
Fixes some integration/container test to run on remote daemon
```
docker build -f Dockerfile.e2e -t moby-e2e .
docker run -v /var/run/docker.sock:/var/run/docker.sock \
           -e TEST_INTEGRATION_DIR=/tests/integration/container \
           -e DOCKER_API_VERSION=1.36 moby-e2e
```

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2018-03-05 14:24:01 +01:00
Vincent Demeester
61cb026e7e
Merge pull request #36449 from thaJeztah/bump-runc-1.0-rc5
Bump Runc to 1.0.0-rc5
2018-03-05 11:44:21 +01:00
Sebastiaan van Stijn
e3814ece21
Merge pull request #36476 from yongtang/03022018-kill_test
Remove unnecessary container.WithName in kill test
2018-03-05 11:42:30 +01:00
Yong Tang
954e55b374
Merge pull request #36475 from IRCody/logdriver-errors
daemon/logger/ring.go: log error not instance
2018-03-03 15:51:35 -08:00
Cody Roseborough
a1956b5623 daemon/logger/ring.go: log error not instance
Log the error returned from logdriver.Log() instead of the logdriver
itself.

Signed-off-by: Cody Roseborough <crrosebo@amazon.com>
2018-03-03 16:29:57 +00:00
Sebastiaan van Stijn
6fe8384939
Merge pull request #36438 from kolyshkin/dm-rm
devmapper/Remove(): use Rmdir, ignore errors
2018-03-03 15:10:08 +01:00
Akihiro Suda
e734e8f515
Merge pull request #36459 from yongtang/02282018-export-test
Migrate export tests to api tests
2018-03-03 12:29:53 +09:00
Kir Kolyshkin
732dd9b848 devmapper/Remove(): use Rmdir, ignore errors
1. Replace EnsureRemoveAll() with Rmdir(), as here we are removing
   the container's mount point, which is already properly unmounted
   and is therefore an empty directory.

2. Ignore the Rmdir() error (but log it unless it's ENOENT). This
   is a mount point, currently unmounted (i.e. an empty directory),
   and an older kernel can return EBUSY if e.g. the mount was
   leaked to other mount namespaces.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-03-02 18:10:57 -08:00
Yong Tang
1778719d6a Remove unnecessary container.WithName in kill test
This fix removes several unnecessary `container.WithName`
usage in docker kill integration test.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-03-03 01:06:49 +00:00
Yong Tang
6ab465804b Improvement in integration tests
This fix adds several improvement:
1. No need for explicit ContainerRemove as it has been handled in setupTest()
2. Added `container.WithImage` helper function and used it in commit tests.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-03-02 19:03:59 +00:00
Sebastiaan van Stijn
8f3308ae10
Fix AppArmor not being applied to Exec processes
Exec processes do not automatically inherit AppArmor
profiles from the container.

This patch sets the AppArmor profile for the exec
process.

Before this change:

    apparmor_parser -q -r <<EOF
    #include <tunables/global>
    profile deny-write flags=(attach_disconnected) {
      #include <abstractions/base>
      file,
      network,
      deny /tmp/** w,
      capability,
    }
    EOF

    docker run -dit --security-opt "apparmor=deny-write" --name aa busybox

    docker exec aa sh -c 'mkdir /tmp/test'
    (no error)

With this change applied:

    docker exec aa sh -c 'mkdir /tmp/test'
    mkdir: can't create directory '/tmp/test': Permission denied

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-03-02 14:05:36 +01:00
Vincent Demeester
135f815fb4
Merge pull request #36460 from yongtang/03012018-import
Add missing canonical import comment to files in integration tests
2018-03-02 09:37:58 +01:00
Yong Tang
4e702cf70d Migrate export tests to api tests
This fix migrates export tests in integration-cli to api tests.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-03-02 00:44:03 +00:00
Yong Tang
9045406144 Add missing canonical import comment to files in integration tests
The  canonical import comment was added some time ago, though several
newly added files do not have the comment. This fix adds the missing
canonical import comment to files in integration tests

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2018-03-01 22:51:11 +00:00
Sebastiaan van Stijn
7459e4cd4f
Merge pull request #36455 from thaJeztah/flip-asserts
Fix "expected" and "actual" being reversed
2018-03-01 21:31:46 +01:00
Yong Tang
9276750543
Merge pull request #36445 from yongtang/02282018-secret-inspect
Remove docker_cli_secret_inspect_test.go
2018-03-01 09:40:45 -08:00
Vincent Demeester
fa018b433a
Merge pull request #36450 from yongtang/02282018-enhancement
Enhancement of replacing ContainerCreate with helper funcs in tests
2018-03-01 16:47:49 +01:00
Sebastiaan van Stijn
a2517cbf62
Fix "expected" and "actual" being reversed
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2018-03-01 14:16:19 +01:00