Commit graph

557 commits

Author SHA1 Message Date
Anusha Ragunathan
fefea805e9 Make graphdrivers work with pluginv2.
As part of making graphdrivers support pluginv2, a PluginGetter
interface was necessary for cleaner separation and avoiding import
cycles.

This commit creates a PluginGetter interface and makes pluginStore
implement it. Then the pluginStore object is created in the daemon
(rather than by the plugin manager) and passed to plugin init as
well as to the different subsystems (eg. graphdrivers, volumedrivers).
A side effect of this change was that some code was moved out of
experimental. This is good, since plugin support will be stable soon.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-09-20 08:49:48 -07:00
John Howard
f61315f0df Windows: Remove TP5 hack from graphdriver
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-09-17 16:16:50 -07:00
Brian Goff
3548356957 Merge pull request #26555 from miaoyq/refactor-aufsMount
refactor the function 'aufsMount' in 'daemon/graphdriver/aufs/aufs.go'
2016-09-17 08:04:18 -04:00
allencloud
9279a93f6d correct some nits in comments
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-09-15 12:17:58 +08:00
Yanqiang Miao
b6a268d91f refactor the function 'aufsMount' in 'daemon/graphdriver/aufs/aufs.go'
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>

update

Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2016-09-14 15:42:51 +08:00
Yanqiang Miao
664ad19486 Optimized debug print in the 'deviceset.go'
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
2016-09-12 15:34:17 +08:00
Vivek Goyal
6cc55dd65b devmapper: Fail to start container if xfs_nospace_max_retries can't be enforced
We just introduced a new tunable dm.xfs_nospace_max_retries. But this tunable
will work only on new kernels where xfs supports this feature. On older
kernels xfs does not allow tuning this behavior.

There are two issues. First one is that if xfsSetNospaceRetries() fails,
it returns error but leaves the device activated and mounted. We should
be unmounting the device and deactivate it before returning.
 
Second issue is, if docker is started on older kernel, with
dm.xfs_nospace_max_retries specified, then docker will silently ignore the
fact that /sys file to tweak this behavior is not present and will continue.
But I think it might be better to fail container creation/start if kernel
does not support this feature.

This patch fixes it. After this patch, user will get an error like following
when container is run.

# docker run -ti fedora bash
docker: Error response from daemon: devmapper: user specified daemon option dm.xfs_nospace_max_retries but it does not seem to be supported on this system :open /sys/fs/xfs/dm-5/error/metadata/ENOSPC/max_retries: no such file or directory.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2016-09-07 14:03:01 -04:00
Vivek Goyal
4f0017b9ad devmapper: Provide a knob dm.xfs_nospace_max_retries
When xfs filesystem is being used on top of thin pool, xfs can get ENOSPC
errors from thin pool when thin pool is full. As of now xfs retries the
IO and keeps on retrying and does not give up. This can result in container
application being stuck for a very long time. In fact I have seen instances
of unkillable processes. So that means once thin pool is full and process
gets stuck, container can't be stopped/killed either and only option left
seems to be power recycle of the box.

In another instance, writer did not block but failed after a while. But
when I tried to exit/stop the container, unmounting xfs hanged and only
thing I could do was power cycle the machine.

Now upstream kernel has committed patches where it allows user space to
customize user space behavior in case of errors. One of the knobs is
max_retries, which specifies how many times an IO should be retried
when ENOSPC is encountered.

This patch sets provides a tunable knob (dm.xfs_nospace_max_retries) so
that user can specify value for max_retries and tune xfs behavior. If
one sets this value to 0, xfs will not retry IO when ENOSPC error is
encountered. It will instead give up and shutdown filesystem.

This knob can be useful if one is running into unkillable
processes/containers issue on top of xfs.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2016-09-01 11:38:09 -04:00
Derek McGowan
c13a985fa1 Avoid fork on mount for overlay2 in common case
In the common case where the user is using /var/lib/docker and
an image with less than 60 layers, forking is not needed. Calculate
whether absolute paths can be used and avoid forking to mount in
those cases.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2016-08-22 11:43:10 -07:00
Brian Goff
d7753dceb8 Merge pull request #25746 from lixiaobing10051267/masterName
wrong id when testing exists in daemon aufs
2016-08-16 13:00:03 -04:00
lixiaobing10051267
cdb6c59eda wrong id when testing exists in daemon aufs
Signed-off-by: lixiaobing10051267 <li.xiaobing1@zte.com.cn>
2016-08-16 16:42:45 +08:00
Serge Hallyn
617c352e92 Don't create devices if in a user namespace
If we are running in a user namespace, don't try to mknod as
it won't be allowed.  libcontainer will bind-mount the host's
devices over files in the container anyway, so it's not needed.

