Commit Graph

133 Commits

Author SHA1 Message Date
b998fced62 plugins: rename DeviceCreation to AllowAllDevices
Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: f265727bdf637c717cd8bdc8675aff4d1714963e
Component: engine
2017-01-10 13:50:30 -08:00
775c5633ef *: use opencontainers/go-digest package
The `digest` data type, used throughout docker for image verification
and identity, has been broken out into `opencontainers/go-digest`. This
PR updates the dependencies and moves uses over to the new type.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
Upstream-commit: 7a855799175b6b984886ef1cfa337d6df1d4c668
Component: engine
2017-01-06 18:48:41 -08:00
cb7b1468a9 Merge pull request #29789 from miaoyq/optimization-error-description
Optimization a error description
Upstream-commit: ef9935ce8f4acf5d53db0a2f9621f9135aed442b
Component: engine
2017-01-03 13:01:22 -08:00
cafa442cac fix "retreive" typo in plugin store
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Upstream-commit: 03bf37884d089b69fd7e05491eff658420f40c5d
Component: engine
2017-01-02 15:01:19 +01:00
aa956c7c5f Optimization a error description
Signed-off-by: Yanqiang Miao <miao.yanqiang@zte.com.cn>
Upstream-commit: 6c021893aa12088c0ad5b18111cfa80d6008a78f
Component: engine
2016-12-30 11:58:39 +08:00
75dc0839ff Fix validation of plugins without rootfs in config
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 6c7cb520094866cacbecb96695aed2d67d8a64a0
Component: engine
2016-12-27 15:36:12 -08:00
396314b106 Fix inspect object by invalid reference
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Upstream-commit: 3cd39aaeab37102e4b12decc0c36042e477e2fa6
Component: engine
2016-12-23 22:57:30 -08:00
478844dff8 Implement content addressability for plugins
Move plugins to shared distribution stack with images.

Create immutable plugin config that matches schema2 requirements.

Ensure data being pushed is same as pulled/created.

Store distribution artifacts in a blobstore.

Run init layer setup for every plugin start.

Fix breakouts from unsafe file accesses.

Add support for `docker plugin install --alias`

Uses normalized references for default names to avoid collisions when using default hosts/tags.

Some refactoring of the plugin manager to support the change, like removing the singleton manager and adding manager config struct.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
Upstream-commit: 3d86b0c79b16334ce5836c0315e4c310b84c2e17
Component: engine
2016-12-23 13:29:58 -08:00
e6fc7a5576 Merge pull request #29599 from anusha-ragunathan/refcount
Enforce zero plugin refcount during disable, not remove.
Upstream-commit: d1dfc1a5ef95dc5621a07915f9786199442043c7
Component: engine
2016-12-22 15:38:54 -08:00
9eac558235 Enforce zero plugin refcount during disable.
When plugins have a positive refcount, they were not allowed to be
removed. However, plugins could still be disabled when volumes
referenced it and containers using them were running.

This change fixes that by enforcing plugin refcount during disable.
A "force" disable option is also added to ignore reference refcounting.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: 8cb2229cd18c53bdbf36301f26db565a50027d6a
Component: engine
2016-12-22 13:26:53 -08:00
efaab09327 Add a GetAll function that returns only managed plugins supported by V2
The current GetAll handles both V2 and legacy plugins. Also due to the
nature of V1 plugins, it also loads them. This causes problems when
loading is not required. Hence adding an independent API that will
return only the plugins that are loaded using v2 mangaed plugins.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
Upstream-commit: 8f1b793528e01004e4a40fe4ef835e235282b2f4
Component: engine
2016-12-22 10:26:04 -08:00
dd179255a2 Fix docker plugin inspect <unkown object> issue on Windows
This fix is a follow up for comment:
https://github.com/docker/docker/pull/29186/files#r91277345

While #29186 addresses the issue of `docker inspect <unknown object>`
on Windows, it actually makes `docker plugin inspect <unknown object>`
out `object not found` on Windows as well. This is actually misleading
as plugin is not supported on Windows.

This fix reverted the change in #29186 while at the same time,
checks `not supported` in `docker inspect <unknown object>` so that
- `docker plugin inspect <unknown object>` returns `not supported` on Windows
- `docker inspect <unknown object>` returns `not found` on Windows

