Граф коммитов

118 Коммитов

Автор SHA1 Сообщение Дата
Paul Morie b3e7df48df Fix typo in devmapper driver_test
Docker-DCO-1.1-Signed-off-by: Paul Morie <pmorie@gmail.com> (github: pmorie)
2014-03-07 12:20:25 -05:00
Alexander Larsson 9e28c3e3f8 aufs: Skip tests if aufs not supported
This makes it possible to pass the rest of the testsuite without aufs in the kernel.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-03-03 15:11:49 +01:00
Alexander Larsson f198ee525a Properly close archives
All archive that are created from somewhere generally have to be closed, because
at some point there is a file or a pipe or something that backs them. So, we
make archive.Archive a ReadCloser. However, code consuming archives does not
typically close them so we add an archive.ArchiveReader and use that when we're
only reading.

We then change all the Tar/Archive places to create ReadClosers, and to properly
close them everywhere.

As an added bonus we can use ReadCloserWrapper rather than EofReader in several places,
which is good as EofReader doesn't always work right. For instance, many compression
schemes like gzip knows it is EOF before having read the EOF from the stream, so the
EofCloser never sees an EOF.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-02-14 13:46:17 +01:00
Guillaume J. Charmes 9997d0c9ed Merge pull request #4062 from alexlarsson/clean-shutdown
devmapper: Fix shutdown warnings
2014-02-13 10:45:03 -08:00
unclejack 47df7a360a Merge pull request #4056 from alexlarsson/fix-devmapper-test
devicemapper: Fix tests on fedora
2014-02-13 15:06:50 +02:00
Michael Crosby a66124ec6a Merge pull request #4055 from alexlarsson/remove-devmapper-dirs
devmapper: Remove directory when removing devicemapper device
2014-02-11 17:05:56 -05:00
Alexander Larsson 6128dcea4a devmapper: Remove byHash hack
We no longer pass "pool" anywhere that uses byHash() per the last
commit, so we can now remove this hack.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-02-11 13:02:00 +01:00
Alexander Larsson eab270395e devmapper: Fix shutdown warnings
Shutdown contains debug warnings like:

[debug] deviceset.go:699 [deviceset docker-0:33-17945897] waitRemove(/dev/mapper/docker-0:33-17945897-pool)
[debug] deviceset.go:380 libdevmapper(3): libdm-common.c:552 (-1) Device /dev/mapper/docker-0:33-17945897-pool not found

This is because shutdown is using removeDeviceAndWait() to remove the pool device and the
wait part fails because the pool is gone.

We fix this by adding a pool specific removal function which avoids all the trickiness of the
normal remove.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-02-11 12:47:59 +01:00
Alexander Larsson eb4578daee devicemapper: Fix tests on fedora
If /dev/loop-control exists on the system running the test then
ioctlLoopCtlGetFree() will be called, but if not it won't.  It does
not exist in the standard docker build environment, so the tests
currently require this to not be called. This makes it instead
optional, allowing the tests to run on e.g. Fedora.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-02-11 09:42:34 +01:00
Alexander Larsson 2343fe4453 devmapper: Remove directory when removing devicemapper device
We're currently leaving around lots of empty directories in
/var/lib/docker/devicemapper/mnt/ for removed images and containers.
Fix this by removing the directory when the device is removed.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-02-11 09:40:13 +01:00
Alexander Larsson 695719b29a devmapper: Enable skip_block_zeroing
This makes the device mapper not zero out blocks allocated on the
thinp device. This is safe in our use case, as we access the device
via a filesystem that doesn't leak any uninitialized data to userspace.

