Commit Graph

148 Commits

Author SHA1 Message Date
44fddcaf4b Merge pull request #11412 from vbatts/vbatts-dm_sync_is_required
devmapper: udev sync is a requirement
Upstream-commit: 23c12dabbdb7f895f606bbf2438599d29c53df3a
Component: engine
2015-04-10 16:52:38 -04:00
d89c51c3b5 devmapper: storage-opt override for udev sync
This provides an override for forcing the daemon to still attempt
running the devicemapper driver even when udev sync is not supported.

Intended to be a very clear impairment for those choosing to use it. If
udev sync is false, there will still be an error in the daemon logs,
even when the override is in place. The docs have an explicit WARNING.

Including link to the docs for users that encounter this daemon error
during an upgrade.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 0e21782de5c038dfa3cfdfc7655b9e6b143baa7b
Component: engine
2015-04-10 15:43:16 -04:00
25835c875f devmapper: udev sync is a requirement
closes #10664
closes #4036

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: ca628c6216ade64790dfbfe388fe4769433ec4aa
Component: engine
2015-04-06 15:17:57 -04:00
68a3810b3c devmapper: Retry device removal after 100ms instead of 10ms
Right now we try device removal at the interval of 10ms and keep on trying
till either device is removed or 10 seconds are over. That means if device
is busy, we will try 1000 times in those 10 seconds.

Sounds too high a frequency of deivce removal retrial. All the logs are
filled easily. I think it is a good idea to slow down a bit and retry at
the interval of 100ms instead of 10ms.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: c737800b7faced4b53854c8cb6766ebe58a3c3e9
Component: engine
2015-04-02 16:47:14 -04:00
a0411faab2 devmapper: Remove call to waitClose()
During device removal, we are first waiting for device to close() in a tight
loop for 10 seconds. I am not sure why do we need it. First of all we come
here once the umount() is successful so device should be free. For some reason
of device is temporarily busy, then removeDevice() logic retries device removal
logic in a loop for 10 seconds and that should cover it. Can't see why one
more 10 seoncds loop is required before attempting device removal.

One loop should be able to cover all the temporary device busy conditions and
if condition is not temporary then 10 seconds loop is not going to help anyway.

So instead of two loops of 10 seconds each, I am converting it to a single
loop of 20 seconds. May be 10 second loop is good enough but for now I am
keeping it 20 seconds to avoid any regressions.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: f74d12012c21349b2bd51d9c395a99331ff0a9a5
Component: engine
2015-04-02 16:47:14 -04:00
12beb9b276 devmapper: Remove extra wait after device removal
Currently in device removal path (device deactivation), we wait
for 10 seconds for devive to actually go away. waitRemove().

In current code this is not required. If dm removal task has completed
and one has done the wait on udev cookie, then device is gone and there
is no need to write another loop to wait for device removal.

This patch removes the waitRemove() which waits for 10 seconds after
device removal. This seems unnecessary.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: dbf04ec4e2a6b4fe73f7f300918a906c0ff1a37b
Component: engine
2015-04-02 16:47:14 -04:00
cb8a2764e5 devicemapper: Remove debug messages from RemoveDevice()
devmapper graph driver retries device removal 1000 times in case of failure
and if this fills up console with 1000 messages (when daemon is running in
debug mode). So remove these debug messages.
 
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: cb7c893275c32ddfa775c3f22869a9c211024c71
Component: engine
2015-04-02 16:47:14 -04:00
2b212c76e7 devmapper: Fix libdm logging
There are issues with libdm logging. Right now if docker daemon is run
in debug mode, logging by libdm is too verbose. And if a device can't 
be removed, thousands of messages fill the console and one can not see
what's going on.

This patch removes devicemapper.LogInitVerbose() call as that call will
only work if docker was not registering its own log handler with libdm.
For some reason docker registers one with libdm and libdm hands over
all the messages to docker (including debug ones). And now it is up to
devmapper backend to figure out which ones should go to console and
which ones should not.

