Commit Graph

84 Commits

Author SHA1 Message Date
7b6399d928 Merge pull request #9006 from snitm/thin-pool-improvements
Thin pool improvements
Upstream-commit: b47ff77b5ce852bd830bc617d1c4e2c37e346281
Component: engine
2014-11-26 14:44:09 -05:00
c836e22634 devmapper: cleanup some extraneous branching in setupBaseImage()
Docker-DCO-1.1-Signed-off-by: Mike Snitzer <snitzer@redhat.com> (github: snitm)
Upstream-commit: b9f1b0a7514c6e40e7048fb9206001259eb7c33c
Component: engine
2014-11-24 20:06:41 -05:00
b28ed4ddea devmapper: remove unnecessary else branch in getPoolName()
Docker-DCO-1.1-Signed-off-by: Mike Snitzer <snitzer@redhat.com> (github: snitm)
Upstream-commit: 553b50bd37ade60bfafe5d5cc10f984251741f44
Component: engine
2014-11-21 21:36:23 -05:00
0c37aeb40b Mknod more loopbacks for devmapper
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: f8509e7940d73ecc0071faf15a865acb1f8dad52
Component: engine
2014-11-21 16:20:35 -08:00
6149f196a8 pkg/devicemapper: missed MAINTAINERS on split
Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 3ec623ee2fc503a6236a7b0edde5dd6abb967e49
Component: engine
2014-11-14 11:12:23 -05:00
e0ca5a198f devmapper: disable discards by default if dm.thinpooldev was specified
User may still enable discards by setting dm.blkdiscard=true

Docker-DCO-1.1-Signed-off-by: Mike Snitzer <snitzer@redhat.com> (github: snitm)
Upstream-commit: e49567ba729001c31fe71e4b715eed8f50d7ded9
Component: engine
2014-11-13 13:37:47 -05:00
17af21f92a devmapper: Add option for specifying an lvm2 created thin-pool device
Ideally lvm2 would be used to create/manage the thin-pool volume that is
then handed to docker to exclusively create/manage the thin and thin
snapshot volumes needed for it's containers.  Managing the thin-pool
outside of docker makes for the most feature-rich method of having
docker utilize device mapper thin provisioning as the backing storage
for docker's containers.  lvm2-based thin-pool management feature
highlights include: automatic or interactive thin-pool resize support,
dynamically change thin-pool features, automatic thinp metadata checking
when lvm2 activates the thin-pool, etc.

Docker will not activate/deactivate the specified thin-pool device but
it will exclusively manage/create thin and thin snapshot volumes in it.

Docker will not take ownership of the specified thin-pool device unless
it has 0 data blocks used and a transaction id of 0.  This should help
guard against using a thin-pool that is already in use.

Also fix typos in setupBaseImage() relative to the thin volume type of
the base image.

Docker-DCO-1.1-Signed-off-by: Mike Snitzer <snitzer@redhat.com> (github: snitm)
Upstream-commit: 2b10749cdd0939e4b9e6e18e160984129d733663
Component: engine
2014-11-12 21:03:04 -05:00
90c31c6725 Merge pull request #8986 from vbatts/vbatts-pkg_devicemapper_bindings
devicemapper: split out devicemapper bindings
Upstream-commit: 42861f3b45733268da674b82bceb6deef67b5513
Component: engine
2014-11-12 19:59:36 -05:00
d82839394f Merge pull request #8982 from rhvgoyal/save-restore-device-id
Save restore device Id: issue #8978
Upstream-commit: 9670871e0166658c5b6982d3ccf79a82afb9442c
Component: engine
2014-11-12 15:41:27 -08:00
957b4d5684 devmapper: Take care of some review comments
Took care of some review comments from crosbymichael.

v2:
- Return "err = nil" if file deviceset-metadata file does not exist.
- Use json.Decoder() interface for loading deviceset metadata.

