Commit Graph

10981 Commits

Author SHA1 Message Date
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
b4dc28ba46 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>
Upstream-commit: 359a38b26a164f430c79fe542babb77c6e48dcc3
Component: engine
2014-12-03 13:06:43 -05:00
63f43eb974 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>
Upstream-commit: f078bcd8e50913fd8b05022ebd047c5a1f2e3d52
Component: engine
2014-12-03 13:06:43 -05:00
d225e227dc 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>
Upstream-commit: 7b0a1b814b8f13e30df466dd66c3fdc2114eac28
Component: engine
2014-12-03 13:06:43 -05:00
f0bbf70516 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>
Upstream-commit: 6d347aeb6984ebdcb1051212ab3103880ef69ab0
Component: engine
2014-12-03 13:06:43 -05:00
9318108e88 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>
Upstream-commit: ad9118c696c0953ec48eec15ea4b7546296d7c20
Component: engine
2014-12-03 13:06:43 -05:00
67ef59131f 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>
Upstream-commit: 442247927b8e6c102ce1f94de58c7f93aab3d271
Component: engine
2014-12-03 13:06:43 -05:00
eb11479882 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>
Upstream-commit: 7b2b15d3e9f9b7ad898a36bbe5ceb42c9ca58d47
Component: engine
2014-12-03 13:06:43 -05:00
a7eaca43b5 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>
Upstream-commit: 5be77901cd505aad002b912b5febe2ba6baa23fd
Component: engine
2014-12-03 13:06:43 -05:00
4071b33d53 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>
Upstream-commit: 824a87f7efb94e4f307d920c3c3689156d6e633f
Component: engine
2014-12-03 13:06:43 -05:00
f0d19de5f9 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>
Upstream-commit: 0db6cc85edfccb16ce5308eea767530e1a3f6906
Component: engine
2014-12-03 13:06:43 -05:00
48849bb96c 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>
Upstream-commit: 004d8b9b337f4a6cf68c124e89e02e673c6320fc
Component: engine
2014-12-03 13:06:43 -05:00
9846ed5485 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>
Upstream-commit: b721d6d8d0313fbb4b80e12318c96fc4004ee96b
Component: engine
2014-12-03 13:06:43 -05:00
65d86e4b8e 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>
Upstream-commit: bb00453e58a86b9787ac4b3e7df3c48d8ddc3f87
Component: engine
2014-12-03 13:06:43 -05:00
a62f6a9d69 Merge pull request #9429 from sindhus/patch-1
Fix dead link in oracle.md
Upstream-commit: 70c4b4ededd5bfe2f67c7a0c687c80bd45fa2fba
Component: engine
2014-12-03 12:38:17 +10:00
2de1f2dd9b Merge pull request #9430 from sindhus/patch-3
Fix dead link cli.md
Upstream-commit: 315520b8453d4d0d8cf6e3651a06804dc47a8736
Component: engine
2014-12-02 16:06:48 -08:00
d8a6cab65d Merge pull request #9463 from jlhawn/tarsum_test_fix
Fix TarSum iteration test
Upstream-commit: bc7ef42716ba8574845b1f172a363930831ab9e0
Component: engine
2014-12-02 15:55:07 -08:00
efbc3f4d55 Fix TarSum iteration test
I noticed that 3 of the tarsum test cases had expected a tarsum with
a sha256 hash of
  e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
As I've been working with sha256 quite a bit lately, it struck me that
this is the initial digest value for sha256, which means that no data
was processed. However, these tests *do* process data. It turns out that
there was a bug in the test handling code which did not wait for tarsum
to end completely. This patch corrects these test cases.