So by default log only fatal messages from libdm. One can easily modify
the code to change it for debugging purposes.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: e07d3cd9acf14219f33e12375fb8c2e3fe02ad0c
Component: engine
2015-04-02 16:47:14 -04:00
e5b36a723c Replace aliased imports of logrus, fixes #11762
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Upstream-commit: 6f4d847046cb4e072de61d042c0266190d73a8c9
Component: engine
2015-03-26 23:22:04 +01:00
ac917d33bd Fixed redundant else in GetDeviceStatus
Signed-off-by: Anes Hasicic <anes.hasicic@gmail.com>
Upstream-commit: e479e1c9f7d327f396eebc46d446cf4ee34513f7
Component: engine
2015-03-25 09:53:04 +01:00
b3678f8418 Merge pull request #11076 from hqhq/hq_use_warning_in_sysinfo
use type WARN for warning
Upstream-commit: 82f390e139e611b97911c19dd1be2a98264cf4b9
Component: engine
2015-03-15 21:13:23 -07:00
b951eb79db Fix minor typo
Signed-off-by: Deng Guangxing <dengguangxing@huawei.com>
Upstream-commit: ce1a0b612d300210fadf12556e1b38885f098197
Component: engine
2015-03-11 11:13:39 +08:00
ad6ee8ec46 fix warning messages
Use log.Warnf instead of log.Infof, and remove redundant `WARNING` prefix.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Upstream-commit: bffe04b582d143f074297b260a359dfb54a7763b
Component: engine
2015-03-11 08:47:45 +08:00
5506a9a27c Remove subdirectories MAINTAINERS files
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: 89bdaa35e04b74b7c6528783e0f7b8154b2a3d31
Component: engine
2015-03-06 18:21:51 -08:00
2d25573473 Merge pull request #11106 from MabinGo/fix_log_info
Fix some revision about log output
Upstream-commit: 32ccde46dde5130adcfb170c846c8f0317761aee
Component: engine
2015-03-02 13:55:43 -08:00
d0e86ebf79 Merge pull request #11054 from MabinGo/checkfileoper1
Add the file close operation before function return to advoid resource leaking
Upstream-commit: 82aa950f4e10dbd45b16ecfc144f8d4b450ad1ff
Component: engine
2015-03-02 10:44:26 -08:00
aeb9a73d60 Merge pull request #11083 from MabinGo/minor_typo
Modify the minor typo in deviceset.go
Upstream-commit: 738bdec4908755761b27b7d15baeefb1a824f770
Component: engine
2015-03-02 13:11:14 -05:00
4a59461365 Fix some revision about log output
Signed-off-by: Mabin <bin.ma@huawei.com>
Upstream-commit: adfd1ddfc6e094295d07ff2b36fb6e91cf7878dd
Component: engine
2015-03-02 17:06:38 +08:00
f3df541809 fix typo of comments in daemon/graphdriver/devmapper/deviceset.go
Signed-off-by: Mabin <bin.ma@huawei.com>
Upstream-commit: f4ac86de84c25bf1793d1e934695b7119dc51b70
Component: engine
2015-03-02 02:11:15 +08:00
5e225bf426 Modify the minor typo in deviceset.go
Signed-off-by: Mabin <bin.ma@huawei.com>
Upstream-commit: 5c1559a754f7b1fba45be01a6f1a4b3c7c6c4c68
Component: engine
2015-02-28 18:04:10 +08:00
0fd505f748 Add the file close operation before function return to advoid resource leaking
Signed-off-by: Mabin <bin.ma@huawei.com>
Upstream-commit: b5eeab6e061d183be050143426dd7fd774c89a20
Component: engine
2015-02-28 00:24:41 +08:00
009380c706 Merge pull request #10474 from petervo/10473-availble-space
Add available space to devicemapper status output
Upstream-commit: f4dc496d36d31cf9ca1b3508f10954066ff7f8bc
Component: engine
2015-02-10 16:32:51 +01:00
7fe8a53e1c Detail available space behavior on loop devices
Signed-off-by: Peter Volpe <petervo@redhat.com>
Upstream-commit: 6816d27591a24b7a3a5b2e4c85294abffda977a2
Component: engine
2015-02-09 14:51:48 -08:00
5c8d4a0091 Merge pull request #10440 from rhvgoyal/skip-dot-prefix-files
devicemapper: Skip the files with prefix "." during device map construct...
Upstream-commit: 67a4f1db103ac726f6e3d1fe388214ba41062b78
Component: engine
2015-02-09 10:26:27 +01:00
a31c4ae7c4 Fix a small spelling error in the dm.blkdiscard docs
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
Upstream-commit: fcb975cfd17cfbe45b7f6661c2c1c4a94de04c94
Component: engine
2015-02-05 10:57:33 +10:00
cab1f7d560 Add available space to devicemapper status output
Signed-off-by: Peter Volpe <petervo@redhat.com>
Upstream-commit: 726f89d77a575c6a121829eb8fe63c1d3d6452fe
Component: engine
2015-01-30 22:36:04 -08:00
7556ae9236 devicemapper: Skip the files with prefix "." during device map construction
Any file which starts with "." is not a valid metadata file. Skip it
during device map construction.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 080a6f1e4b7c33ce9b7b1b90cbf8fd90658226c2
Component: engine
2015-01-29 13:19:18 -05:00
f11f701e04 Merge pull request #10222 from vbatts/vbatts-dm_flag_and_output
dm flag and output
Upstream-commit: 9b2afa04f8ab491d56614835de09eb0880250309
Component: engine
2015-01-20 18:45:43 -05:00
85aed8db6e devmapper: initialize log levels
Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 0c8be9da3763d86c2a6e847e1667410056d6071d
Component: engine
2015-01-20 13:31:19 -05:00
62c5f93e15 devmapper: some explination of docker info
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
Upstream-commit: a09a665d99c84be74ffff68a39dde83ad3c0d34a
Component: engine
2015-01-19 17:37:08 -05:00
279519e07d devicemapper: debug output specifics
moar information for the information gods

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 4cfe9df0a9c206c368a90f460fea8fab197265d9
Component: engine
2015-01-19 17:21:10 -05:00
8ae343ded1 devmapper: udev sync in docker info
now:

