Commit Graph

28 Commits

Author SHA1 Message Date
d7aa3ef25d Add debug messages while testing devicemapper
Upstream-commit: 11d695a2973d67906145e7f0972b6e693bdaa3f9
Component: engine
2013-10-16 20:45:59 +00:00
e0dfea89d2 Change default values for devicemapper as variable instead of env
Upstream-commit: 3a246ac3d1368931998a082043c9b719dd3c10cd
Component: engine
2013-10-16 20:42:50 +00:00
05176434d1 WIP: debugging dm-base-hash + dm-refactor-init
Upstream-commit: cd61fb2e6f9d2a7bbd3c4db2ab9091674746126d
Component: engine
2013-10-15 23:56:04 +00:00
58a19a7d93 Merge branch 'dm-refactor-init' into dm
Conflicts:
	runtime_test.go
Upstream-commit: fdba1aeed8c80b3c2f8cd14c3b393581e7ef99a8
Component: engine
2013-10-15 23:27:28 +00:00
990549480d Merge branch 'dm-base-hash' into dm
Upstream-commit: c9f3e54c3148aeaaa668bcdff184e14d016d2613
Component: engine
2013-10-15 23:09:26 +00:00
3dc4429624 devmapper: create device nodes 'on create' instead of 'on resume'
Upstream-commit: 5ebaca7e55e006083e6e9c2782e4f8b421275579
Component: engine
2013-10-15 21:27:47 +00:00
821d8910fe Rename loopback dir to devicemapper
Upstream-commit: 4431e9edb7cf49ec7da8201da1221b5b03ea09ee
Component: engine
2013-10-15 11:30:06 -07:00
ceadf83972 Use incrementing prefix on pool and loopback to allow dind
Upstream-commit: 3455c1a0983ae74d22b05abc3c0552460c6a2710
Component: engine
2013-10-14 17:48:43 -07:00
0e3ebd255a Allow loopback and base fs sizes set by env var
Upstream-commit: c3f1bb3287a10ed0d49f48630b92c69ff6ca4ff7
Component: engine
2013-10-11 20:37:11 -07:00
f3a38555ac device-mapper: Move all devicemapper spew to log through utils.Debugf().
Upstream-commit: b440ec0136793ebcfbf8d76e6cd16ccba0785382
Component: engine
2013-10-11 16:31:06 -07:00
ecfa6df5b6 devmapper: Move all "raw" libdevmapper wrappers to devmapper.go
This separates out the DeviceSet logic a bit better from the raw
device mapper operations.

devicemapper: Serialize addess to the devicemapper deviceset

This code is not safe to run in multiple threads at the same time,
and neither is libdevmapper.

DeviceMapper: Move deactivate into UnmountDevice

This way the deactivate is atomic wrt othe device mapper operations
and will not fail with EBUSY if someone else starts a devicemapper
operation inbetween unmount and deactivate.

devmapper: Fix loopback mounting regression

Some changes were added to attach_loop_device which added
a perror() in a place that caused it to override errno so that
a later errno != EBUSY failed. This fixes that and cleans up
the error reporting a bit.

devmapper: Build on old kernels without LOOP_CTL_GET_FREE define
Upstream-commit: c77697a45ca615f66351a7363e93c3903e92553f
Component: engine
2013-10-11 16:30:02 -07:00
7bc3cd3dbe Merge pull request #2087 from alexlarsson/device-mapper-test
Device mapper test branch update
Upstream-commit: f6913592a12b0ae98b4f2c9132da7101f74b859a
Component: engine
2013-10-04 07:54:43 -07:00
850aea64f1 Remove overly spewy Debugf
Upstream-commit: f7e374fb3a51bd25e61ae6c4343838a0ca756fba
Component: engine
2013-10-04 15:36:30 +02:00
baed3230a9 Small fixes
Upstream-commit: f29c500d8d480547874425ba98a9381fdc9df89e
Component: engine
2013-10-03 18:05:07 -07:00
78b0694228 Make sure we mark the libdevmapper /dev/mapper/control fd CLOEXEC
We do a hack to mark it such, because otherwise lxc-start will not
work.
Upstream-commit: 1a1be5a87c2169def7b0b0c29fc5cbac850a00a5
Component: engine
2013-10-03 21:00:16 +02:00
7dc11f73be Random improvments
Upstream-commit: 8b2f4aab232880cb0d7faa18ae12adb33f483b2c
Component: engine
2013-10-02 20:18:15 -07:00
705988989e disable: don't create device nodes manually if udev is not availabile as we don't have it in dind
Upstream-commit: 55189307d0ec6992f76572fae675bd371cc36cff
Component: engine
2013-10-03 15:47:38 +00:00
71899158fd Tests: Clean up any old devmapper leftovers before starting tests
Upstream-commit: 03320f0d1c5a687ec46cbf6d836cc91576b3b225
Component: engine
2013-09-26 15:09:33 +00:00
30395e320c Add DeviceSet.HasActivatedDevice()
This lets you see if a device has been activated
Upstream-commit: 395bce4c4174014cb3264c35a7c6f97a2cb0948f
Component: engine
2013-09-26 15:09:33 +00:00
63649a9435 devmapper: Fix loopback mount code
Typo in the loop-control code made it always fall back to the
old method of opening loopback devices.
Upstream-commit: cc28829429f5f11da287ecb75ee5b3e5f05d31ad
Component: engine
2013-09-26 15:09:32 +00:00
ee414671bb 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: c199ed228baf0e5d33b7739cc2442a32dece7020
Component: engine
2013-09-26 15:09:32 +00:00
51abe008c8 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: c6e8813c979bbea8832f47dc6468e805a1a18c3e
Component: engine
2013-09-26 15:09:32 +00:00
f82807f434 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: 251a7ed437c17ecb66d33782f0b42633033198dd
Component: engine
2013-09-26 15:09:31 +00:00
5e59cd4e23 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: bc7fa7b95773d638754eb72e7921ac328acb2ad6
Component: engine
2013-09-26 15:09:31 +00:00
eda48ebeaf 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: 8f343ea65a05b374ffa64940a1946abf28402689
Component: engine
2013-09-26 15:08:55 +00:00
167815c85c devmapper: Add simple tool to test the DeviceSet commands
Upstream-commit: 2b1dc8a8a3b99e6edbdf2cc71bf5461d81b9c354
Component: engine
2013-09-26 15:08:54 +00:00
51bfa55a02 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: 0b12702c0c9753cbb18a942bac2600b036e4f80e
Component: engine
2013-09-26 15:08:54 +00:00
d06f87abd9 Add libdevmapper wrapper
Upstream-commit: 739af0a17f6a5a9956bbc9fd1e81e4d40bff8167
Component: engine
2013-09-26 15:08:54 +00:00