I'm unaware of anywhere else in the code base where this would be an issue,
though we definitily need to look out in the future to ensure we are
completing tarsum reads (waiting for EOF).

Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn)
Upstream-commit: 8d9e25dbddc189f4094e0f25a90f2b8a25deec9d
Component: engine
2014-12-02 15:28:13 -08:00
c7729a9005 Merge pull request #9460 from shin-/docs_webhooks2
Webhooks documentation: additional improvements
Upstream-commit: 1e81a69618ea0c393ae80e52fcc0f446d462bd3e
Component: engine
2014-12-02 17:42:26 -05:00
d3e367d06e Merge pull request #9273 from programmerq/dockerimages_hub
refer to the registry instead of the hub
Upstream-commit: 6a98ce2fc0f26730b9aa07a589806939d42c41f5
Component: engine
2014-12-02 17:15:04 -05:00
9cfd075a8d Webhooks documentation: second pass addressing @fredlf's comments
Signed-off-by: Joffrey F <joffrey@docker.com>
Upstream-commit: bcef3535579b2e9a8f672626dd014b77ed44c5c0
Component: engine
2014-12-02 13:49:17 -08:00
dd2a47a55c Merge pull request #9457 from icecrime/engine_logf
Remove unused Engine.Logf method
Upstream-commit: 906c7211e6965a29b538e93af3ade981000dff98
Component: engine
2014-12-02 12:17:11 -08:00
dabbee5901 Remove unused Engine.Logf
The `Engine.Logf` method was unused and confusing.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Upstream-commit: 59da197de8f040eed7560747476f97ce8afad293
Component: engine
2014-12-02 10:47:57 -08:00
fdf7191cae Merge pull request #9435 from cpuguy83/9414_fix_exec_api_error_no_cmd
Check for no `Cmd` on exec create endpoint
Upstream-commit: 50445e4d0c622837f1dd9bd5b3810d3b309b7d18
Component: engine
2014-12-02 10:28:44 -08:00
b775e7f418 Merge pull request #9441 from LK4D4/retry_any_error_on_portmap
Try other port on any error from Map
Upstream-commit: e40bbf3b9a408b3e51e837ca1828237f860011b9
Component: engine
2014-12-02 09:51:50 -08:00
624402f332 Update dockerimages.md
remove 'public registry'

Signed-off-by: Jeff Anderson <jeff@docker.com>
Upstream-commit: 46437d1a60278d1acfe32412f69b3c22749becf2
Component: engine
2014-12-02 10:48:39 -07:00
958b540000 Merge pull request #9442 from icecrime/8658-tls_attach_hangs
Fix client-side HTTP hijacking over TLS
Upstream-commit: 5ec3a038a05116e3b3983d3271ada74408fee0e3
Component: engine
2014-12-02 09:47:29 -08:00
c0a5d7486b Fix client-side HTTP hijacking over TLS
Properly CloseWrite() the client socket once done with stdin when using
TLS connection (this used to rely on an erroneous type assertion).

Fixes #8658.
Fixes #8642.

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Signed-off-by: Michael Crosby <crosby.michael@gmail.com>
Upstream-commit: e98e56bb1edc3835bc835c9e034780845c64d797
Component: engine
2014-12-01 18:13:52 -08:00
3e14694b93 Merge pull request #9330 from TomasTomecek/master
docs: man docker-images: inconsistent naming
Upstream-commit: b487d2f2ff9562301c1e9a1e705876ff3e3f3c10
Component: engine
2014-12-02 11:42:29 +10:00
bf624ce4b1 Merge pull request #9431 from sindhus/patch-4
Fix dead link build.md
Upstream-commit: b241571102f245a8d526620598930fc53c126070
Component: engine
2014-12-01 20:29:48 -05:00
70cf9e5532 Merge pull request #9425 from HuKeping/master
inspect: format the output of docker inspect
Upstream-commit: 65e75998afc53eacdac8784434dd1a7baa92be70
Component: engine
2014-12-01 16:51:47 -08:00
9254581bd3 Try other port on any error from Map
Sometimes other programs can bind on ports from our range, so we just
skip this ports on allocation.