This partially helps with https://github.com/dotcloud/docker/issues/3280
and should generally improve preformance on the devicemapper backend.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-02-09 07:29:28 +01:00
Alexander Larsson 693d3f8c6a devmapper: Fix MountDevice for non-existing Device
Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-02-06 23:08:17 +01:00
Alexander Larsson 304e33a2fe devmapper: Fix UnmountDevice for non-existing device
Properly error out if passed an id that doesn't exist.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-02-06 22:26:09 +01:00
Alexander Larsson 2c82fd93d8 devmapper: Handle EBUSY while removing
For some reason we seem to get transient EBUSY when removing
thinp devices, which prohibit removing containers. When
this happens we retry a few times which seems to fix the
issue for me.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-02-06 13:14:49 +01:00
Alexander Larsson 7e25cd5891 devmapper: Use removeDeviceAndWait in DeviceSet.removeDevice()
This makes sure the device is removed just like in deactivateDevice.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-02-06 13:14:49 +01:00
Alexander Larsson b95c560fdd devmapper: Move refcounting to DeviceSet
We already have some kind of refcounting in DeviceSet, this fleshes
it out to allow it to completely subsume the refcounting in
devmapper.Driver.

This allows us to drop the double refcounting, and the locking inside
devmapper.Driver. This, in particular the locking simplification will
make it easier in the future to parallelize the device mapper.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-02-06 13:14:42 +01:00
Alexander Larsson dca21dfac7 devmapper: add and use removeDeviceAndWait helper
This adds a function that calls the lowlevel removeDevice
and then waits for it to finish.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-02-05 21:27:12 +01:00
Alexander Larsson 63d4b293e7 devmapper: Rename DeviceSet.RemoveDevice to DeleteDevice
"Remove" is a bit overloaded, as it is also what deactivating a
device mapper device is called. Using "delete" is more clear here.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-02-05 21:27:12 +01:00
Michael Crosby 9431b8d503 Merge pull request #3893 from tianon/clean-up-btrfs-error-messages
Fix several btrfs driver error messages
2014-02-03 09:51:41 -08:00
Tianon Gravi f7f8e3c2b3 Fix several btrfs driver error messages
Several of the error messages were wrong, but not one of them was helpful, so this fixes them to include the important information (the actual error), and a correct description of which operation failed.

Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
2014-02-03 09:12:18 -07:00
Tianon Gravi 6922f1be08 Remove reference to <linux/btrfs.h>, and instead use <btrfs/ioctl.h> like we're supposed to (from btrfs-progs)
This fixes compilation issues when btrfs.h isn't available (because we just need the relevant structs, which for userspace programs are supposed to come from btrfs-progs instead of the kernel headers).

Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
2014-02-01 23:23:33 -07:00
Tianon Gravi 065dd231dd Update/fix build tags, Dockerfile, and release.sh for proper building and releasing of linux/386 and linux/arm cross-compiled client binaries
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
2014-01-31 03:16:42 -07:00
Guillaume J. Charmes 45dd051e8e Remove all darwin specific files and use more generic _unsupported with build tags.
Docker-DCO-1.1-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
2014-01-30 23:10:56 +00:00
Michael Crosby 637a1dcab6 Merge pull request #3718 from alexlarsson/btrfs
Add btrfs support to docker
2014-01-30 10:00:44 -08:00
Alexander Larsson a1851a6d3e btrfs: Add comment to Put()
Document why we don't need to do anything in Put().

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-01-28 09:56:51 +01:00
Peter Waller 6f3d8d3908 Fix for #3674 Can't `rm` containers when disk full
Rather than creating a new directory and moving it there before
deleting that new directory, just move the directory we intend to
delete.

In the old way, the Mkdirall could fail, which meant that you
couldn't delete containers when the disk was full.

Tested.

Docker-DCO-1.1-Signed-off-by: Peter Waller <p@pwaller.net> (github: pwaller)
2014-01-27 21:34:11 +00:00
Alexander Larsson e51af36a85 Add experimenta btrfs driver
This is an experimental btrfs driver. To use it you must have
/var/lib/docker mounted on a btrfs filesystem and explicitly
specify DOCKER_DRIVER=btrfs in the docker daemon environment.

It works by using subvolumes for the docker image/container layers.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-01-22 21:44:09 +01:00
Guillaume J. Charmes f61a91f50a Merge pull request #3073 from alexlarsson/refcount-driver-mounts
Refcount driver mounts
2014-01-22 11:42:17 -08:00
Alexander Larsson 5fe26ee426 aufs: Unmount inactive devices
This implements the new Put() operation such that
Get()/Put() maintains a refcount for each ID, mounting
only on first Get() and unmounting on the last Get().