The chrootarchive package does a chroot (without mounting /proc) before
its work, so we cannot check /proc/self/uid_map when we need to.  So
compute it in advance and pass it along with the tar options.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
2016-08-12 16:26:58 -04:00
Michael Crosby
34cc19f670 Merge pull request #25509 from Microsoft/jjh/23079
Windows: Block ReFS file systems
2016-08-12 09:32:22 -07:00
Sebastiaan van Stijn
04e021d751 Merge pull request #23391 from Microsoft/WindowsSandboxSize
Windows: Added support for storage-opt size
2016-08-09 15:34:39 +02:00
John Howard
1cb9e9b44e Windows: Block ReFS file systems
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-08-08 14:30:37 -07:00
Shishir Mahajan
0e633ee14a Fixes Issue # 23418: Race condition between device deferred removal and resume device.
Problem Description:

An example scenario that involves deferred removal
1. A new base image gets created (e.g. 'docker load -i'). The base device is activated and
mounted at some point in time during image creation.
2. While image creation is in progress, a privileged container is started
from another image and the host's mount name space is shared with this
container ('docker run --privileged -v /:/host').
3. Image creation completes and the base device gets unmounted. However,
as the privileged container still holds a reference on the base image
mount point, the base device cannot be removed right away. So it gets
flagged for deferred removal.
4. Next, the privileged container terminates and thus its reference to the
base image mount point gets released. The base device (which is flagged
for deferred removal) may now be cleaned up by the device-mapper. This
opens up an opportunity for a race between a 'kworker' thread (executing
the do_deferred_remove() function) and the Docker daemon (executing the
CreateSnapDevice() function).

This PR cancel the deferred removal, if the device is marked for it. And reschedule the
deferred removal later after the device is resumed successfully.

Signed-off-by: Shishir Mahajan <shishir.mahajan@redhat.com>
2016-08-02 10:33:58 -04:00
allencloud
dec4481e08 use %s instead of %q when format in graphdirver log
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-07-30 02:12:55 +08:00
Alexander Morozov
170abb5f7c Merge pull request #24745 from daehyeok/logrus
Refactoring for logrus formatting
2016-07-28 16:50:19 -07:00
Derek McGowan
5c05b8447d Update diff apply test to check sub directories
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2016-07-26 12:03:55 -07:00
Brian Goff
19ec73b8b5 Merge pull request #24997 from WeiZhang555/fix-unmeaningful-log
small nit: fix unmeaningful log
2016-07-25 10:33:57 -04:00
Zhang Wei
af8359562c small nit: fix unmeaningful log
Truncated dir name can't give any useful information, print whole dir
name will.

Bad debug log is like this:

```
DEBU[2449] aufs error unmounting /var/lib/doc: no such file or directory
```

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-07-26 07:10:28 +08:00
allencloud
4e959ef2f7 fix typos
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-07-23 11:32:23 +08:00
Damian Smyth
205bc6fc99 Create zfs directory if it doesn't exist at startup.
Signed-off-by: Damian Smyth <damian@dsau.co>
2016-07-19 10:12:22 +10:00
Daehyeok Mun
6a1183b3ae Refactoring for logrus formatting
Use module name logrus instead of log.
Use logrus.[Error|Warn|Debug|Fatal|Panic|Info]f instead of w/o f

Signed-off-by: Daehyeok Mun <daehyeok@gmail.com>
2016-07-18 12:53:34 -06:00
Derek McGowan
ff98da0607 Allow option to override kernel check in overlay2
Add option to skip kernel check for older kernels which have been patched to support multiple lower directories in overlayfs.

Fixes #24023

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2016-07-11 16:48:08 -07:00
Stefan J. Wernli
3e109f349f Removing Custom Images support
Now that Windows base images can be loaded directly into docker via "docker load" of a specialized tar file (with docker pull support on the horizon) we no longer have need of the custom images code path that loads images from a shared central location.  Removing that code and it's call points.

Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
2016-07-07 14:56:37 -07:00
Alexander Morozov
b8cef7c19c Merge pull request #24091 from AkihiroSuda/fixZFS24008
zfs: call mount.MakePrivate
2016-06-30 11:14:30 -07:00
yuzou
d4a2bcc9ac Add detail error logs when 'Unknown Device' error happens if devicemapper storage is used.
Signed-off-by: yuzou <zouyu7@huawei.com>
2016-06-30 13:06:14 +08:00
Akihiro Suda
5ec8441bb5 zfs: call mount.MakePrivate
Fix #24008

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2016-06-29 01:55:45 +00:00
Derek McGowan
ad4b3e11fe overlay2: close read end of pipe on mount exec
Use StdinPipe to ensure pipe is properly closed after startup