v3:
- Reverted back to json marshal interface in loadDeviceSetMetaData().

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 15c74bebc1ea2d51612b5809b4477551547a8b3d
Component: engine
2014-11-12 09:36:32 -05:00
65be102bc2 docker-remove-redundant-json-tags
In previous patch I had introduce json:"-" tags to be on safer side to make
sure certain fields are not marshalled/unmarshalled. But struct fields
starting with small letter are not exported so they will not be marshalled
anyway. So remove json:"-" tags from there.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 0f57c902450b1d4f7a676dc693689debca002e98
Component: engine
2014-11-06 15:59:25 -05:00
b19230c3ba devmapper: add vbatts to MAINTAINERS
Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 2fbfa29318f66aac131bdddd9b32f28b7b7e508a
Component: engine
2014-11-06 14:06:52 -05:00
5bc67250c6 devicemapper: split out devicemapper bindings
This is a first pass at splitting out devicemapper into separate, usable
bindings.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: e2f8fbfbcc450432536e387777b1ff080c94a948
Component: engine
2014-11-05 18:10:38 -05:00
9b64c7701c devmapper: Fix gofmt related build failures
My pull request failed the build due to gofmat issues. I have run gofmt
on specified files and this commit fixes it.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: ff56531de47c08157b2a37e6c6b6189a5006dba2
Component: engine
2014-11-05 14:39:54 -05:00
71157e5ee3 devmapper: Save and restore NextDeviceId in a file
The way thin-pool right now is designed, user space is supposed to keep
track of what device ids have already been used. If user space tries to
create a new thin/snap device and device id has already been used, thin
pool retuns -EEXIST.

Upon receiving -EEXIST, current docker implementation simply tries the
NextDeviceId++ and keeps on doing this till it finds a free device id.

This approach has two issues.

- It is little suboptimal.
- If device id already exists, current kenrel implementation spits out
  a messsage on console.

[17991.140135] device-mapper: thin: Creation of new snapshot 33 of device 3 failed.

Here kenrel is trying to tell user that device id 33 has already been used.
And this shows up for every device id docker tries till it reaches a point
where device ids are not used. So if there are thousands of container and
one is trying to create a new container after fresh docker start, expect
thousands of such warnings to flood console.

This patch saves the NextDeviceId in a file in
/var/lib/docker/devmapper/metadata/deviceset-metadata and reads it back
when docker starts. This way we don't retry lots of device ids which 
have already been used. 

There might be some device ids which are free but we will get back to them
once device numbers wrap around (24bit limit on device ids).

This patch should cut down on number of kernel warnings.

Notice that I am creating a deviceset metadata file which is a global file
for this pool. So down the line if we need to save more data we should be
able to do that.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 8c9e5e5e05f8ddfcf8cd5218edb83d9fe8238d81
Component: engine
2014-11-05 09:25:02 -05:00
e178fdae88 devmapper: Export nextDeviceId so that json.Marshal() can operate on it
I was trying to save nextDeviceId to a file but it would not work and
json.Marshal() will do nothing. Then some search showed that I need to
make first letter of struct field capital, exporting this field and
now json.Marshal() works.

This is a preparatory patch for the next one.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 8e9a18039be6ade0b8db65f7f298959055d86192
Component: engine
2014-11-05 09:25:02 -05:00
cbe4b0091a devmapper: Move file write and rename functionality in a separate function
Currently we save device metadata and have a helper function saveMetadata()
which converts data in json format as well as saves it to file. For
converting data in json format, one needs to know what is being saved.

Break this function down in two functions. One function only has file
write capability and takes in argument about byte array of json data.
Now this function does not have to know what data is being saved. It
only knows about a stream of json data is being saved to a file.