Fixes #9293
Probably fixes #8714

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Upstream-commit: a00a1a1fca020d21cb677439160e018bda5c3835
Component: engine
2014-12-01 16:26:30 -08:00
67d69faf00 Check for no Cmd on exec create endpoint
Fixes #9414

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: c8a3d31332074ddc226086ff1f0c042b6e120232
Component: engine
2014-12-01 17:54:15 -05:00
d061fa172b Merge pull request #9438 from crosbymichael/label-std-mounts
Label std mounts
Upstream-commit: bdaf562b4c23feda1f8e790ad456d9bbf982e0af
Component: engine
2014-12-01 14:37:42 -08:00
8eef20faf0 Merge pull request #9439 from blakery/master
Cleanup: remove obsolete workaround
Upstream-commit: 92c840c87de759411229e3d1ace9f8a41cba83dc
Component: engine
2014-12-01 13:14:47 -08:00
e178f59d16 Label standard mounts within loop
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Upstream-commit: 305e9cd2fab974c38064a1acd2ef1f552a3a1357
Component: engine
2014-12-01 14:54:14 -05:00
e1900eef38 Merge pull request #9407 from hqhq/hq_fix_comments
flag: fix the comments
Upstream-commit: 42522d29c7351d960e2346f1e19e0ac6f7ce7ad5
Component: engine
2014-12-01 11:27:06 -08:00
667cbd6ea9 Merge pull request #9424 from irachex/pprof_block
Attach goroutine blocking profiler
Upstream-commit: 2df1365819c061936efb0b3d1afa3cc623216d64
Component: engine
2014-12-01 11:13:05 -08:00
539a7bfbcc Merge pull request #9378 from LK4D4/change_breakout_detection
Change symlink breakout detection logic in archive package
Upstream-commit: 8ddb42fbfd692a9888c1e8e9ebacefed62e123ef
Component: engine
2014-12-01 19:23:18 +02:00
9bbfd296f7 remove obsolete workaround
Signed-off-by: Blake Geno <blakegeno@gmail.com>
Upstream-commit: 9200fdd197f7c80c495597104928596516b36f41
Component: engine
2014-12-01 11:44:13 -05:00
8985d88694 Fix dead link build.md
Upstream-commit: 7754ef1f064be08419bf397e2ea7e4ce99bdf90d
Component: engine
2014-12-01 19:35:58 +05:30
81cd0946d7 Fix dead link cli.md
Upstream-commit: b1dc0db56ac9a27d51ab2a3684ed398d7b80a80c
Component: engine
2014-12-01 19:28:02 +05:30
71ee90ecd5 Fix dead link in oracle.md
Upstream-commit: ffda2035e5a9e6a723c4c84cd5f88c5f4a9dc2ba
Component: engine
2014-12-01 19:07:04 +05:30
cc225fbb9e Attach goroutine blocking profiler
/debug/pprof/block is 404 currently

Signed-off-by: Huayi Zhang <irachex@gmail.com>
Upstream-commit: 51172493ab6d2b31760b9fe273c7d4d0917a9bb7
Component: engine
2014-12-01 16:46:59 +08:00
a5fafedf3b inspect: format the output of docker inspect
Prior to this patch, one would get the output of docker inspect xxx
as below:

user@server:/mnt$ docker inspect ubuntu
[{
    "Architecture": "amd64",

    ...

    "VirtualSize": 199257566
}
]user@server:/mnt$

The last ']' was on the same line with the prompt, i wonder if it is
really what we want it be, it is a little weird, so i add a '\n' to it.

Signed-off-by: Hu Keping <hukeping@huawei.com>
Upstream-commit: 921346be48d20a66b2b5763144b064395285bb32
Component: engine
2014-12-01 16:28:08 +08:00
65d8f4630e Fixes #9418 Docker Registry now open source
Signed-off-by: Neal McBurnett <neal@mcburnett.org>
Upstream-commit: 4bf72613fed9424356e2146d795ddbfa825befa4
Component: engine
2014-11-30 21:12:57 -07:00
0ed56d2477 Merge pull request #9194 from flavio/update_installation_docs
Update installation docs
Upstream-commit: 595cd5279e90f1225eb015708b3db5e2e8766c0f
Component: engine
2014-12-01 13:18:12 +10:00
7ad93db024 Cover openSUSE and SUSE Linux Enterprise on the same page
Updated the documentation to cover the installation of Docker on
openSUSE and on SUSE Linux Enterprise.

Docker-DCO-1.1-Signed-off-by: Flavio Castelli <fcastelli@suse.com> (github: flavio)
Upstream-commit: 47d8ec0a42ce2cd71a0275665f2e7d74a5a56cbf
Component: engine
2014-12-01 01:23:38 +01:00
50bc44d6da Correct inaccuracy in docker pull documentation
Signed-off-by: Alexander Boyd <alex@opengroove.org>
Upstream-commit: eb8e84c48a8a20895b78299dbc2d8429d092be8d
Component: engine
2014-11-29 23:36:19 -07:00
86e291ef5c flag: fix the comments
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Upstream-commit: 9cc73c62e6779bf2c8eefc4192c017a2c73daf40
Component: engine
2014-11-30 01:58:16 +08:00