This fix is related to #29186 and #29185.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 0b3c10ac4ddfe3655bac080440a8553269f2307f
Component: engine
2016-12-20 21:05:10 -08:00
8616ae37b9 Merge pull request #29423 from unclejack/api_cli_integ_return
return directly without ifs in remaining packages
Upstream-commit: 21210419447281863f239805ab19248733041a52
Component: engine
2016-12-17 21:30:47 +01:00
c936f080d2 Merge pull request #29462 from vieux/fix_devices_plugins
fix devices in plugins
Upstream-commit: e9d403ab365ce1930e38756bfbf31d1986447387
Component: engine
2016-12-16 08:03:15 +01:00
eff605432a fix devices in plugins
Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: 6f00601c9fb7886547334f80a250bac5e226aad7
Component: engine
2016-12-15 15:35:53 -08:00
b70f98ab3e Make graphdriver plugin use plugin BasePath
Also enables `PropagatedMount` for graphdrivers.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 500210475f6d841b2eacb42fb495e90108db2733
Component: engine
2016-12-15 16:22:13 -05:00
087a421c22 Merge pull request #29372 from tophj-ibm/fix-plugin-disable-error
[plugins] return err when failing remove
Upstream-commit: d0ab04ac1622cd7659e4853414b6c9daa116ffaa
Component: engine
2016-12-15 09:18:35 +01:00
d363742779 return directly without ifs in remaining packages
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
Upstream-commit: 2c187a24e0003f2f0ab90b85876e668f2b6210d4
Component: engine
2016-12-14 23:28:27 +02:00
613c321d34 [plugins] return err when failing remove
Fixes a case where removing the plugin from disk would
fail silently. Also moves pluginStore remove after we
remove from disk, so 'docker plugin ls' doesn't isn't
empty in case it errors out.

Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com>
Upstream-commit: fb11164c4f71315c96ddf3de46ff4689a5bac59c
Component: engine
2016-12-14 15:10:29 -06:00
3159d1f79d Merge pull request #29380 from vieux/skip_empty_network_plugin
skip empty networks in plugin install
Upstream-commit: 738769d23cc69f3185931a1e71b387d0ca09d71d
Component: engine
2016-12-14 11:53:42 -08:00
f541c344f4 Merge pull request #29008 from cpuguy83/refcount_graphdriver
Refcount graphdriver plugins properly
Upstream-commit: af50cefe6cdf07e2028b9ad934a2cb5818a935eb
Component: engine
2016-12-13 19:24:46 -08:00
126764baf1 skip empty networks in plugin install
Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: 04e35a01fcc7292272d688599ed23d829b85f46b
Component: engine
2016-12-13 17:46:01 -08:00
2aa298ba4e Fix issues with plugin and --live-restore
Fixes an issue when starting the daemon with live-restore
where previously it was not set, plugins are not running.

Fixes an issue when starting the daemon with live-restore, the plugin
client (for interacting with the plugins HTTP interface) is not set,
causing a panic when the plugin is called.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: cb6633175c0de0a7ae155c4d378cd2379681554b
Component: engine
2016-12-13 16:11:59 -05:00
d4e814fc0e Merge pull request #29337 from anusha-ragunathan/unmount_enable_err
When plugin enable fails, unmount PropagatedMount.
Upstream-commit: e9076c0f00898e7af05e667d65ecb84a6e15d9c8
Component: engine
2016-12-12 16:02:16 -08:00
5710a52064 When plugin enable fails, unmount PropagatedMount.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: cef443bddf2a185b3afa2f5c7333fd461c87ae74
Component: engine
2016-12-12 13:25:06 -08:00
e31c4556e5 Merge pull request #29230 from vieux/remove_old_media_type_plugin
remove old media type compat for plugins
Upstream-commit: 8de2336f078af8467900e0c6591e5732755733bc
Component: engine
2016-12-12 12:43:32 -08:00
6dcc37964b Refcount graphdriver plugins properly
Adds 2 new methods to v2 plugin `Acquire` and `Release` which allow
refcounting directly at the plugin level instead of just the store.
Since a graphdriver is initialized exactly once, and is really managed
by a separate object, it didn't really seem right to call
`getter.Get()` to refcount graphdriver plugins.
On shutdown it was particularly weird where we'd either need to keep a
driver reference in daemon, or keep a reference to the pluggin getter in
the layer store, and even then still store extra details on if the
graphdriver is a plugin or not.

Instead the plugin proxy itself will handle calling the neccessary
refcounting methods directly on the plugin object.

Also adds a new interface in `plugingetter` to account for these new
functions which are not going to be implemented by v1 plugins.