This allows me to reuse this function to save a different type of
metadata. In this case I am planning to save NextDeviceId so that
docker can use this device Id upon next restart. Otherwise docker
starts from 0 which is suboptimal.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 67fbd34d8379a1b8232aea5d126a389f64bdc59a
Component: engine
2014-11-05 09:25:02 -05:00
4e9f4b9a1b mount: move the MakePrivate to pkg/mount
The logic is unrelated to graphdriver.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 930a756ad55ad5f4e5e6391b41673743d7254c2b
Component: engine
2014-10-30 17:04:56 -04:00
bad39206ea Mass gofmt
Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Upstream-commit: ee7dd44c017458c8fe0be8e09569b1238366dca3
Component: engine
2014-10-24 15:11:48 -07:00
2d56e3cbc6 Use logrus everywhere for logging
Fixed #8761

Signed-off-by: Alexandr Morozov <lk4d4@docker.com>
Upstream-commit: 7c62cee51edc91634046b4faa6c6f1841cd53ec1
Component: engine
2014-10-24 15:03:06 -07:00
cde87628c0 Merge pull request #8232 from vbatts/vbatts-devmapper_getDeps
devmapper: include dm_deps information in debug
Upstream-commit: 2f9ffe5b6ac1c547d1b5c228637007b05af48a3f
Component: engine
2014-10-16 14:13:21 -07:00
6e9ab87c7d devmapper: include the version in info
Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 5630d466b28283c4d52ecfa5859a67112e8ccaa4
Component: engine
2014-09-25 15:51:02 -04:00
237330891b devmapper: include dm_deps information in debug
Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 8e7aa44f0e610f471dec9dd232599b4b9cba80b2
Component: engine
2014-09-25 10:59:23 -04:00
dd5abc97c6 devmapper: resizepool hardcodes files as well
Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 636e8561a86ffba909790e9188ffe282770570f0
Component: engine
2014-09-22 17:03:31 -04:00
b69ca50509 devmapper: docker info devices hard coded
If `--storage-opt dm.datadev=/dev/loop0 --storage-opt
dm.metadatadev=/dev/loop1 ` were provided, the information was not
reflected in the information output.

Closes: #7137

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 7e9ba22dc358196ac0d13524aa05677327f19ff9
Component: engine
2014-09-22 16:40:20 -04:00
ec0fc2a729 graphdriver interface name change, typo fix
Signed-off-by: Josh Hawn <josh.hawn@docker.com>
Upstream-commit: 09ad65ebd5b50fdd7621f42136278102586a7ea8
Component: engine
2014-09-16 15:10:32 -07:00
861f46b221 Refactor use of graphdriver.Differ
Some graphdrivers are Differs and type assertions are made
in various places throughout the project. Differ offers some
convenience in generating/applying diffs of filesystem layers
but for most graphdrivers another code path is taken.

This patch brings all of the logic related to filesystem
diffs in one place, and simplifies the implementation of some
common types like Image, Daemon, and Container.

