Commit graph

274 commits

Author SHA1 Message Date
Anusha Ragunathan
1144f8f1d4 Cleanup after plugin install.
During error cases, we dont cleanup correctly. This commit takes care
of removing the plugin, if there are errors after the pull passed. It
also shuts down the plugin, if there are errors after the plugin in the
enable path.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-11-16 14:45:51 -08:00
Victor Vieux
a8139460ff explicitly show plugins as unsupported on !linux
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2016-11-15 16:47:30 -08:00
Anusha Ragunathan
766cc9b467 Perform graceful shutdown during plugin disable.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-11-14 15:09:48 -08:00
Victor Vieux
970b23db2e update media_type
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-11-10 15:51:32 -08:00
Victor Vieux
fc7a265258 support mounts, devices and args for docker plugin set
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-11-10 11:55:48 -08:00
Victor Vieux
49ca91fbeb rename plugin manifest
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-11-10 00:09:23 -08:00
Victor Vieux
28a1ea342d Merge pull request #28164 from anusha-ragunathan/plugin-build
Add plugin create functionality.
2016-11-09 17:49:51 -08:00
Anusha Ragunathan
5b6e1bc9e5 Add plugin create functionality.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-11-09 15:23:03 -08:00
Victor Vieux
4b63ad33ec Merge pull request #28086 from vieux/delete_rootfs_plugin
delete plugin rootfs on `docker plugin rm`
2016-11-08 17:03:01 -08:00
Victor Vieux
586b7cc19e delete plugin rootfs on plugin rm
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-11-08 03:30:37 -08:00
Victor Vieux
03da822ee9 Merge pull request #27923 from vieux/plugin_set_gogogo
support env for docker plugin set
2016-11-07 17:07:14 -08:00
Victor Vieux
efbed4500e support env for docker plugin set
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-11-07 16:59:29 -08:00
Amit Krishnan
934328d8ea Add functional support for Docker sub commands on Solaris
Signed-off-by: Amit Krishnan <krish.amit@gmail.com>

Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-11-07 09:06:34 -08:00
Tibor Vass
cc8b8ce0b3 Merge pull request #27924 from vieux/prevent_panic_volume_plugin_disable
prevent panic when docker build & volume plugin is disabled
2016-11-01 14:57:52 -07:00
Daehyeok Mun
fa710e504b Fix logrus formatting
This fix tries to fix logrus formatting by removing `f` from
`logrus.[Error|Warn|Debug|Fatal|Panic|Info]f` when formatting string
is not present.

Fixed issue #23459

Signed-off-by: Daehyeok Mun <daehyeok@gmail.com>
2016-10-31 22:05:01 -06: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
Antonio Murdaca
8ed31089c0 Merge pull request #27467 from tonistiigi/attach-cb
Move stdio attach from libcontainerd backend to callback
2016-10-25 16:23:07 +02: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
Tonis Tiigi
37a3be2449 Move stdio attach from libcontainerd backend to callback
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-10-24 00:20:36 -07:00
Aaron Lehmann
2c620d0aa2 Merge pull request #27287 from mavenugo/pluginv2-sk2
Allow multiple handlers to support network plugins in swarm-mode
2016-10-20 13:43:04 -07:00
Anusha Ragunathan
110e973390 Add plugin API version.
This version is across all plugin types and it versions the actual RPC
API between the daemon and the plugin.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-10-18 09:07:16 -07:00
Madhu Venugopal
5e9c78aeaf Allow plugins to have multiple handlers
Currently the plugins pkg allows a single handler. This assumption
breaks down if there are mutiple listeners to a plugin of a certain
Manifest such as NetworkDriver or IpamDriver when swarm-mode is enabled.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2016-10-17 09:00:17 -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
Tonis Tiigi
a452d1fccb Remove restartmanager from plugins
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2016-10-07 12:10:13 -07:00
John Howard
02309170a5 Remove hacked Windows OCI spec, compile fixups
Signed-off-by: John Howard <jhoward@microsoft.com>
2016-09-27 12:07:35 -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
allencloud
9279a93f6d correct some nits in comments
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-09-15 12:17:58 +08:00
boucher
d8fef66b03 Initial implementation of containerd Checkpoint API.
Signed-off-by: boucher <rboucher@gmail.com>
2016-09-08 21:31:52 -04:00
Michael Crosby
91e197d614 Add engine-api types to docker
This moves the types for the `engine-api` repo to the existing types
package.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-09-07 11:05:58 -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
Tibor Vass
ed0dff8f16 Merge pull request #25424 from vieux/enabled
replace active by enabled for consistency in plugins
2016-08-26 15:22:41 -07:00
Victor Vieux
cf4e268115 replace active by enabled for consistency in plugins
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-08-25 20:42:49 -07:00
Anusha Ragunathan
031a2a5c4b Cleanup fallback to V1 plugins logic.
handleLegacy is a flag to indicate whether daemon is supporting legacy
plugins. When the time comes to remove support for legacy plugins,
flipping this bool is all that will be needed to remove legacy plugin
support. This can be a global variable rather than be embedded in the
manager, thereby cleaning up code.