```
[...]
Storage Driver: devicemapper
 Pool Name: docker-253:2-5767172-pool
 [...]
 Udev Sync Supported: true
[...]
```

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: d2593546f9a234699cd0034cc6b97c748c10c93e
Component: engine
2015-01-19 16:28:02 -05:00
e54a5327c8 devmapper: udev sync on init
when initializing the devmapper driver, attempt to sync udev and device
mapper. If udev sync is not supported, print a warning. Eventually we'll
likely bail here to avoid unpredictable behavior for users.

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 022e1232f84966c4b70a612bc35463ebb58e3137
Component: engine
2015-01-19 15:57:25 -05:00
310b2cd524 Add backing filesystem info to docker info command where applicable
Fixes #9960

This adds the output of a "Backing Filesystem:" entry to `docker info`
to overlay, aufs, and devicemapper graphdrivers. The default list
includes a fairly complete list of common filesystem names from
linux/include/uapi/linux/magic.h, but if the backing filesystem is not
recognized, the code will simply show "<unknown>"

Docker-DCO-1.1-Signed-off-by: Phil Estes <estesp@linux.vnet.ibm.com>
Upstream-commit: 48b1dd0084904678728817d728bb9ab1c0183aad
Component: engine
2015-01-16 14:43:43 -05:00
6d98dd3144 Fix vet error about passing Mutex by value
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: bb96e53b0f947a31a4b66e76607eed0097917ed5
Component: engine
2015-01-14 14:03:00 -08:00
94b5bf5737 Merge pull request #10003 from vbatts/vbatts-dm_loop_file_info
devmapper: show device and loop file , if used
Upstream-commit: 044d979f4ec83aac5664691d29123c34f6db68d6
Component: engine
2015-01-14 01:15:09 +02:00
87c9f594f0 Merge pull request #10047 from vbatts/vbatts-graphdriver_driver_put_with_error
graphdriver: change (*Driver).Put signature
Upstream-commit: 83ab6237ac0d58e54c2f6f9308136594774386ba
Component: engine
2015-01-12 11:42:11 -08:00
67a17d26c7 devmapper: remove newline string
Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 2b51d1a167055834df331fb23c6cd373ebc06211
Component: engine
2015-01-12 13:40:42 -05:00
0e444dd64f graphdriver: change (*Driver).Put signature
There are a couple of drivers that swallow errors that may occur in
their Put() implementation.

