Commit graph

36 commits

Author SHA1 Message Date
allencloud
4cd455a8d9 fix typos
Signed-off-by: allencloud <allen.sun@daocloud.io>
(cherry picked from commit 4e959ef2f7)
Signed-off-by: Tibor Vass <tibor@docker.com>
2016-07-25 23:18:15 -07:00
Anusha Ragunathan
05b7fe4170 Remove extra map lookup for volume drivers.
Signed-off-by: Anusha Ragunathan <anusha@docker.com>
(cherry picked from commit 5d4627331e)
Signed-off-by: Tibor Vass <tibor@docker.com>
2016-07-25 23:15:43 -07:00
Anusha Ragunathan
fee68def8f 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>
(cherry picked from commit 8fd779dc28)
Signed-off-by: Tibor Vass <tibor@docker.com>
2016-07-25 23:15:42 -07: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
Brian Goff
2f40b1b281 Add support for volume scopes
This is similar to network scopes where a volume can either be `local`
or `global`. A `global` volume is one that exists across the entire
cluster where as a `local` volume exists on a single engine.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-06-05 15:37:15 -04:00
Brian Goff
79ff6eaf21 Enhance pluginrpc-gen parser
Now handles `package.Type` and `*package.Type`
Fixes parsing issues with slice and map types.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-06-05 15:37:15 -04:00
Brian Goff
2b6bc294fc When calling volume driver Mount, send opaque ID
This generates an ID string for calls to Mount/Unmount, allowing drivers
to differentiate between two callers of `Mount` and `Unmount`.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-04-29 09:37:02 -04:00
Brian Goff
36a1c56cf5 Allow volume drivers to provide a Status field
The `Status` field is a `map[string]interface{}` which allows the driver to pass
back low-level details about the underlying volume.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-04-15 10:56:38 -04:00
Brian Goff
9e6b1852a7 Fix N+1 calling Path() on volume ls
Implements a `CachedPath` function on the volume plugin adapter that we
call from the volume list function instead of `Path.
If a driver does not implement `CachedPath` it will just call `Path`.

Also makes sure we store the path on Mount and remove the path on
Unmount.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-04-12 20:30:34 -04:00
Evan Hazlett
fc214b4408 add label support for build, networks and volumes
build: implement --label

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

network: allow adding labels on create

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

volume: allow adding labels on create

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

add tests for build, network, volume

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>

vendor: libnetwork and engine-api bump

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
2016-03-22 11:49:06 -04:00
allencloud
34b82a69b9 fix some typos.
Signed-off-by: allencloud <allen.sun@daocloud.io>
2016-03-10 10:09:27 +08:00
Brian Goff
96c79a1934 Fix panic when plugin responds with null volume
In cases where the a plugin responds with both a null or empty volume
and a null or empty Err, the daemon would panic.
This is because we assumed the idiom if `err` is nil, then `v` must not
be but in reality the plugin may return whatever it wants and we want to
make sure it doesn't harm the daemon.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-02-24 20:45:38 -05:00
Jess Frazelle
79edcc5172 Merge pull request #20198 from cpuguy83/check_drivers_b4_vol_create
Check drivers before vol create
2016-02-12 18:41:48 -05:00
Victor Vieux
99a396902f fix common misspell
Signed-off-by: Victor Vieux <vieux@docker.com>
2016-02-11 15:49:36 -08:00
Brian Goff
3403a01b07 Remove back-compat hacks from for volume plugins.
Hacks were added as interim support for 1.10 but should not be needed
for 1.11.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-02-10 20:43:20 -05:00
Stephen Rust
c3985bdf79 Fix volume driver API compatibility mode (a little)
Signed-off-by: Stephen Rust <srust@blockbridge.com>
2016-02-08 23:12:29 -05:00
Brian Goff
f6c20d9b22 Add back compat for volume drivers Get and Ls
Use a back-compat struct to handle listing volumes for volumes we know
about (because, presumably, they are being used by a container) for
volume drivers which don't yet support `List`.

Adds a fall-back for the volume driver `Get` call, which will use
`Create` when the driver returns a `404` for `Get`. The old behavior was
to always use `Create` to get a volume reference.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-01-22 22:48:17 -05:00
Brian Goff
cfb2c667ad Use fine-grained locks for plugin loading.
This helps ensure that only one thing is trying to intialize a plugin at
once while also keeping the global lock free during initialization.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-01-20 13:57:52 -05:00
Brian Goff
d3eca4451d Move responsibility of ls/inspect to volume driver
Makes `docker volume ls` and `docker volume inspect` ask the volume
drivers rather than only using what is cached locally.

Previously in order to use a volume from an external driver, one would
either have to use `docker volume create` or have a container that is
already using that volume for it to be visible to the other volume
API's.

For keeping uniqueness of volume names in the daemon, names are bound to
a driver on a first come first serve basis. If two drivers have a volume
with the same name, the first one is chosen, and a warning is logged
about the second one.

Adds 2 new methods to the plugin API, `List` and `Get`.
If a plugin does not implement these endpoints, a user will not be able
to find the specified volumes as well requests go through the drivers.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2016-01-05 16:28:38 -05:00
David Calavera
8e034802b7 Remove usage of pkg sockets and tlsconfig.
- Use the ones provided by docker/go-connections, they are a drop in replacement.
- Remove pkg/sockets from docker.
- Keep pkg/tlsconfig because libnetwork still needs it and there is a
  circular dependency issue.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-12-29 19:27:12 -05:00
Kunal Kushwaha
aa7fd884e6 Supported added for reterving Plugin list for Network and Volume.
Also, plugin information in docker info output.

Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2015-11-16 15:28:09 +09:00
John Howard
a7e686a779 Windows: Add volume support
Signed-off-by: John Howard <jhoward@microsoft.com>
2015-10-22 10:42:53 -07:00
Tibor Vass
8f7f0f8deb Merge pull request #16493 from cpuguy83/doc_plugin_rpcgen
Add README for pluginrpc-gen
2015-09-23 15:36:05 -04:00
Brian Goff
7acd3ca79d Add README for pluginrpc-gen
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-09-22 19:34:44 -04:00
David Calavera
72bb56618b Move volume ref counting store to a package.
- Add unit tests to make sure the functionality is correct.
- Add FilterByDriver to allow filtering volumes by driver, for future
  `volume ls` filtering and whatnot.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-09-21 12:46:49 -04:00
David Calavera
69dde5c075 Unexport VolumeDriver.
This is not a public interface and users are trying to use it.
We only use it to be able to generate the rpc protocol to talk with a plugin.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-09-11 18:19:38 -04:00
Brian Goff
b3b7eb2723 Add volume API/CLI
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-08-26 13:37:52 -04:00
Darren Shepherd
164208fde5 Don't globally lock on driver initialization
This patch makes it such that plugin initialization is synchronized
based on the plugin name and not globally

Signed-off-by: Darren Shepherd <darren@rancher.com>
2015-08-18 22:25:30 -07:00
Morgan Bauer
9af963aba0
lint fixes for volume/*
- comments on exported values
 - constant string replaced by constant reference
 - unexport implementation details of VolumeDriver 'local'
 - add fixed packages to linter list

Signed-off-by: Morgan Bauer <mbauer@us.ibm.com>
2015-07-28 10:40:44 -07:00
Michael Crosby
806b3fa145 Merge pull request #13835 from cpuguy83/gen-prc
generate plugin clients via template
2015-07-07 17:17:39 -07:00
David Calavera
333ac3a3eb Plugins JSON spec.
Allow full configuration of external plugins via a JSON document.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-06-29 10:32:18 -07:00
Brian Goff
88e4dff9a9 use go-generate to build volume/driver/proxy.go
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-06-10 11:42:15 -04:00
David Calavera
30448166de Fix volume plugin serialization.
Unmarshal errors into strings.
Fix `omit` typos.

Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-06-09 10:39:46 -07:00
David Calavera
d592778f4a Propagate unmount events to the external volume drivers.
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-05-22 16:43:34 -07:00
Arnaud Porterie
2653c7c16c Make API volume-driver dependent on 'experimental'
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2015-05-21 20:34:17 -07:00
David Calavera
81fa9feb0c Volumes refactor and external plugin implementation.
Signed by all authors:

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Signed-off-by: David Calavera <david.calavera@gmail.com>
Signed-off-by: Jeff Lindsay <progrium@gmail.com>
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Signed-off-by: Luke Marsden <luke@clusterhq.com>
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-05-21 20:34:17 -07:00