Changes terms `plugingetter.CREATE` and `plugingetter.REMOVE` to
`ACQUIRE` and `RELEASE` respectively, which seems to be better
adjectives for what we're doing.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: f29bbd16f5d2bb82d815ea59f8ef85fe59384c89
Component: engine
2016-12-09 19:46:28 -05:00
6b1a2692bb Merge pull request #26398 from tiborvass/plugin-fixes
plugins: container-rootfs-relative paths
Upstream-commit: 0a072e93df6ad10e37bbf0b1f540fff7b7581a75
Component: engine
2016-12-09 12:48:59 -08:00
482b3af442 Merge pull request #29281 from anusha-ragunathan/fix_race
Fix race in setting plugin refcounts.
Upstream-commit: 86a0de7fa9fe34d29cffc8fcffe0b81b0db78a87
Component: engine
2016-12-09 12:47:39 -08:00
656f60dc73 plugins: container-rootfs-relative paths
Legacy plugins expect host-relative paths (such as for Volume.Mount).
However, a containerized plugin cannot respond with a host-relative
path. Therefore, this commit modifies new volume plugins' paths in Mount
and List to prepend the container's rootfs path.

This introduces a new PropagatedMount field in the Plugin Config.
When it is set for volume plugins, RootfsPropagation is set to rshared
and the path specified by PropagatedMount is bind-mounted with rshared
prior to launching the container. This is so that the daemon code can
access the paths returned by the plugin from the host mount namespace.

Signed-off-by: Tibor Vass <tibor@docker.com>
Upstream-commit: c54b717caf1a55e525ce180bfcb42addd59c6633
Component: engine
2016-12-09 10:16:24 -08:00
955998db83 Fix race in setting plugin refcounts.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: 4c088d1e2ebfcc384a365734017988f4fd1c4605
Component: engine
2016-12-09 09:34:30 -08:00
5b4ba9313b Merge pull request #28949 from yongtang/28717-docker-plugin-create
Use GetByName to check for collision before create any context in plugin creation
Upstream-commit: 9d884986f5c001cacb60aa3c50036575ed2dd22d
Component: engine
2016-12-09 09:12:08 -08:00
d377a823f5 Merge pull request #29244 from yuexiao-wang/fix-typos-eg
Fix a bit typos
Upstream-commit: d1515a5264e7872bfe11543b2b23b4f1eac23f68
Component: engine
2016-12-09 16:03:35 +09:00
aacf384e2f Merge pull request #28459 from dmcgowan/plugin-repository-pinning
Plugin repository pinning
Upstream-commit: c1a1b381f91367afa94a69649d9aa808acecc8ac
Component: engine
2016-12-08 11:28:52 -08:00
795fc21c8b Fix a bit typos
Signed-off-by: yuexiao-wang <wang.yuexiao@zte.com.cn>
Upstream-commit: 11454e1c97ed5495e77a06868a0c199d81aa96c3
Component: engine
2016-12-09 03:05:11 +08:00
a09c35f1e8 Merge pull request #29191 from anusha-ragunathan/plugin_races
Make v2/Plugin accesses safe.
Upstream-commit: 9d898b872ebe953cab1b60366253f1a9210764cc
Component: engine
2016-12-07 17:52:44 -08:00
c7e69feeb2 remove old media type compat for plugins
Signed-off-by: Victor Vieux <vieux@docker.com>
Upstream-commit: f644e758bd58f7b045a52b29038ae0043b0c9e3d
Component: engine
2016-12-07 17:35:09 -08:00
3889503c60 Make v2/Plugin accesses safe.
v2/Plugin struct had fields that were
- purely used by the manager.
- unsafely exposed without proper locking.
This change fixes this, by moving relevant fields to the manager as well
as making remaining fields as private and providing proper accessors for
them.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: b35490a8ba2ad70a585c1ba8109b6d87aece8daa
Component: engine
2016-12-06 13:23:41 -08:00
37fb30ac29 Fix docker inspect <unkown object> issue on Windows
This fix tries to address the issue raised on 29185 where
`docker inspect <unknown object>` on Windows will return:
```
Error response from daemon: plugins are not supported on this platform
```

The reason was that in case `--type` is not specified, `docker inspect`
will iterate through different types `container`, `image`, `network`,
`plugin` etc. The `plugin` object is the last type to check.

However, as `plugin` is not supported on Windows yet, the error message
is not very informative for `plugins are not supported on this platform`.

This fix tries to fix the issue by return a `not found` error on unsupported
platforms as well.

An integration test has been added to cover the changes for Windows/Linux.