This changes the signature of (*Driver).Put for all the drivers implemented.

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
Upstream-commit: 00fd63e55807c36fedf0878645dfec995fba381d
Component: engine
2015-01-12 13:34:35 -05:00
504e80c0b5 devmapper: show device and loop file , if used
Presenly the "Data file:" shows either the loopback _file_ or the block device.
With this, the "Data file:" will always show the device, and if it is a
loopback, then there will additionally be a "Data loop file:".
(Same for "Metadata file:")

Signed-off-by: Vincent Batts <vbatts@redhat.com>
Upstream-commit: 09c033ff872334cdcc45172ac57dbf21573481ef
Component: engine
2015-01-09 11:20:07 -05:00
fb6c082460 change to lazy Unmount
syscall.Unmount failed sometimes when user interrupted exporting,
for example a Ctrl-C, or pipe to commands which closed the pipe early,
like "docker export <container_name> | file -"; this syscall.Unmount
could sometimes return EBUSY and didn't actually umount the filesystem;
which would cause a following export command fail to mount;
change to lazy Unmount with MNT_DETACH can fix the problem, this is
the same behavior as in Shutdown;

```text
time="2015-01-03T21:27:26Z" level=error msg="Warning: error unmounting device
34a3e77cdbca17ceffd0636aee0415bb412996adb12360bfe2585ce30467fa8e: device or resource busy"
```

```
$ docker export thirsty_ardinghelli | file -
/dev/stdin: POSIX tar archive
time="2015-01-03T21:58:17Z" level=fatal msg="write /dev/stdout: broken pipe"
$ docker export thirsty_ardinghelli
time="2015-01-03T21:54:33Z" level=fatal msg="Error: thirsty_ardinghelli: Error getting container
34a3e77cdbca17ceffd0636aee0415bb412996adb12360bfe2585ce30467fa8e from driver devicemapper:
Error mounting '/dev/mapper/docker-253:0-3148372-34a3e77cdbca17ceffd0636aee0415bb412996adb12360bfe2585ce30467fa8e'
on '/var/lib/docker/devicemapper/mnt/34a3e77cdbca17ceffd0636aee0415bb412996adb12360bfe2585ce30467fa8e': device or resource busy"
```

Signed-off-by: Derek Che <drc@yahoo-inc.com>
Upstream-commit: 9bbed5ab4ceaff5e78c21f0fa2d84de5ffd41f94
Component: engine
2015-01-04 00:10:48 +00:00
c7d1f45ca3 Merge pull request #9233 from inatatsu/fix-pkg-units-size-for-gccgo
Fix to avoid a compile error due to float to int truncation with GCCGO
Upstream-commit: 2acb856dff848bd69c5e971f6352854a26362164
Component: engine
2014-12-18 18:33:01 -08:00
149e33e015 Fix vet errors about json tags for unexported fields
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: c7ff6bf69149bc5892633d95ebfacaf3ad36a008
Component: engine
2014-12-12 11:01:46 -08:00
d335495a31 devmapper: Use transactions during device deletion
Use transaction logic during device deletion and do rollback if transaction
is not complete. Following is the sequence of events.

