Commit graph

163 commits

Author SHA1 Message Date
Phil Estes
48b1dd0084 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>
2015-01-16 14:43:43 -05:00
Jessica Frazelle
f88066fd43 ignore vfs from warning
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2015-01-14 17:28:50 -08:00
Alexander Morozov
bb96e53b0f Fix vet error about passing Mutex by value
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-01-14 14:03:00 -08:00
unclejack
044d979f4e Merge pull request #10003 from vbatts/vbatts-dm_loop_file_info
devmapper: show device and loop file , if used
2015-01-14 01:15:09 +02:00
Michael Crosby
16fe2ac6b2 Merge pull request #9988 from nponeccop/patch-1
FsMagic should avoid sign extension on i686
2015-01-12 12:02:09 -08:00
Alexander Morozov
83ab6237ac Merge pull request #10047 from vbatts/vbatts-graphdriver_driver_put_with_error
graphdriver: change (*Driver).Put signature
2015-01-12 11:42:11 -08:00
Vincent Batts
2b51d1a167 devmapper: remove newline string
Signed-off-by: Vincent Batts <vbatts@redhat.com>
2015-01-12 13:40:42 -05:00
Vincent Batts
00fd63e558 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>
2015-01-12 13:34:35 -05:00
Vincent Batts
09c033ff87 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>
2015-01-09 11:20:07 -05:00
nponeccop
c754555b87 FsMagic should avoid sign extension on i686
`uint64(buf.Type)` on i686 is ffffffff9123683e on i686 due to sign extension, so it cannot be compared with `FsMagic(0x9123683E)`

Signed-off-by: Andrii Melnykov <andy.melnikov@gmail.com>
2015-01-09 02:44:04 +02:00
Michael Crosby
6d780139c4 Merge pull request #8748 from duglin/Issue8330
Have .dockerignore support Dockerfile/.dockerignore
2015-01-06 13:47:42 -08:00
Michael Crosby
9d1caf4272 Merge pull request #9834 from jfrazelle/9820-overlay-btrfs
Add error when running overlay over btrfs.
2015-01-06 13:16:17 -08:00
Jessica Frazelle
32f1025b22 Add error when running overlay over btrfs.
Docker-DCO-1.1-Signed-off-by: Jessica Frazelle <jess@docker.com> (github: jfrazelle)
2015-01-06 11:22:45 -08:00
Doug Davis
6d801a3caa Have .dockerignore support Dockerfile/.dockerignore
If .dockerignore mentions either then the client will send them to the
daemon but the daemon will erase them after the Dockerfile has been parsed
to simulate them never being sent in the first place.

an events test kept failing for me so I tried to fix that too

Closes #8330

Signed-off-by: Doug Davis <dug@us.ibm.com>
2015-01-06 10:57:48 -08:00
Jessie Frazelle
e404113afc Merge pull request #9908 from crosbymichael/warning-graphdriver
Add warning log when high priority graphdriver used before
2015-01-05 12:06:28 -08:00
Michael Crosby
3011aa4e99 Remove error return from check graph driver func
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-01-05 10:34:49 -08:00
Derek
9bbed5ab4c 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>
2015-01-04 00:10:48 +00:00
daehyeok mun
3c03827e73 Add warnning log when other graphdrvier(storage driver) used before
added warnning log when other graphdrvier(storage driver) used before for feature request #8270

