Commit Graph

3145 Commits

Author SHA1 Message Date
6c9a39a756 Merge pull request #20934 from icecrime/20543_debugging
Fix race condition on daemon shutdown (#20543)
Upstream-commit: 2af84d8875045f853210dcdab2548daaad70856f
Component: engine
2016-03-04 11:08:50 -08:00
1b65b96bab Merge pull request #20834 from rhatdan/relabelvolume
Do not relabel if user did not request it for non local volumes
Upstream-commit: 8142ebb0be765e6a1ac718d292bb66f7acb145de
Component: engine
2016-03-04 13:17:54 +01:00
c66cb2a6ce Fix race in container creation
Only register a container once it's successfully started. This avoids a
race condition where the daemon is killed while in the process of
calling `libcontainer.Container.Start`, and ends up killing -1.

There is a time window where the container `initProcess` is not set, and
its PID unknown. This commit fixes the race Engine side.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: ad2fa3945997905760a4c7ef0444580ffb4b939a
Component: engine
2016-03-03 20:25:03 -08:00
9af5c681c5 Aufs: reduce redundant parsing of mountinfo
Check whether or not the file system type of a mountpoint is aufs
by calling statfs() instead of parsing mountinfo. This assumes
that aufs graph driver does not allow aufs as a backing file
system.

Signed-off-by: Tatsushi Inagaki <e29253@jp.ibm.com>
Upstream-commit: e8513675a20e2756e6c2915604605236d1a94d65
Component: engine
2016-03-04 11:39:59 +09:00
e0a2d2cb2d Merge pull request #20730 from clnperez/sysinfo-match-ip-case
Match case for IP variables in sysinfo pkg
Upstream-commit: b7bc1ce1a4be4d309395303cdc573922a48bfd72
Component: engine
2016-03-03 08:48:57 -08:00
4dd14aa176 Merge pull request #20863 from thaJeztah/add-kernel-memory-warning
Add KernelMemory to "info" and show warning
Upstream-commit: 15e68dc8eefad6b5b125209438a04d1d443e5b26
Component: engine
2016-03-03 13:14:51 +01:00
0653c63489 Merge pull request #20882 from Microsoft/jstarks/new_windows_diff_format
Write Windows layer diffs to tar in standard format
Upstream-commit: b76a55308fffe89d5b2fe5930eaa6118d1d5bd9a
Component: engine
2016-03-03 10:51:35 +01:00
209e95dee8 Write Windows layer diffs to tar in standard format
Previously, Windows layer diffs were written using a Windows-internal
format based on the BackupRead/BackupWrite Win32 APIs. This caused
problems with tar-split and tarsum and led to performance problems
in implementing methods such as DiffPath. It also was just an
unnecessary differentiation point between Windows and Linux.

With this change, Windows layer diffs look much more like their
Linux counterparts. They use AUFS-style whiteout files for files
that have been removed, and they encode all metadata directly in
the tar file.

This change only affects Windows post-TP4, since changes to the Windows
container storage APIs were necessary to make this possible.

Signed-off-by: John Starks <jostarks@microsoft.com>
Upstream-commit: 5649030e25bd87b4b0bbd200515b8c7317ae8ce1
Component: engine
2016-03-02 16:13:40 -08:00
7f5a363deb Add KernelMemory to "info" and show warning
This change adds "KernelMemory" to the /info endpoint and
shows a warning if KernelMemory is not supported by the kernel.

This makes it more consistent with the other memory-limit
options.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 747a486b4aac2ebbbb28bd713b9a4a929f89353b
Component: engine
2016-03-02 23:32:25 +01:00
576af48c09 Merge pull request #20388 from hqhq/hq_add_cgroup_driver_info
Add CgroupDriver to docker info
Upstream-commit: 508a17baba3c39496008fc5b5e3fe890b8a1b31b
Component: engine
2016-03-02 23:17:27 +01:00
3e986fd0f5 Merge pull request #20858 from mountkin/validate-log-opts-again
validate log-opt when creating containers AGAIN (fixing drunkard's code)
Upstream-commit: b65fd8e879545e8c9b859ea9b6b825ac50c79e46
Component: engine
2016-03-02 18:27:00 +01:00
2d730b8156 Merge pull request #20475 from Microsoft/jstarks/filegetter
graphdriver: Replace DiffPath with DiffGetter
Upstream-commit: 8f109829e294371cbae1eebfc771eda96d92187f
Component: engine
2016-03-02 08:36:36 -08:00
5c70b34f09 validate log-opt when creating containers AGAIN
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
Upstream-commit: 068085005ef378f6320fdce90a67b104399b796d
Component: engine
2016-03-02 20:30:26 +08:00
17d0f2d01e Add CgroupDriver to docker info
Fixes: #19539

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Upstream-commit: ca89c329b9f0748da74d08d02a47bc494e7965e2
Component: engine
2016-03-02 20:07:06 +08:00
79fb33ace9 Merge pull request #18766 from mikedanese/gcplogs
Add logging driver for Google Cloud Logging
Upstream-commit: 3c4d093babb6f4f4f8343f5c364c5229a9d96ba3
Component: engine
2016-03-02 02:09:44 +01:00
ddba9dffe5 Do not relabel if user did not request it for non local volumes
Signed-off-by: Dan Walsh <dwalsh@redhat.com>
Upstream-commit: 843a119d49d2b4ba0a15188843b28763b13e62c6
Component: engine
2016-03-01 17:09:42 -05:00
f87c5bb0dc Merge pull request #20825 from LK4D4/unused
Remove some unused structs and fields
Upstream-commit: 106793dcbe49aedd96d74b0c4b0e32a972032d06
Component: engine
2016-03-01 12:58:35 -08:00
307185d18b Merge pull request #20617 from nalind/journald-pkgconfig
Try to handle changing names for journal packages
Upstream-commit: 36401f20ceb8b689fb619df4f6c7219fe76b521c
Component: engine
2016-03-01 15:38:03 -05:00
395ec16335 graphdriver: Replace DiffPath with DiffGetter
This allows a graph driver to provide a custom FileGetter for tar-split
to use. Windows will use this to provide a more efficient implementation
in a follow-up change.

Signed-off-by: John Starks <jostarks@microsoft.com>
Upstream-commit: 58bec40d16265362fd4e41dbd652e6fba903794d
Component: engine
2016-03-01 10:25:33 -08:00
cf6760a787 Remove some unused structs and fields
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: 0a352e1a906fbf7592aa95d6327776236d13392a
Component: engine
2016-03-01 09:59:29 -08:00
6b9790d5b0 Merge pull request #20684 from yongtang/13840-follow-symlink
Follow symlink for --device argument.
Upstream-commit: d883002fac7778e70096584c3eed1693eb7cec17
Component: engine
2016-03-01 12:44:10 -05:00
9fe49cb009 Match case for variables in sysinfo pkg
I noticied an inconsistency when reviewing docker/pull/20692.

Changing Ip to IP and Nf to NF.

More info: The golang folks recommend that you keep the initials consistent:
https://github.com/golang/go/wiki/CodeReviewComments#initialisms.

Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com>
Upstream-commit: 5b3fc7aab25be908cab869dab5c0b2cb821d31dc
Component: engine
2016-03-01 10:37:05 -06:00
461ed7624b daemon/logger: Add logging driver for Google Cloud Logging
Signed-off-by: Mike Danese <mikedanese@google.com>
Upstream-commit: ed1b9fa07a0b34315d2fa624b978d3f8627319c2
Component: engine
2016-03-01 08:06:10 -08:00
cfff83dc7e Follow symlink for --device argument.
Fixes: #13840

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 7ed569efdc822811cdac3b398a16757a54fbe4c4
Component: engine
2016-03-01 07:16:19 +00:00
44ded729ad folders->directories
Signed-off-by: hsinko <21551195@zju.edu.cn>
Upstream-commit: 772f5495b7bb03a8fb97f9ae5fb5fa97c98a87b3
Component: engine
2016-02-29 21:32:30 -08:00
7097a625ab Merge pull request #20710 from Microsoft/sjw/tp4retry_fix
Fixing retry hack for TP4 to return errors in all failure cases.
Upstream-commit: 6a960069596a5d43a50b7675454169aad06972ca
Component: engine
2016-02-29 19:08:24 -05:00
e32705bbc7 Merge pull request #20480 from wenchma/20431-filter_since_before
Enhancement of docker ps before and since filters
Upstream-commit: 9eb4575f8cdb8f9afb0d53d6fd4a34b077cc08da
Component: engine
2016-02-29 20:57:43 +01:00
210548216a Fixing retry hack for TP4 to return errors in all failure cases.
Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
Upstream-commit: 0b82202fbbbeaad5d7ba404fb586cb4b3f37980e
Component: engine
2016-02-29 10:53:01 -08:00
6324c7793e Merge pull request #20605 from mountkin/optimize-json-log-writer
make the json log writer much faster
Upstream-commit: ba5a282a83a603c3bb61cd40642af54d2088f747
Component: engine
2016-02-29 10:47:46 -08:00
70ddfe143d Merge pull request #20749 from mountkin/validate-log-opts
validate log-opt when creating containers
Upstream-commit: 2391794d2695079f2dd19b10cd51aea6922b3ec9
Component: engine
2016-02-29 13:47:25 -05:00
66f153da0f Merge pull request #20774 from hqhq/hq_vender_engine_api
Vendor engine-api to 70d266e96080e3c3d63c55a4d8659e00ac1f7e6c
Upstream-commit: b211e57f23848bd1990db84d2ccce0ce529e735a
Component: engine
2016-02-29 18:48:55 +01:00
98394b0b6e Vendor engine-api to 70d266e96080e3c3d63c55a4d8659e00ac1f7e6c
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Upstream-commit: 53b0d62683ee798198c553353dc2106623a9259b
Component: engine
2016-02-29 19:28:37 +08:00
5f0c16d34d Merge pull request #20604 from coolljt0725/fix_reload
Fix configuration reloading
Upstream-commit: 20a038eca68e4188e1cd812293aea8cb220cf08f
Component: engine
2016-02-29 07:14:15 +01:00
c3440ba69f validate log-opt when creating containers
Signed-off-by: Shijiang Wei <mountkin@gmail.com>
Upstream-commit: 7285c9a53a6a661e7ded4637d937f9d20dcf46c0
Component: engine
2016-02-28 01:51:46 +08:00
a63e28ad6f fix double-lock
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: e386dfc33fc1fd5ed06496bd19f01a37c3c46341
Component: engine
2016-02-27 09:49:21 -05:00
f76950a71a Revert "Add finer-grained locking for aufs"
This reverts commit f31014197cbe9438cc956ed12c47093a0324c82d.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: c2f7777603039b0e9b7e8fcdf517b1486dc14781
Component: engine
2016-02-27 08:01:19 -05:00
8135f8d68c Merge pull request #20699 from calavera/remove_static_error_declarations
Remove static errors from errors package.
Upstream-commit: df2b74188ec51422e84ec1dbdc58abf08c215019
Component: engine
2016-02-26 16:30:12 -08:00
7c97092faa Merge pull request #20275 from cpuguy83/finer_graph_locks
Finer graph locks
Upstream-commit: 2f797bb1d9826f1aba242965b611b71b81fd152e
Component: engine
2016-02-26 13:33:34 -08:00
e0b6d7e1f3 Merge pull request #20729 from estesp/pipework
Add synchronization and closure to IO pipes in userns path
Upstream-commit: 51302c29edf256276ba4ba9a20076866db522f66
Component: engine
2016-02-26 13:33:02 -08:00
b2ac99b3fa Remove static errors from errors package.
Moving all strings to the errors package wasn't a good idea after all.

Our custom implementation of Go errors predates everything that's nice
and good about working with errors in Go. Take as an example what we
have to do to get an error message:

```go
func GetErrorMessage(err error) string {
	switch err.(type) {
	case errcode.Error:
		e, _ := err.(errcode.Error)
		return e.Message

	case errcode.ErrorCode:
		ec, _ := err.(errcode.ErrorCode)
		return ec.Message()

	default:
		return err.Error()
	}
}
```

This goes against every good practice for Go development. The language already provides a simple, intuitive and standard way to get error messages, that is calling the `Error()` method from an error. Reinventing the error interface is a mistake.

Our custom implementation also makes very hard to reason about errors, another nice thing about Go. I found several (>10) error declarations that we don't use anywhere. This is a clear sign about how little we know about the errors we return. I also found several error usages where the number of arguments was different than the parameters declared in the error, another clear example of how difficult is to reason about errors.

Moreover, our custom implementation didn't really make easier for people to return custom HTTP status code depending on the errors. Again, it's hard to reason about when to set custom codes and how. Take an example what we have to do to extract the message and status code from an error before returning a response from the API:

```go
	switch err.(type) {
	case errcode.ErrorCode:
		daError, _ := err.(errcode.ErrorCode)
		statusCode = daError.Descriptor().HTTPStatusCode
		errMsg = daError.Message()

	case errcode.Error:
		// For reference, if you're looking for a particular error
		// then you can do something like :
		//   import ( derr "github.com/docker/docker/errors" )
		//   if daError.ErrorCode() == derr.ErrorCodeNoSuchContainer { ... }

		daError, _ := err.(errcode.Error)
		statusCode = daError.ErrorCode().Descriptor().HTTPStatusCode
		errMsg = daError.Message

	default:
		// This part of will be removed once we've
		// converted everything over to use the errcode package

		// FIXME: this is brittle and should not be necessary.
		// If we need to differentiate between different possible error types,
		// we should create appropriate error types with clearly defined meaning
		errStr := strings.ToLower(err.Error())
		for keyword, status := range map[string]int{
			"not found":             http.StatusNotFound,
			"no such":               http.StatusNotFound,
			"bad parameter":         http.StatusBadRequest,
			"conflict":              http.StatusConflict,
			"impossible":            http.StatusNotAcceptable,
			"wrong login/password":  http.StatusUnauthorized,
			"hasn't been activated": http.StatusForbidden,
		} {
			if strings.Contains(errStr, keyword) {
				statusCode = status
				break
			}
		}
	}
```

You can notice two things in that code:

1. We have to explain how errors work, because our implementation goes against how easy to use Go errors are.
2. At no moment we arrived to remove that `switch` statement that was the original reason to use our custom implementation.

This change removes all our status errors from the errors package and puts them back in their specific contexts.
IT puts the messages back with their contexts. That way, we know right away when errors used and how to generate their messages.
It uses custom interfaces to reason about errors. Errors that need to response with a custom status code MUST implementent this simple interface:

```go
type errorWithStatus interface {
	HTTPErrorStatusCode() int
}
```

This interface is very straightforward to implement. It also preserves Go errors real behavior, getting the message is as simple as using the `Error()` method.

I included helper functions to generate errors that use custom status code in `errors/errors.go`.

By doing this, we remove the hard dependency we have eeverywhere to our custom errors package. Yes, you can use it as a helper to generate error, but it's still very easy to generate errors without it.

Please, read this fantastic blog post about errors in Go: http://dave.cheney.net/2014/12/24/inspecting-errors

Signed-off-by: David Calavera <david.calavera@gmail.com>
Upstream-commit: a793564b2591035aec5412fbcbcccf220c773a4c
Component: engine
2016-02-26 15:49:09 -05:00
5e9f05d546 Add synchronization and closure to IO pipes in userns path
The execdriver pipes setup uses OS pipes with fds so that they can be
chown'ed to the remapped root user for proper access. Recent flakiness
in certain short-lived tests (usually via the "exec" path) reveals that
the copy routines are not completing before exit/tear-down.

This fix adds synchronization and proper closure such that these
routines exit successfully.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
Upstream-commit: 995386735c2fe47ebb144f95adbc8eb1341ac48b
Component: engine
2016-02-26 13:47:34 -05:00
03ce1316a5 Merge pull request #20428 from jfrazelle/generate-conversion
generate seccomp profile convert type
Upstream-commit: c47674efda39226e7323e5668ee279927997fb4f
Component: engine
2016-02-26 10:28:23 -05:00
5bfa2d9a1f Merge pull request #20655 from hqhq/hq_fix_update_memoryswap
Fix problems when update swap memory
Upstream-commit: 6748cc10ac280950103d88a249f7d443715cf833
Component: engine
2016-02-25 22:28:53 -05:00
ac8b4b9a6a Add finer-grained locking for aufs
```
benchmark                       old ns/op       new ns/op     delta
BenchmarkConcurrentAccess-8     10269529748     26834747      -99.74%

benchmark                       old allocs     new allocs     delta
BenchmarkConcurrentAccess-8     309948         7232           -97.67%

benchmark                       old bytes     new bytes     delta
BenchmarkConcurrentAccess-8     23943576      1578441       -93.41%
```

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: f31014197cbe9438cc956ed12c47093a0324c82d
Component: engine
2016-02-25 18:06:41 -05:00
085a86e475 Fix some issues with concurrency in aufs.
Adds a benchmark to measure performance under concurrent actions.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 55c91f2ab9bcd48cfa248a4e842bb78257c14134
Component: engine
2016-02-25 14:32:13 -05:00
5f817c4ab4 Merge pull request #20685 from estesp/userns-dev-fuse-fix
Filter auto-created device list if user namespaces enabled
Upstream-commit: 13b6733ee82f1e3f8749dccf345a0874382b0d8e
Component: engine
2016-02-25 10:01:13 +01:00
a59cde77dc Enhancement of docker ps before and since filters
This enhancement is to fix the wrong list results on
`docker ps` before and since filters specifying the non-running container.

Fixes issue #20431

Signed-off-by: Wen Cheng Ma <wenchma@cn.ibm.com>
Upstream-commit: bc72883fe13b5cc39235b4996064bea7a5528ebf
Component: engine
2016-02-25 16:58:31 +08:00
3a1a7f86d5 Filter auto-created device list if user namespaces enabled
Because devices will be bind-mounted instead of using `mknod`, we need
to make sure the source exists and filter the list by only those whose
source is a valid path/current device entry.

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com> (github: estesp)
Upstream-commit: 9a554e8c37d522ed791b3bb55f9ba9f21e2ac76a
Component: engine
2016-02-25 00:11:36 -05:00
4d716f809c Merge pull request #20647 from coolljt0725/fix_20638
Fix exec start api with detach and AttachStdin at same time. fixes #2…
Upstream-commit: cee4ff1c4ac0bb47ed847f3bb725fd6233613937
Component: engine
2016-02-24 20:17:15 -08:00
ba3d7fd0c4 Fix configuration reloading
There are five options 'debug' 'labels' 'cluster-store' 'cluster-store-opts'
and 'cluster-advertise' that can be reconfigured, configure any of these
options should not affect other options which may have configured in flags.
But this is not true, for example, I start a daemon with -D to enable the
debugging, and after a while, I want reconfigure the 'label', so I add a file
'/etc/docker/daemon.json' with content '"labels":["test"]' and send SIGHUP to daemon
to reconfigure the daemon, it work, but the debugging of the daemon is also diabled.
I don't think this is a expeted behaviour.
This patch also have some minor refactor of reconfiguration of cluster-advertiser.
Enable user to reconfigure cluster-advertiser without cluster-store in config file
since cluster-store could also be already set in flag, and we only want to reconfigure
the cluster-advertiser.

Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: b9366c9609166d41e987608041b5a2079726aa5f
Component: engine
2016-02-24 21:12:14 -05:00