- Open transaction and save to metafile
- Delete device from pool
- Delete device metadata file from disk
- Close Transaction

If docker crashes without closing transaction then rollback will take
place upon next docker start.
 
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 17b75a21a667a27a9a27565ab282cd615dbdb66e
Component: engine
2014-12-03 13:06:43 -05:00
18c76d6b93 devmapper: Use transaction mechanism during device or snap device creation
Finally this patch uses the notion of transaction for device or snapshot
device creation. 

Following is sequence of event.

- Open a trasaction and save details in a file.
- Create a new device/snapshot device
- If a new device id is used, refresh transaction with new device id details.
- Create device metadata file
- Close transaction.

If docker crashes anywhere in between without closing transaction, then
upon next start, docker will figure out that there was a pending transaction
and it will roll back transaction. That is it will do following.

- Delete Device from pool
- Delete device metadata file
- Remove transaction file to mark no transaction is pending.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: c115c4aa45ba82f27859b0afba5724d437857879
Component: engine
2014-12-03 13:06:43 -05:00
f802074502 devmapper: Find a free device Id to use for device creation
Finally, we seem to have all the bits to keep track of all used device
Ids and find a free device Id to use when creating a  new device. Start
using it.

Ideally we should completely move away from retry logic when pool returns
-EEXISTS. For now I have retained that logic and I simply output a warning.
When things are stable, we should be able to get rid of it.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: e28a419e1197bf50bbb378b02f0226c3115edeaa
Component: engine
2014-12-03 13:06:43 -05:00
c3a04ca795 devmapper: Open code createDevice() and createSnapDevice()
Open code createDevice() and createSnapDevice() and move all the logic
in the caller.

This is a sheer code reorganization so that all device Id allocation
logic is in one function. That way in case of erros, one can easily
cleanup and mark device Id free again. (Later patches benefit from
it).

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 14d0dd855ee1e7cd1a3185c3d5a00e7afccb5c43
Component: engine
2014-12-03 13:06:43 -05:00
a3ad44f760 devmapper: Provide a helper function getNextDeviceId()
Right now we are accessing devices.NextDeviceId directly and also 
incrementing it at various places.

Instead provide a helper function which is responsile for
incrementing NextDeviceId and return next deviceId. 

This is just code structuring. This will help later once we
convert this function to find a free device Id and it goes
through a bitmap of used/free device Ids.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: a44c23fe6604d1de59c64bbb9dc234c7c3dbede9
Component: engine
2014-12-03 13:06:43 -05:00
336b3bbd52 devmapper: Construct initial device Id map from device meta files
When docker starts, build a used/free Device Id map from the per
device meta files we already have. These meta files have the data
which device Ids are in use. Parse these files and mark device as
used in the map.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 39dc7829dea87d4be8e6e9b2a598fb354ebf4ba0
Component: engine
2014-12-03 13:06:43 -05:00
622c433bcb devmapper: Keep track of used device Ids in a bitmap
Currently devicemapper backend does not keep track of used device Ids in
the pool. It tries a device Id and if that device Id exists in pool, it
tries with a different Id and keeps on doing this in a loop till it succeeds.

This worked fine so far but now we are moving to transaction based
device creation and deletion. We will keep deviceId information in 
transaction which will be rolled back if docker crashed before transaction
was complete.

If we store a deviceId in transaction and later figure out it already
existed in pool and docker crashed, then we will rollback and remove
that existing device Id from pool (which we should not have).

That means, we should know free device Id in pool in advance before
we put that device Id in transaction.

Hence this patch creates a bitmap (one bit each for a deviceId), and
sets the bit if device Id is used otherwise resets it. This patch
is just preparing the ground right now. Actual usage will follow
in later patches.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Upstream-commit: 4d39e056aac2fadffcb8560101f3c31a2b7db3ae
Component: engine
2014-12-03 13:06:43 -05:00