Signed-off-by: Daehyeok Mun <daehyeok@gmail.com>
2015-01-02 00:01:26 +09:00
Pierre Wacrenier
c1e04fbb15 Remove unused function from vfs storage driver
Signed-off-by: Pierre Wacrenier <pierre.wacrenier@gmail.com>
2014-12-23 00:36:20 +01:00
Michael Crosby
2acb856dff 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
2014-12-18 18:33:01 -08:00
Josh Hawn
35a22c9e12 Refactor to optimize storage driver ApplyDiff()
To avoid an expensive call to archive.ChangesDirs() which walks two directory
trees and compares every entry, archive.ApplyLayer() has been extended to
also return the size of the layer changes.

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
2014-12-17 21:54:23 -08:00
Alexander Morozov
c7ff6bf691 Fix vet errors about json tags for unexported fields
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2014-12-12 11:01:46 -08:00
Alexander Morozov
2540765ddc Fix vet errors in aufs.go about Lock by value
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2014-12-12 10:46:09 -08:00
Vincent Batts
74bbb93571 Merge pull request #9258 from rhvgoyal/transaction-id-improvements
devmapper fix usage of pool transaction id
2014-12-11 12:58:18 -05:00
Michael Crosby
f47d6b9b9d Use consistent ApplyLayer in overlayfs
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2014-12-04 12:03:44 -08:00
Vivek Goyal
17b75a21a6 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>
2014-12-03 13:06:43 -05:00
Vivek Goyal
c115c4aa45 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>
2014-12-03 13:06:43 -05:00
Vivek Goyal
e28a419e11 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>
2014-12-03 13:06:43 -05:00
Vivek Goyal
14d0dd855e 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>
2014-12-03 13:06:43 -05:00
Vivek Goyal
a44c23fe66 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>
2014-12-03 13:06:43 -05:00
Vivek Goyal
39dc7829de 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>
2014-12-03 13:06:43 -05:00
Vivek Goyal
4d39e056aa 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>
2014-12-03 13:06:43 -05:00
Vivek Goyal
359a38b26a devmapper: Use a common delete function for all device deletion operation
Right now setupBaseImage() uses deleteDevice() to delete uninitialized
base image while rest of the code uses DeleteDevice(). Change it and
use a common function everywhere for the sake of uniformity.

I can't see what harm can be done by doing little extra locking done
by DeleteDevice().

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
f078bcd8e5 devmapper: Rename NewTransactionId to OpenTransactionId
Very soon we will have the notion of an open transaction and keep its
details in a metafile.

When a new transaction is opened, we allocate a new transaction Id, 
do the device creation/deletion and then we will close the transaction.

I thought that OpenTransactionId better represents the semantics of
transaction Id associated with an open transaction instead of NewtransactionId.

This patch just does the renaming. No functionality change.

I have also introduced a structure "Transaction" which will keep all
the details associated with a transaction. Later patches will add more
fields in this structure.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
7b0a1b814b devmapper: Allocate new transaction Id using current transaction Id
Currently new transaction Id is created using allocateTransactionId()
function. This function takes NewTransactionId and bumps up by one 
to create NewTransactionId.

I think ideally we should be bumping up devices.TransactionId by 1
to come up with NewTransactionId. Because idea is that devices.TransactionId
contains the current pool transaction Id and to come up with a new
transaction Id bump it up by one.

Current code is not wrong as we are keeping NewTransactionId and
TransactionId in sync. But it will be more direct if we look at
devices.TransactionId to come up with NewTransactionId. That way
we don't have to even initialize NewTransactionId during startup
as first time somebody wants to do a transaction, it will be
allocated fresh.

So simplify the code a bit. No functionality change.
 
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
6d347aeb69 devmapper: Remove unnecessary condition check in updatePoolTransactionId()
Currently updatePoolTransactionId() checks if NewTransactionId and
TransactionId are not same only then update the transaction Id in pool. This
check is redundant. Currently we call updatePoolTransactionId() only from
two places and both of these first allocate a new transaction Id.

Also updatePoolTransactionId() should only be called after allocating
new transaction Id otherwise it does not make any sense.

Remove the redundant check and reduce confusion.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
ad9118c696 devmapper: Create new helper function for device and snap creation
Create two new helper functions for device and snap device creation. These
functions will not only create the device and also register the device.

Again, makes the code structure better and keeps all transaction logic
contained to functions instead of spilling over into functions like
setupBaseImage or AddDevice().

Just the code reorganization. No functionality change.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
442247927b devmapper: Provide a function unregisterDevice()
Currently registerDevice() adds a device to in-memory table, saves metadata
and also updates the pool transaction ID.

Now move transaciton Id update out of registerDevice() and provide a new
function unregisterDevice() which does the reverse of registerDevice().
This will simplify some code down the line and make it more structured.

This is just code reorganization and should not change functionality.
 
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
7b2b15d3e9 devmapper: Use device id as specified by caller
Currently devicemapper CreateDevice and CreateSnapDevice keep on retrying
device creation till a suitable device id is found. 

With new transaction mechanism we need to store device id in transaction
before it has been created.

So change the logic in such a way that caller decides the devices Id to
use. If that device Id is not available, caller bumps up the device Id
and retries.