Also rename to allowV1PluginsFallback for clarity.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-08-25 11:39:47 -07:00
Vincent Demeester
0c6926070f Merge pull request #25816 from anusha-ragunathan/vol-plugin-list
Make `docker volume list` lookup plugins installed using new model.
2016-08-25 19:02:25 +02:00
Anusha Ragunathan
9b6dcc8b9d Make docker pull detect plugin content and error out.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-08-20 12:54:35 -07:00
Anusha Ragunathan
59c45f7c0a Make docker volume list lookup plugins installed using new model.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-08-17 13:27:43 -07:00
Michael Crosby
041e5a21dc Replace old oci specs import with runtime-specs
Fixes #25804

The upstream repo changed the import paths.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-08-17 09:38:34 -07:00
Tibor Vass
6e70a976ba Merge pull request #25638 from anusha-ragunathan/fix-plugin-tests
Debugging issue #25511
2016-08-16 15:13:31 -07:00
Tõnis Tiigi
f5ef498289 Merge pull request #25597 from vieux/check_plugin_manifest_json
check plugin manifest is correctly formatted before push
2016-08-15 19:27:50 -07:00
Victor Vieux
b47711ae92 check plugin manifest is correctly formatted before push
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-08-15 17:51:30 -07:00
Anusha Ragunathan
57499fa62e When handling plugin exit, lookup plugins only during daemon shutdown.
The main intent of handling plugin exit is for graceful shutdown
of plugins during daemon shutdown. So avoid plugin lookup during
plugin exits caused by other reasons (eg. force remove)

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-08-15 14:46:02 -07:00
Anusha Ragunathan
4d009084de Fix deadlock on plugin shutdown.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-08-11 19:36:32 -07:00
Anusha Ragunathan
e58028d078 Debugging issue #25511
Volumes and other content created under a bind mount should be
recursively propagated using rshared, not shared. This could be
the reason for EBUSY during removal. Override options with rbind,
rshared and see if CI errors are fixed.

May fix #25511

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-08-11 15:27:06 -07:00
Alexander Morozov
64605d709f Merge pull request #23951 from allencloud/defer-os-file-close
add defer file.Close to avoid potential fd leak
2016-08-10 11:07:15 -07:00
allencloud
0ead624473 add defer file.Close to avoid potential fd leak
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-08-10 08:36:09 +08:00
Victor Vieux
ab12ed4a56 fix plugin restart on docker restart
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-08-09 11:49:28 -07:00
Vincent Demeester
85428a1a53 Merge pull request #25096 from vieux/docker_plugin_remove_force
Add --force to docker plugin remove
2016-08-05 14:45:05 +02:00
Victor Vieux
0016b331da Add --force to docker plugin remove
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-08-04 15:55:45 -07:00
Victor Vieux
42360d164b fix deadlock when more than 1 plugin is installed
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-08-03 16:22:12 -07:00
Anusha Ragunathan
5690730a74 Remove plugin root from filesystem.
`docker plugin remove` didnt actually remove plugin from disk. Fix that.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-08-01 10:46:50 -07:00
Anusha Ragunathan
42abccb841 Make daemon events listen for plugin lifecycle events.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-07-26 10:51:47 -07:00
Anusha Ragunathan
b867f6c6e1 Check for plugin state before enable and disable.
This prevents unnecessary API call to containerd.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-07-25 19:24:28 -07:00
Anusha Ragunathan
4a44cf1d4c Handle plugin shutdown when liveRestore is set.
When daemon has liveRestore set, daemon shutdown should not shutdown
plugins. Fixes #24759

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-07-22 15:26:43 -07:00
Anusha Ragunathan
8fd779dc28 Add only legacy plugins to the legacy lookup map.
Legacy plugin model maintained a map of plugins. This is
not used by the new model. Using this map in the new model
causes incorrect lookup of plugins. This change uses adds
a plugin to the map only if its legacy.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-07-18 15:43:44 -07:00
Anusha Ragunathan
21ecd5a93d Remove use of exec-root in plugins due to socket pathname limits.
Unix sockets are limited to 108 bytes. As a result, we need to be
careful in not using exec-root as the parent directory for pluginID
(which is already 64 bytes), since it can result in socket path names
longer than 108 bytes. Use /tmp instead. Before this change, setting:
- dockerd --exec-root=/go/src/github.com/do passes
- dockerd --exec-root=/go/src/github.com/doc fails
After this change, there's no failure.