Fixes #23686

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2016-06-28 13:23:00 -07:00
Derek McGowan
bd13c53f8d Fix overlay2 ignoring whiteout files
Currently when overlay creates a whiteout file then the overlay2 layer is archived,
the correct tar header will be created for the whiteout file, but the tar logic will then attempt to open the file causing a failure.
When tar encounters such failures the file is skipped and excluded for the archive, causing the whiteout to be ignored.
By skipping the copy of empty files, no open attempt will be made on whiteout files.

Fixes #23863

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2016-06-23 13:34:38 -07:00
Darren Stahl
7e5ee6d176 Windows: Added support for storage-opt size
Signed-off-by: Darren Stahl <darst@microsoft.com>
2016-06-21 10:53:29 -07:00
Sebastiaan van Stijn
2d4b285a75
fix "overlay" -> "overlay2" in error message
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2016-06-16 16:42:40 -07:00
Tibor Vass
06da8ce285 Merge pull request #23515 from HackToday/fixoverlay2
Add ecryptfs check for overlay2
2016-06-16 15:12:09 -07:00
Brian Goff
6ed921dc38 Merge pull request #23446 from tiborvass/plugins-experimental
Plugins: experimental support for new plugin management
2016-06-14 20:32:14 -04:00
Tibor Vass
f37117045c plugins: experimental support for new plugin management
This patch introduces a new experimental engine-level plugin management
with a new API and command line. Plugins can be distributed via a Docker
registry, and their lifecycle is managed by the engine.
This makes plugins a first-class construct.

For more background, have a look at issue #20363.

Documentation is in a separate commit. If you want to understand how the
new plugin system works, you can start by reading the documentation.

Note: backwards compatibility with existing plugins is maintained,
albeit they won't benefit from the advantages of the new system.

Signed-off-by: Tibor Vass <tibor@docker.com>
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-06-14 14:20:27 -07:00
Derek McGowan
e6f2e7646c Remove symlinks on layer removal for overlay2
Symlinks are currently not getting cleaned up when removing layers since only the root directory is removed.
On remove, read the link file and remove the associated link from the link directory.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2016-06-14 12:40:35 -07:00
Kai Qiang Wu(Kennan)
136323b043 Add ecryptfs check for overlay2
We added docs about ecryptfs check but not in code side.
Also refactor code to make it clean.

Signed-off-by: Kai Qiang Wu(Kennan) <wkqwu@cn.ibm.com>
2016-06-14 14:25:52 +00:00
Sebastiaan van Stijn
31e48e85ef Merge pull request #23501 from dmcgowan/fix-overlay-diff-test
Remove failing overlay test
2016-06-14 10:49:42 +02:00
Vincent Demeester
c69614deae Merge pull request #23490 from shishir-a412ed/dm_options_modularized
Modularize dm.use_deferred_removal and dm.use_deferred_deletion logic.
2016-06-14 08:47:43 +02:00
Derek McGowan
0e74aabbb9 Remove failing overlay test
Diff apply is sometimes producing a different change list causing the tests to fail.
Overlay has a known issue calculating diffs of files which occur within the same second they were created.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2016-06-13 22:34:57 -07:00
Michael Crosby
8a2f9a249c Merge pull request #22126 from dmcgowan/overlay-native-diff
Overlay multiple lower directory support
2016-06-13 13:15:39 -07:00
Shishir Mahajan
cac6658da0 Modularize dm.use_deferred_removal and dm.use_deferred_deletion logic.
Signed-off-by: Shishir Mahajan <shishir.mahajan@redhat.com>
2016-06-13 12:05:46 -04:00
Yong Tang
a72b45dbec Fix logrus formatting
This fix tries to fix logrus formatting by removing `f` from
`logrus.[Error|Warn|Debug|Fatal|Panic|Info]f` when formatting string
is not present.

This fix fixes #23459.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-06-11 13:16:55 -07:00
Antonio Murdaca
44ccbb317c *: fix logrus.Warn[f]
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
2016-06-11 19:42:38 +02:00
Derek McGowan
23e5c94cfb Add separate overlay2 driver
Adds a new overlay driver which uses multiple lower directories to create the union fs.
Additionally it uses symlinks and relative mount paths to allow a depth of 128 and stay within the mount page size limit.
Diffs and done directly over a single directory allowing diffs to be done efficiently and without the need fo the naive diff driver.

Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2016-06-08 00:16:01 -07:00
Derek McGowan
246e993031 Add more overlay tests and benchmarks
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2016-06-08 00:16:01 -07:00
Derek McGowan
8b0441d42c Expand graphtest package
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
2016-06-08 00:16:01 -07:00
Brian Goff
d85491ff4b Merge pull request #21946 from chosenken/add_disk_quota_to_zfs
Add support for setting storage size on ZFS containers
2016-06-07 22:18:25 -04:00
Sven Dowideit
98c245c9e6 Merge pull request #23193 from allencloud/fix-typos
use grep to find all a/an typos
2016-06-02 18:45:08 -07:00