This fix fixes 29185.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 88fcdb0a825da040ef2b1f9c191af480f0f2cc90
Component: engine
2016-12-06 12:05:59 -08:00
3c2896d350 Merge pull request #28963 from vieux/refactor_plugin_install
refactor plugin install
Upstream-commit: 1c96879f1e99efc881aaa3480bc6aab18d233475
Component: engine
2016-12-05 12:00:29 -08:00
a9f58f81fd refactor plugin install
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
Upstream-commit: fa3b61a28f55d84afbbb978785ce9632123d12fa
Component: engine
2016-12-02 15:23:08 -08:00
8d0b8ac112 Support plugins in docker inspect
This fix tries to address the proposal raised in 28946
to support plugins in `docker inspect`.

The command `docker inspect` already supports
"container", "image", "node", "network", "service", "volume", "task".
However, `--type plugin` is not supported yet at the moment.

This fix address this issue by adding the support of `--type plugin`
for `docker inspect`.

An additional integration test has been added to cover the changes.

This fix fixes 28946.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 90bb2cdb9f15a9b1b9a4e2ea4242882665daac4e
Component: engine
2016-12-02 11:33:29 -08:00
2ac57c6dcf Allow docker plugin inspect to search based on ID or name
This fix tries to address the issue raised in discussion of
PR 28735 where it was not possible to manage plugin based on
plugin ID. Previously it was not possible to invoke
`docker plugin inspect` with a plugin ID (or ID prefix).

This fix updates the implementation of `docker plugin inspect`
so that it is possbile to search based on a plugin name, or a
plugin ID. A short format of plugin ID (prefix) is also possible,
as long as there is no ambiguity.

Previously the check of `docker plugin inspect` was mostly done
on the client side. This could potentially cause inconsistency
between API and CMD. This fix move all the checks to daemon side
so that API and CMD will be consistent.

An integration test has been added to cover the changes.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 0ce6e070f7d1e4b1b478d52b4464f8480dbfd9b7
Component: engine
2016-12-01 10:44:17 -08:00
cb6219042e Use GetByName to check for collision before create any context in plugin creation
This fix is a follow up to the comment:
https://github.com/docker/docker/pull/28717#discussion_r90040589

Currently, the collision checking is done at the last step `Add()` of
plugin creation. However, at this stage the context such as plugin
directories have already been creation. In case of name collision,
rollback is needed which could be expensive.

This fix performs the check at the beginning of CreateFromContext using
GetByName. In this way, collision fails fast and no context creation
or rollback is needed.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 52405a9b5896fd1c3ea6d8b1ca1c70e5979e3271
Component: engine
2016-11-29 14:18:01 -08:00
7517d3b3a5 Merge pull request #28717 from yongtang/28684-duplicate-docker-plugin-create
Fix issue caused by duplicate `docker plugin create` with same names
Upstream-commit: 82b35dd997f46ff430cb084c962089c40f5bc96a
Component: engine
2016-11-29 08:22:40 -08:00
8b9cbd5ed5 Merge pull request #28893 from anusha-ragunathan/delete_onerr
On plugin pull errors, delete created dirs.
Upstream-commit: c1b0f23de0953e3d36cdd3b510cf6da4ebea6f76
Component: engine
2016-11-29 14:48:27 +01:00
fbf2916db8 On plugin pull errors, delete created dirs.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: 9e4234261c3e4d13f98218a97d7cc6644723e310
Component: engine
2016-11-28 16:57:27 -08:00
c7fce8b04c Fix issue with plugin exit.
A plugin has an `ExitChan` channel which is used to signal the exit of
the plugin process. In a recent change, the initialization was
incorrectly moved to the daemon Shutdown path.

Fix this by initializing the channel during plugin enable.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
Upstream-commit: 890a98ceed982454515f5b089d9772fc1e4eb6e0
Component: engine
2016-11-28 12:48:56 -08:00
c06179cb55 Fix issue caused by duplicate docker plugin create with same names
This fix tries to fix the issue raised in 28684:
1. Duplicate plugin create with the same name will override the old plugin reference
2. In case an error happens in the middle of the plugin creation, plugin directories
   in `/var/lib/docker/plugins` are not cleaned up.

This fix update the plugin store so that `Add()` will return an error if a plugin
with the same name already exist.

This fix also will clean up the directory in `/var/lib/docker/plugins` in case
an error happens in the middle of the plugin creation.

This fix fixes 28684.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: 662d456928e47162a3af5931356cb05b6a3f9918
Component: engine
2016-11-28 12:37:49 -08:00
e746d79ff3 Merge pull request #28601 from tiborvass/plugin-misc-fixes
Plugin miscellaneous fixes
Upstream-commit: 23ea9e45fd6281e82c389e6112457a7bb70f8d89
Component: engine
2016-11-22 16:12:37 -08:00