This means we avoid littering the system with lots of mounts
and free resources related to them.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-01-21 11:26:11 +01:00
Alexander Larsson 886f650d9b devicemapper: Unmount inactive devices
This implements the new Put() operation such that
Get()/Put() maintains a refcount for each ID, mounting
only on first Get() and unmounting on the last Get().

This means we avoid littering the system with lots of mounts
and active devicemapper devices and free resources related
to them.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)

asdfljk
2014-01-21 11:26:11 +01:00
Alexander Larsson bcaf6c2359 Add Put() to graphdriver API and use it
This makes all users of Put() have a corresponding call
to Get() which means we will be able to track whether
any particular ID is in use and if not unmount it.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-01-21 11:25:37 +01:00
Alexander Larsson 4fb1db7f74 archive: Remove unused features
This simplifies that code that calls out to tar by removing support
for now unused features.

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-01-20 20:26:20 +01:00
Paul Nasrat 2e094db639 Extract mount into pkg.
Mount is self contained and generic, it should be in pkg, to allow other pkg modules to use it.

Docker-DCO-1.1-Signed-off-by: Paul Nasrat <pnasrat@gmail.com> (github: pnasrat)
2014-01-20 13:59:29 -05:00
Alexander Larsson 93e120e7d6 Discard all data on devicemapper devices when deleting them
This works around the fact that deleting a device in a thin pool
doesn't discard the free space. Unfortunately even this is not perfect,
as it seems discards are respected only for blocks that has never been
shared in the thin device code. However, this has been fixed in the
upstream kernel device-mapper tree:

http://git.kernel.org/cgit/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=for-next&id=0ab1c92ff748b745c1ed7cde31bb37ad2c5f901a

When this hits the kernel I belive this will fully return space
for removed images/containers to the host FS. For now it only
helps partially (which is better than nothing).

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
2014-01-13 13:41:04 +01:00
Guillaume J. Charmes ef7e000a13
Make vfs error more explicit
Docker-DCO-1.0-Signed-off-by: Guillaume J. Charmes <guillaume.charmes@docker.com> (github: creack)
2014-01-07 16:02:41 -08:00
Clayton Coleman 029625981d Fix typo in devmapper error message 2013-12-25 15:49:58 -05:00
Michael Crosby 7bc96aec7b Improve interface by moving to subpkg
Enable builds on OSX
2013-12-18 16:42:49 -08:00
Michael Crosby a6fdc5d208 Fix unmount issues 2013-12-18 15:24:08 -08:00
Michael Crosby 45d7dcfea2 Handle external mounts outside of lxc 2013-12-18 13:46:02 -08:00
Guillaume J. Charmes e481c82fa9 Fix OSX compilation for aufs 2013-12-18 10:18:49 -08:00
Guillaume J. Charmes f5ab2516d8 Merge pull request #2897 from crosbymichael/aufs-42
Increase max image depth to 127
2013-12-13 16:03:57 -08:00
Josh Poimboeuf a015f38f4a devmapper: add missing defines
Add some missing defines which are needed for compiling on older systems
like RHEL 6.
2013-12-06 10:13:47 -06:00
Victor Vieux 5f55c1aee1 Merge pull request #2966 from andrewsmedina/govet2
fixed some `go vet` issues.
2013-12-04 17:57:10 -08:00
Andrews Medina fea432bdf5 fixed `Looback` typo. 2013-11-30 16:28:52 -02:00
Andrews Medina e8437e8fcf using `errors.New` instead `fmt.Error`. 2013-11-30 01:02:09 -02:00
Andrews Medina a6c9a332d0 fixed some `go vet` issues. 2013-11-29 22:53:20 -02:00
Guillaume J. Charmes f72e604872 Merge branch 'master' into docker-osx 2013-11-28 21:16:32 -08:00
Guillaume J. Charmes 261bd0d187
Improve devmapper unit tests with syscall/ioctl 2013-11-28 11:53:09 -08:00
Guillaume J. Charmes a990b3aeb9
Correct comments 2013-11-28 11:02:53 -08:00
Guillaume J. Charmes 533067bba4
Rename file for consistency 2013-11-28 10:37:03 -08:00