That way caller can update transaciton too when it tries a new Id. Transaction
related patches will come later in the series.
  
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
5be77901cd devmapper: Do not add back device into hash map if meta file removal failed
When we are deleting a device, we also delete associated metadata file. If
that file removal fails, we are adding back the device in in-memory
table. I really can't see what's the point. When next lookup takes place
it will be automatically loaded if need be. Remove that code.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
824a87f7ef devmapper: Move pool id query and migration of old data in separate function
Right now initMetaData() first queries the pool for current transaciton Id
and then it migrates the old metafile.

Move pool transaction Id query and file migration in separate functions
for better code reuse and organization.

Given we have removed device transaction Id dependency from saveMetaData(),
we don't have to query pool transaction Id before migrating files.
 
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
0db6cc85ed devmapper: Remove transaction Id update from saveMetaData()
Right now saveMetaData() is kind of little overloaded function. It is
supposed to save file metadata to disk. But in addition if user has
bumped up NewTransactionId before calling saveMetaData(), then it will
also update the transaction ID in pool.

Keep saveMetaData() simple and let it just save the file. Any update
of pool transaction ID is done inline in the code which needs it.

Also create an helper function updatePoolTransactionId() to update pool
transaction Id.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
004d8b9b33 devmapper: Remove unnecessary call to allocateTransactionId() during device removal
Remove call to allocateTransactionId() during device removal. This seems to
be unnecessary and it is not clear what this call is doing.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
b721d6d8d0 devmapper: Do not check for transaction id during device metadata loading
Again, just because device transaction id is greater than pool transaction
id, it does not guarantee that device is in the pool. So do not check
of this during loading of device metadata.

Docker needs to deal with it. And device activation will fail when we try
to activate a device for whom metafile is present but there is no device
in the pool.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Vivek Goyal
bb00453e58 devmapper: Do not check for pool transaction id during old metadata migration
Current code is associating a transaction id with each device and if pool
transaction id is greater that value, then current code assumes that device
is there in pool.

Transaction id of pool is a mechanism so that during device creation and
removal one can define a transaction and during startup figure out if
transaction was complete or not. I think we are using transaction id 
throughout the code little inappropriately.

For example, if a device is being deleted, it is possible that we deleted
the device from pool but before we could delete metafile docker crashed.
When docker comes back it will think that device is in the pool (due to
device transaction id being less than pool transaction id) but device
is not in the pool.

Similary, it could happen that some data in the pool is corrupted and
during pool repair some devices are lost (without docker knowing about
it). In that case tool pool transaction id will be higher than device
transaction id and there are no guaratees that device is actually in
the pool.

So move away from this model where we think that a device is in pool if pool
transaction id is greater than device transaction Id. Per device
transaction Id just says that after device creation this should be pool's
transaction Id and nothing more.

Transaction id is per pool property (as opposed to per device property) and
will be used internally to figure out if last transaction was complete or
not and recover from failure during docker startup.  

If for some reason metafile is present but device is not in pool, then 
device activation will fail later.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2014-12-03 13:06:43 -05:00
Lénaïc Huard
2352f00e4f Remove the last references to overlayfs
This only renames docker internal structures.
It has no impact on the end-user.

Signed-off-by: Lénaïc Huard <lhuard@amadeus.com>
2014-12-03 14:06:19 +01:00
Lénaïc Huard
d680ca5c96 Rename the overlay storage driver
so that docker is started with `docker -d -s overlay` instead of `docker -d -s overlayfs`

Signed-off-by: Lénaïc Huard <lhuard@amadeus.com>
2014-12-03 13:57:23 +01:00
Lénaïc Huard
c57317893a Rename overlayfs to overlay
Since Linux 3.18-rc6, overlayfs has been renamed overlay.

This change was introduced by the following commit in linux.git:
ef94b1864d1ed5be54376404bb23d22ed0481feb ovl: rename filesystem type to "overlay"

Signed-off-by: Lénaïc Huard <lhuard@amadeus.com>
2014-12-02 10:02:59 +01:00
Vincent Batts
b47ff77b5c Merge pull request #9006 from snitm/thin-pool-improvements
Thin pool improvements
2014-11-26 14:44:09 -05:00
Tatsushi Inagaki
82a5cd0d37 Fix to avoid a compilation error of size_test.go with GCCGO due to float to int truncation
Signed-off-by: Tatsushi Inagaki <e29253@jp.ibm.com>
2014-11-25 18:12:22 +09:00