Signed-off-by: Josh Hawn <josh.hawn@docker.com>
Upstream-commit: dee6b481fe0da1d845261ffff2e610fb05898d3c
Component: engine
2014-09-16 15:10:32 -07:00
560885c335 Merge pull request #7698 from tamsky/tune2fs_base_filesystem
use tune2fs to disable ext4 mount counts and mount intervals
Upstream-commit: a10a86d437148fe93c0ad128a233f42b17b22700
Component: engine
2014-09-15 15:42:52 +03:00
7261074190 use tune2fs to disable ext4 mount counts and mount intervals
Signed-off-by: Marc Tamsky <mtamsky@gmail.com> (github: tamsky)
Upstream-commit: d229821501d75fdb86424c3817aa6b7af8459afe
Component: engine
2014-09-05 19:32:39 -07:00
05579b5900 fix typos in error messages
Signed-off-by: Ward Vandewege <ward@jhvc.com> (github: cure)
Upstream-commit: a447894946ca2ac47bf1c46f78c4839c75fd740d
Component: engine
2014-09-03 13:12:10 -04:00
fe6985381c Use increment operator
Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>
Upstream-commit: 16e850fe3ea42f5103c9a11f3db17d11dc4f6ada
Component: engine
2014-08-30 21:43:48 +04:00
65adfb2362 Fix data space reporting from Kb/Mb to KB/MB
Docker-DCO-1.1-Signed-off-by: Vivek Dasgupta <vdasgupt@redhat.com> (github: vivekdasgupta)
Upstream-commit: a327d9b91edf6d36ee5b286ebe968bcca6658f5b
Component: engine
2014-08-21 21:03:44 +05:30
9df494bb71 another commit to do like @crosbymichael
Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: a0392324f194f4f92e3205f0c0ed8b71dc2fc93f
Component: engine
2014-08-14 01:36:26 +00:00
4737f7cea5 Extract log utils into pkg/log
Docker-DCO-1.1-Signed-off-by: Josiah Kiehl <josiah@capoferro.net> (github: capoferro)
Upstream-commit: a02f67be5b17da63d475e6f35956c1e72c3b2e7b
Component: engine
2014-08-13 15:18:15 -07:00
416ed08d2b Replace "amd64" build tags with "cgo" as appropriate, and remove where unnecessary
Signed-off-by: Andrew Page <admwiggin@gmail.com>
Upstream-commit: 89ec17d11319ae39bff19985ac59fc878fe1fe1e
Component: engine
2014-08-06 17:20:21 -06:00
c3c811b0a6 Merge pull request #7430 from tamsky/docfixes
style, grammar, spelling fixes.
Upstream-commit: bc684fae642dbf585215b9518f469634a52a5524
Component: engine
2014-08-06 16:11:52 -07:00
a062aab14b add warning re: changing value of dm.basesize.
Signed-off-by: Marc Tamsky <mtamsky@gmail.com> (github: tamsky)
Upstream-commit: bd30746e07e18942cea4f2d15a45fd357c957e4f
Component: engine
2014-08-05 19:28:07 -07:00
88553ea651 style, grammar, spelling fixes.
Signed-off-by: Marc Tamsky <mtamsky@gmail.com> (github: tamsky)
Upstream-commit: 07099b62563f3201877995181825d4cd4822ed89
Component: engine
2014-08-05 18:11:32 -07:00
e25f77248d Move parsing functions to pkg/parsers and the specific kernel handling
functions to pkg/parsers/kernel, and parsing filters to
pkg/parsers/filter. Adjust imports and package references.

Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
Upstream-commit: 4398108433121ce2ac9942e607da20fa1680871a
Component: engine
2014-07-29 13:09:10 -07:00
2273fb0f55 gofmt -s -w
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
Upstream-commit: 5a0ef08c940b9a17c400389bca8e7f54935ceba9
Component: engine
2014-07-24 22:25:29 +00:00
6ae4c9014c update go import path and libcontainer
Docker-DCO-1.1-Signed-off-by: Victor Vieux <vieux@docker.com> (github: vieux)
Upstream-commit: b3ee9ac74e171e00f14027e39278013629e681b8
Component: engine
2014-07-24 22:19:50 +00:00
b57da60173 Merge pull request #6939 from snitm/thinp-blocksize-fix
devmapper: revert the default dm-thin-pool blocksize back to 64K
Upstream-commit: 840ed5ace28381e61b6b34063f9afb71d63fb6a9
Component: engine
2014-07-10 19:57:07 +03:00
323df0e24b Fix typos
Docker-DCO-1.1-Signed-off-by: Bryan Bess <squarejaw@bsbess.com> (github: squarejaw)
Upstream-commit: 1df4049e17e4a3edf4487b072f2085bc2dd2ee0b
Component: engine
2014-07-09 23:14:06 -05:00
0ee458dda8 devmapper: revert the default dm-thin-pool blocksize back to 64K
Commit 09ee269d ("devmapper: Add option for specifying the thin pool
blocksize") also switched the default dm-thin-pool blocksize from 64K to
512K.  That change unfortunately breaks the activation of dm-thin-pool
devices that were previously created using a 64K blocksize.  Here is an
example of the dm-thin-pool activation failure users may experience:

 device-mapper: thin: 253:4: pool target (204800 blocks) too small: expected 1638400
 device-mapper: table: 253:4: thin-pool: preresume failed, error = -22

The reason for this is docker is passing 512K as the blocksize for a
dm-thin-pool that was previously created using a 64K blocksize.  Docker
doesn't record the blocksize the is used when it creates a dm-thin-pool.
Until now it never had a need to do so because the blocksize was always
hardcoded.  The dm-thin-pool blocksize must be the same every time a
dm-thin-pool is activated.

As a stop-gap fix, revert to using 64K for the default blocksize.

But we do need a proper fix for this now that 'dm.blocksize' is exposed
as a proper storage option.  One possible fix would be to record the
blocksize for each dm-thin-pool that docker creates and to pass that
recorded blocksize down in the dmsetup table load each time the
dm-thin-pool is activated (this would be comparable to what lvm2 does).

Docker-DCO-1.1-Signed-off-by: Mike Snitzer <snitzer@redhat.com> (github: snitm)
Upstream-commit: d715803d45d41bfbbd5faf1f4a8239c08d6d8c90
Component: engine
2014-07-09 16:47:30 -04:00
bfe0fa53e6 Merge pull request #6636 from saaadhu/master
Fix typo in README.md
Upstream-commit: f021cd64eda967f7e5a4b3a3f5c99fb7efe49c10
Component: engine
2014-07-08 16:35:26 -07:00
9c28be7542 devmapper: add thin-pool blocksize to the 'docker info' output
Docker-DCO-1.1-Signed-off-by: Mike Snitzer <snitzer@redhat.com> (github: snitm)
Upstream-commit: a2f3ce2294bbe998df24edd50f2b571d0b21bac8
Component: engine
2014-06-26 12:39:16 -04:00
fbe2366f74 devmapper: document the default DM thin pool blocksize
Docker-DCO-1.1-Signed-off-by: Mike Snitzer <snitzer@redhat.com> (github: snitm)
Upstream-commit: 79f217e3501a43326bd532e8eb03182f7488f61c
Component: engine
2014-06-26 12:06:41 -04:00
bda9d074fe devmapper: remove extra space in DefaultThinpBlockSize assignment
Docker-DCO-1.1-Signed-off-by: Mike Snitzer <snitzer@redhat.com> (github: snitm)
Upstream-commit: f9c078ef38106d00de7774374f3ac71bb0d562d3
Component: engine
2014-06-24 12:43:45 -04:00
e00d89f257 devmapper: Add option for specifying the thin pool blocksize
Add dm.blocksize option that you can use with --storage-opt to set a
specific blocksize for the thin provisioning pool.

Also change the default dm-thin-pool blocksize from 64K to 512K.  This
strikes a balance between the desire to have smaller blocksize given
docker's use of snapshots versus the desire to have more performance
that comes with using a larger blocksize.  But if very small files will
be used on average the user is encouraged to override this default.

Docker-DCO-1.1-Signed-off-by: Mike Snitzer <snitzer@redhat.com> (github: snitm)
Upstream-commit: 09ee269d998ad04733ef577739fa051df9d3f12e
Component: engine
2014-06-24 12:10:28 -04:00
d61150b2d4 devmapper: use RAMInBytes() rather than FromHumanSize()
Device Mapper needs device sizes in binary (1024) multiples.  Otherwise
kernel checks can find that the specified thin-pool device sizes aren't
a multiple of the specified thin-pool blocksize.

The name for "RAMInBytes" is likely too narrow given the new consumers
but... Also add "tebibyte" support to RAMInBytes.

Docker-DCO-1.1-Signed-off-by: Mike Snitzer <snitzer@redhat.com> (github: snitm)
Upstream-commit: 2470a5ed999d9dc8d4b9bd250727ac13964db5b3
Component: engine
2014-06-24 12:10:14 -04:00