Commit Graph

12 Commits

Author SHA1 Message Date
Yong Tang 0ce6e070f7 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>
2016-12-01 10:44:17 -08:00
Yong Tang 662d456928 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>
2016-11-28 12:37:49 -08:00
Tibor Vass 84e58e2f89 plugins: do not try to contact disabled plugin
Signed-off-by: Tibor Vass <tibor@docker.com>
2016-11-21 14:52:14 -08:00
Victor Vieux 34f4b197b8 prevent plugin when volume plugin is disabled
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-10-31 17:59:45 -07:00
Anusha Ragunathan 4db753c017 Fix stack overflow in ErrInAdequateCapacity.
fmt package formats an error by calling its Error() method.
This results in recursion. Fix this. Also remove dead code.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-10-28 10:02:48 -07:00
Kenfe-Mickael Laventure 7781a1bf0f Make experimental a runtime flag
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-10-24 15:20:01 -07:00
Anusha Ragunathan a98be0344b Update plugingetter import path in docker/docker.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-10-11 11:24:18 -07:00
Anusha Ragunathan b3bd7f80af Add Handle method to plugingetter.
This is necessary for IPAM and network plugins.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-09-26 11:06:26 -07:00
Anusha Ragunathan fefea805e9 Make graphdrivers work with pluginv2.
As part of making graphdrivers support pluginv2, a PluginGetter
interface was necessary for cleaner separation and avoiding import
cycles.

This commit creates a PluginGetter interface and makes pluginStore
implement it. Then the pluginStore object is created in the daemon
(rather than by the plugin manager) and passed to plugin init as
well as to the different subsystems (eg. graphdrivers, volumedrivers).
A side effect of this change was that some code was moved out of
experimental. This is good, since plugin support will be stable soon.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-09-20 08:49:48 -07:00
Victor Vieux b22d07f515 add check plugin is not used before rm
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-09-15 13:50:57 -07:00
Anusha Ragunathan 17b8aba1d9 Adding pluginv2 support for libnetwork (part 1)
Legacy plugins (aka pluginv1) calls in libnetwork are replaced with
calls using the new plugin model (aka pluginv2). pkg/plugins is still
used for managing the http client connections to the plugin.

This commit makes the necessary changes in docker/docker. Part 2 will
will take care of the libnetwork changes.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-09-06 14:30:55 -07:00
Anusha Ragunathan 27a55fba28 Reorganize plugin package into sub packages.
Split plugin package into `store` and `v2/plugin`. Now the functionality
is clearly delineated:
- Manager: Manages the global state of the plugin sub-system.
- PluginStore: Manages a collection of plugins (in memory and on-disk)
- Plugin: Manages the single plugin unit.

This also facilitates splitting the global PluginManager lock into:
- PluginManager lock to protect global states.
- PluginStore lock to protect store states.
- Plugin lock to protect individual plugin states.

Importing "github.com/docker/docker/plugin/store" will provide access
to plugins and has lesser dependencies when compared to importing the
original monolithic `plugin package`.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-08-27 11:08:08 -07:00