Commit Graph

8 Commits

Author SHA1 Message Date
74b00e51f4 devmapper: Move init layer to top rather than bottom
The init layer needs to be topmost to make sure certain files
are always there (for instance, the ubuntu:12.10 image wrongly
has /dev/shm being a symlink to /run/shm, and we need to override
that). However, previously the devmapper code implemented the
init layer by putting it in the base devmapper device, which meant
layers above it could override these files (so that ubuntu:12.10
broke).

So, instead we put the base layer in *each* images devmapper device.
This is "safe" because we still have the pristine layer data
in the layer directory. Also, it means we diff the container
against the image with the init layer applied, so it won't show
up in diffs/commits.
Upstream-commit: fdbc2695fe00d522c5c1a962f9be2f802bf53943
Component: engine
2013-09-30 17:35:01 -06:00
89fbc4edd2 deviceset: Cleanup device sets on test end
We unmount all mounts and deactivate all device mapper devices to
make sure we're left with no leftovers after the test.
Upstream-commit: ed741f7b27b1b1cf5b6f8917551ce86bc39e9c78
Component: engine
2013-09-30 17:35:01 -06:00
12fbeaaae6 DeviceSet: Add UnmountDevice()
Right now this does nothing but add a new layer, but it means
that all DeviceMounts are paired with DeviceUnmounts so that we
can track (and cleanup) active mounts.
Upstream-commit: 9e64ebb29549db19a84b8cb514bea60c26184779
Component: engine
2013-09-30 17:35:01 -06:00
7d0232a89a Limit the amount of prints during normal runs
This removes some Debugf() calls and chages some direct prints to
Debugf(). This means we don't get a bunch of spew when running the
tests.
Upstream-commit: 6094257b28f2e4b5e1a6616c77961b5cec0c9195
Component: engine
2013-09-30 17:35:00 -06:00
8fb407ad51 devmapper: Base the device-mapper names on the root dir name
This means the default is "docker-*", but for tests we get separate
prefixes for each test.
Upstream-commit: 8e7cbbff504b1d5b0680d2a14821d1d7b0757ab0
Component: engine
2013-09-30 17:34:59 -06:00
0553a0af33 devmapper: Add simple tool to test the DeviceSet commands
Upstream-commit: 7fb3bfed03d4d2a88f0e76fd6b8425cc753f4547
Component: engine
2013-09-30 17:34:58 -06:00
bf4813911d devmapper: Add DeviceSet device-mapper helper
This is a module that uses the device-mapper create CoW snapshots
You instantiate a DeviceSetDM object on a specified root (/var/lib/docker),
and it will create a subdirectory there called "loopback". It will
contain two sparse files which are loopback mounted into
a thin-pool device-mapper device called "docker-pool".

We then create a base snapshot in the pool with an empty filesystem
which can be used as a base for docker snapshots. It also keeps track
of the mapping between docker image ids and the snapshots in the pool.

Typical use of is something like (without error checking):

devices = NewDeviceSetDM("/var/lib/docker")
devices.AddDevice(imageId, "") // "" is the base image id
devices.MountDevice(imageId, "/mnt/image")
 ... extract base image to /mnt/image
devices.AddDevice(containerId, imageId)
devices.MountDevice(containerId, "/mnt/container")
... start container at /mnt/container
Upstream-commit: 374a5e9913112c5bde590e532bc0ba5e4afeda49
Component: engine
2013-09-30 17:34:58 -06:00
cdec248ebe Add libdevmapper wrapper
Upstream-commit: 459bac712709db4d188022539f4d59524b4b3670
Component: engine
2013-09-30 17:34:58 -06:00