Commit graph

59 commits

Author SHA1 Message Date
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
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
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
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
Clayton Coleman
029625981d Fix typo in devmapper error message 2013-12-25 15:49:58 -05: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
Guillaume J. Charmes
24c03b2d93 Make devicemapper linux-only 2013-11-27 19:12:51 -08:00
Guillaume J. Charmes
8a5d927a53
Check if the target loopback is a block device 2013-11-27 18:21:17 -08:00
Guillaume J. Charmes
1214b8897b
Extract ioctl from wrapper 2013-11-27 17:47:20 -08:00
Guillaume J. Charmes
eb528b959e
Move attach loop device to its own file 2013-11-27 17:12:57 -08:00
Guillaume J. Charmes
74c8f7af75
Refactor attach loop device in pure Go 2013-11-27 15:39:30 -08:00
Guillaume J. Charmes
78d2e2dc37
Reduce debugf frequency to avoid terminal freeze 2013-11-25 12:06:16 -08:00
Guillaume J. Charmes
79e2b33ede
Use variable to call functions in devmapper_wrapper + some formatting 2013-11-22 12:25:37 -08:00
Guillaume J. Charmes
bc82940a57
Forbid syscalls in tests, add 2 new unit tests 2013-11-21 16:32:16 -08:00
Solomon Hykes
df258f5861 Devmapper: test driver initialization and its interaction with libdevmapper 2013-11-21 02:17:03 +00:00
Solomon Hykes
60f728b170 Devmapper: wrap calls to os/exec for easier mocking 2013-11-21 02:16:26 +00:00
Solomon Hykes
2b7c63b1b5 devmapper: skip test which are not unit tests 2013-11-21 02:12:51 +00:00
Solomon Hykes
e2390318bb Devmapper: mock all calls to libdevmapper in the unit tests, and deny them by default 2013-11-20 23:39:02 +00:00
Solomon Hykes
da514223d1 Devmapper: remove deprecated test helpers 2013-11-20 23:25:27 +00:00
Solomon Hykes
023ff36704 devmapper: fix typo 2013-11-20 23:12:19 +00:00
Guillaume J. Charmes
d233894c25
Add devmapper struct doc 2013-11-20 14:09:46 -08:00
Guillaume J. Charmes
a39bd65662
Remove os from devmapper 2013-11-20 13:05:17 -08:00
Guillaume J. Charmes
5690139785
Remove all syscall calls from devicemapper 2013-11-20 12:49:01 -08:00
Solomon Hykes
92f94f06ae Mock calls to system functions to facilitate unit testing 2013-11-20 20:05:10 +00:00
Michael Crosby
1b28cdc7f9 Handle image metadata when drivers are switched 2013-11-20 10:31:51 -08:00
Guillaume J. Charmes
3e0a5ac48b Merge pull request #41 from alexlarsson/dm-plugin-device-tool
Update docker-device-tool
2013-11-19 15:38:47 -08:00
Guillaume J. Charmes
12e993549d
Fix unit-tests 2013-11-19 15:24:14 -08:00