Also, write a volume plugins test to verify that the plugins socket
responds.

Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-07-15 09:17:29 -07:00
Brian Goff
b91e2dd994 Merge pull request #24229 from anusha-ragunathan/shutdown-plugins
Shutdown plugins during daemon shutdown.
2016-07-11 22:14:50 -04:00
Anusha Ragunathan
863ab9ab13 Shutdown plugins during daemon shutdown.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-07-11 14:21:27 -07:00
Vincent Demeester
656c66dd50 Merge pull request #24383 from anusha-ragunathan/not-plugin
Detect non-plugin content during install and error out.
2016-07-07 11:18:27 +02:00
Anusha Ragunathan
d32df6d934 Detect non-plugin content during install and error out.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-07-06 18:49:39 -07:00
allencloud
97c77b7e0d add a whitespace in plugin's logging
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-07-04 09:38:06 +08:00
allencloud
2281ce7e98 add err handling, close fd
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-06-27 23:51:54 +08:00
Aaron Lehmann
c9175a6deb Merge pull request #23862 from LK4D4/fix_unused
all: fix usage of some variables
2016-06-23 10:21:10 -07:00
Alexander Morozov
57e14714ee all: fix usage of some variables
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2016-06-22 10:40:32 -07:00
nick
7135afa79b Fix misspell typos
Signed-off-by: nick <nicholasrusso@icloud.com>
2016-06-19 09:53:31 -07:00
Tibor Vass
8ba17b4823 plugins: fix name handling for legacy plugins
Signed-off-by: Tibor Vass <tibor@docker.com>
2016-06-17 12:02:05 -07:00
Vincent Demeester
cb321e82db Update plugin command with defaulttag
This way, you don't have to specify the ":latest" tag for some command
and not for others

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2016-06-17 10:18:18 -07:00
Tibor Vass
15ff9de658 plugins: remove automatic mounting of a state dir
Signed-off-by: Tibor Vass <tibor@docker.com>
2016-06-17 10:03:30 -07:00
Brian Goff
dfd9187305 Implement plugin restore after daemon restart
This ensures that:

- The in-memory plugin store is populated with all the plugins
- Plugins which were active before daemon restart are active after.
  This utilizes the liverestore feature when available, otherwise it
  manually starts the plugin.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-06-15 13:39:33 -04:00
Brian Goff
5e156fd3d4 Fix removing plugins
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-06-15 11:21:31 -04:00
Tibor Vass
f37117045c plugins: experimental support for new plugin management
This patch introduces a new experimental engine-level plugin management
with a new API and command line. Plugins can be distributed via a Docker
registry, and their lifecycle is managed by the engine.
This makes plugins a first-class construct.

For more background, have a look at issue #20363.

Documentation is in a separate commit. If you want to understand how the
new plugin system works, you can start by reading the documentation.

Note: backwards compatibility with existing plugins is maintained,
albeit they won't benefit from the advantages of the new system.

Signed-off-by: Tibor Vass <tibor@docker.com>
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
2016-06-14 14:20:27 -07:00