Signed-off-by: Victor Vieux <vieux@docker.com>
| ... | ... |
@@ -45,7 +45,7 @@ func runList(dockerCli *client.DockerCli, opts listOptions) error {
|
| 45 | 45 |
} |
| 46 | 46 |
|
| 47 | 47 |
w := tabwriter.NewWriter(dockerCli.Out(), 20, 1, 3, ' ', 0) |
| 48 |
- fmt.Fprintf(w, "NAME \tTAG \tDESCRIPTION\tACTIVE") |
|
| 48 |
+ fmt.Fprintf(w, "NAME \tTAG \tDESCRIPTION\tENABLED") |
|
| 49 | 49 |
fmt.Fprintf(w, "\n") |
| 50 | 50 |
|
| 51 | 51 |
for _, p := range plugins {
|
| ... | ... |
@@ -55,7 +55,7 @@ func runList(dockerCli *client.DockerCli, opts listOptions) error {
|
| 55 | 55 |
desc = stringutils.Ellipsis(desc, 45) |
| 56 | 56 |
} |
| 57 | 57 |
|
| 58 |
- fmt.Fprintf(w, "%s\t%s\t%s\t%v\n", p.Name, p.Tag, desc, p.Active) |
|
| 58 |
+ fmt.Fprintf(w, "%s\t%s\t%s\t%v\n", p.Name, p.Tag, desc, p.Enabled) |
|
| 59 | 59 |
} |
| 60 | 60 |
w.Flush() |
| 61 | 61 |
return nil |
| ... | ... |
@@ -25,12 +25,12 @@ see [`docker plugin install`](plugin_install.md). |
| 25 | 25 |
|
| 26 | 26 |
|
| 27 | 27 |
The following example shows that the `no-remove` plugin is installed |
| 28 |
-and active: |
|
| 28 |
+and enabled: |
|
| 29 | 29 |
|
| 30 | 30 |
```bash |
| 31 | 31 |
$ docker plugin ls |
| 32 | 32 |
|
| 33 |
-NAME TAG DESCRIPTION ACTIVE |
|
| 33 |
+NAME TAG DESCRIPTION ENABLED |
|
| 34 | 34 |
tiborvass/no-remove latest A test plugin for Docker true |
| 35 | 35 |
``` |
| 36 | 36 |
|
| ... | ... |
@@ -40,14 +40,10 @@ To disable the plugin, use the following command: |
| 40 | 40 |
$ docker plugin disable tiborvass/no-remove |
| 41 | 41 |
|
| 42 | 42 |
tiborvass/no-remove |
| 43 |
-``` |
|
| 44 |
- |
|
| 45 |
-After the plugin is disabled, it appears as "inactive" in the list of plugins: |
|
| 46 | 43 |
|
| 47 |
-```bash |
|
| 48 | 44 |
$ docker plugin ls |
| 49 | 45 |
|
| 50 |
-NAME TAG DESCRIPTION ACTIVE |
|
| 46 |
+NAME TAG DESCRIPTION ENABLED |
|
| 51 | 47 |
tiborvass/no-remove latest A test plugin for Docker false |
| 52 | 48 |
``` |
| 53 | 49 |
|
| ... | ... |
@@ -25,12 +25,12 @@ see [`docker plugin install`](plugin_install.md). |
| 25 | 25 |
|
| 26 | 26 |
|
| 27 | 27 |
The following example shows that the `no-remove` plugin is installed, |
| 28 |
-but disabled ("inactive"):
|
|
| 28 |
+but disabled: |
|
| 29 | 29 |
|
| 30 | 30 |
```bash |
| 31 | 31 |
$ docker plugin ls |
| 32 | 32 |
|
| 33 |
-NAME TAG DESCRIPTION ACTIVE |
|
| 33 |
+NAME TAG DESCRIPTION ENABLED |
|
| 34 | 34 |
tiborvass/no-remove latest A test plugin for Docker false |
| 35 | 35 |
``` |
| 36 | 36 |
|
| ... | ... |
@@ -40,14 +40,10 @@ To enable the plugin, use the following command: |
| 40 | 40 |
$ docker plugin enable tiborvass/no-remove |
| 41 | 41 |
|
| 42 | 42 |
tiborvass/no-remove |
| 43 |
-``` |
|
| 44 |
- |
|
| 45 |
-After the plugin is enabled, it appears as "active" in the list of plugins: |
|
| 46 | 43 |
|
| 47 |
-```bash |
|
| 48 | 44 |
$ docker plugin ls |
| 49 | 45 |
|
| 50 |
-NAME TAG DESCRIPTION ACTIVE |
|
| 46 |
+NAME TAG DESCRIPTION ENABLED |
|
| 51 | 47 |
tiborvass/no-remove latest A test plugin for Docker true |
| 52 | 48 |
``` |
| 53 | 49 |
|
| ... | ... |
@@ -33,7 +33,7 @@ $ docker plugin inspect tiborvass/no-remove:latest |
| 33 | 33 |
"Id": "8c74c978c434745c3ade82f1bc0acf38d04990eaf494fa507c16d9f1daa99c21", |
| 34 | 34 |
"Name": "tiborvass/no-remove", |
| 35 | 35 |
"Tag": "latest", |
| 36 |
- "Active": true, |
|
| 36 |
+ "Enabled": true, |
|
| 37 | 37 |
"Config": {
|
| 38 | 38 |
"Mounts": [ |
| 39 | 39 |
{
|
| ... | ... |
@@ -24,7 +24,7 @@ Options: |
| 24 | 24 |
--help Print usage |
| 25 | 25 |
``` |
| 26 | 26 |
|
| 27 |
-Removes a plugin. You cannot remove a plugin if it is active, you must disable |
|
| 27 |
+Removes a plugin. You cannot remove a plugin if it is enabled, you must disable |
|
| 28 | 28 |
a plugin using the [`docker plugin disable`](plugin_disable.md) before removing |
| 29 | 29 |
it (or use --force, use of force is not recommended, since it can affect |
| 30 | 30 |
functioning of running containers using the plugin). |
| ... | ... |
@@ -61,7 +61,7 @@ clone git golang.org/x/sys eb2c74142fd19a79b3f237334c7384d5167b1b46 https://gith |
| 61 | 61 |
clone git github.com/docker/go-units eb879ae3e2b84e2a142af415b679ddeda47ec71c |
| 62 | 62 |
clone git github.com/docker/go-connections fa2850ff103453a9ad190da0df0af134f0314b3d |
| 63 | 63 |
|
| 64 |
-clone git github.com/docker/engine-api ebc51d1954fc8934307dd15841b8d64f7cd505df |
|
| 64 |
+clone git github.com/docker/engine-api 94a8f8f29307ab291abad6c6f2182d67089aae5d |
|
| 65 | 65 |
clone git github.com/RackSec/srslog 259aed10dfa74ea2961eddd1d9847619f6e98837 |
| 66 | 66 |
clone git github.com/imdario/mergo 0.2.1 |
| 67 | 67 |
|
| ... | ... |
@@ -42,7 +42,7 @@ func (s *DockerSuite) TestPluginBasicOps(c *check.C) {
|
| 42 | 42 |
c.Assert(err, checker.IsNil) |
| 43 | 43 |
|
| 44 | 44 |
out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
|
| 45 |
- c.Assert(out, checker.Contains, "is active") |
|
| 45 |
+ c.Assert(out, checker.Contains, "is enabled") |
|
| 46 | 46 |
|
| 47 | 47 |
_, _, err = dockerCmdWithError("plugin", "disable", pNameWithTag)
|
| 48 | 48 |
c.Assert(err, checker.IsNil) |
| ... | ... |
@@ -63,7 +63,7 @@ func (s *DockerSuite) TestPluginForceRemove(c *check.C) {
|
| 63 | 63 |
c.Assert(err, checker.IsNil) |
| 64 | 64 |
|
| 65 | 65 |
out, _, err = dockerCmdWithError("plugin", "remove", pNameWithTag)
|
| 66 |
- c.Assert(out, checker.Contains, "is active") |
|
| 66 |
+ c.Assert(out, checker.Contains, "is enabled") |
|
| 67 | 67 |
|
| 68 | 68 |
out, _, err = dockerCmdWithError("plugin", "remove", "--force", pNameWithTag)
|
| 69 | 69 |
c.Assert(err, checker.IsNil) |
| ... | ... |
@@ -84,7 +84,7 @@ func (pm *Manager) newPlugin(ref reference.Named, id string) *plugin {
|
| 84 | 84 |
|
| 85 | 85 |
func (pm *Manager) restorePlugin(p *plugin) error {
|
| 86 | 86 |
p.runtimeSourcePath = filepath.Join(pm.runRoot, p.PluginObj.ID) |
| 87 |
- if p.PluginObj.Active {
|
|
| 87 |
+ if p.PluginObj.Enabled {
|
|
| 88 | 88 |
return pm.restore(p) |
| 89 | 89 |
} |
| 90 | 90 |
return nil |
| ... | ... |
@@ -321,7 +321,7 @@ func (pm *Manager) init() error {
|
| 321 | 321 |
|
| 322 | 322 |
pm.Lock() |
| 323 | 323 |
pm.nameToID[p.Name()] = p.PluginObj.ID |
| 324 |
- requiresManualRestore := !pm.liveRestore && p.PluginObj.Active |
|
| 324 |
+ requiresManualRestore := !pm.liveRestore && p.PluginObj.Enabled |
|
| 325 | 325 |
pm.Unlock() |
| 326 | 326 |
|
| 327 | 327 |
if requiresManualRestore {
|
| ... | ... |
@@ -369,9 +369,9 @@ func (pm *Manager) initPlugin(p *plugin) error {
|
| 369 | 369 |
} |
| 370 | 370 |
|
| 371 | 371 |
func (pm *Manager) remove(p *plugin, force bool) error {
|
| 372 |
- if p.PluginObj.Active {
|
|
| 372 |
+ if p.PluginObj.Enabled {
|
|
| 373 | 373 |
if !force {
|
| 374 |
- return fmt.Errorf("plugin %s is active", p.Name())
|
|
| 374 |
+ return fmt.Errorf("plugin %s is enabled", p.Name())
|
|
| 375 | 375 |
} |
| 376 | 376 |
if err := pm.disable(p); err != nil {
|
| 377 | 377 |
logrus.Errorf("failed to disable plugin '%s': %s", p.Name(), err)
|
| ... | ... |
@@ -21,7 +21,7 @@ import ( |
| 21 | 21 |
) |
| 22 | 22 |
|
| 23 | 23 |
func (pm *Manager) enable(p *plugin, force bool) error {
|
| 24 |
- if p.PluginObj.Active && !force {
|
|
| 24 |
+ if p.PluginObj.Enabled && !force {
|
|
| 25 | 25 |
return fmt.Errorf("plugin %s is already enabled", p.Name())
|
| 26 | 26 |
} |
| 27 | 27 |
spec, err := pm.initSpec(p) |
| ... | ... |
@@ -47,7 +47,7 @@ func (pm *Manager) enable(p *plugin, force bool) error {
|
| 47 | 47 |
} |
| 48 | 48 |
|
| 49 | 49 |
pm.Lock() // fixme: lock single record |
| 50 |
- p.PluginObj.Active = true |
|
| 50 |
+ p.PluginObj.Enabled = true |
|
| 51 | 51 |
pm.save() |
| 52 | 52 |
pm.Unlock() |
| 53 | 53 |
|
| ... | ... |
@@ -130,7 +130,7 @@ func (pm *Manager) initSpec(p *plugin) (*specs.Spec, error) {
|
| 130 | 130 |
} |
| 131 | 131 |
|
| 132 | 132 |
func (pm *Manager) disable(p *plugin) error {
|
| 133 |
- if !p.PluginObj.Active {
|
|
| 133 |
+ if !p.PluginObj.Enabled {
|
|
| 134 | 134 |
return fmt.Errorf("plugin %s is already disabled", p.Name())
|
| 135 | 135 |
} |
| 136 | 136 |
if err := p.restartManager.Cancel(); err != nil {
|
| ... | ... |
@@ -142,7 +142,7 @@ func (pm *Manager) disable(p *plugin) error {
|
| 142 | 142 |
os.RemoveAll(p.runtimeSourcePath) |
| 143 | 143 |
pm.Lock() // fixme: lock single record |
| 144 | 144 |
defer pm.Unlock() |
| 145 |
- p.PluginObj.Active = false |
|
| 145 |
+ p.PluginObj.Enabled = false |
|
| 146 | 146 |
pm.save() |
| 147 | 147 |
return nil |
| 148 | 148 |
} |
| ... | ... |
@@ -156,8 +156,8 @@ func (pm *Manager) Shutdown() {
|
| 156 | 156 |
pm.RLock() |
| 157 | 157 |
defer pm.RUnlock() |
| 158 | 158 |
for _, p := range pm.plugins {
|
| 159 |
- if pm.liveRestore && p.PluginObj.Active {
|
|
| 160 |
- logrus.Debug("Plugin active when liveRestore is set, skipping shutdown")
|
|
| 159 |
+ if pm.liveRestore && p.PluginObj.Enabled {
|
|
| 160 |
+ logrus.Debug("Plugin enabled when liveRestore is set, skipping shutdown")
|
|
| 161 | 161 |
continue |
| 162 | 162 |
} |
| 163 | 163 |
if p.restartManager != nil {
|
| ... | ... |
@@ -165,7 +165,7 @@ func (pm *Manager) Shutdown() {
|
| 165 | 165 |
logrus.Error(err) |
| 166 | 166 |
} |
| 167 | 167 |
} |
| 168 |
- if pm.containerdClient != nil && p.PluginObj.Active {
|
|
| 168 |
+ if pm.containerdClient != nil && p.PluginObj.Enabled {
|
|
| 169 | 169 |
p.exitChan = make(chan bool) |
| 170 | 170 |
err := pm.containerdClient.Signal(p.PluginObj.ID, int(syscall.SIGTERM)) |
| 171 | 171 |
if err != nil {
|
| ... | ... |
@@ -26,10 +26,11 @@ type PluginConfig struct {
|
| 26 | 26 |
|
| 27 | 27 |
// Plugin represents a Docker plugin for the remote API |
| 28 | 28 |
type Plugin struct {
|
| 29 |
- ID string `json:"Id,omitempty"` |
|
| 30 |
- Name string |
|
| 31 |
- Tag string |
|
| 32 |
- Active bool |
|
| 29 |
+ ID string `json:"Id,omitempty"` |
|
| 30 |
+ Name string |
|
| 31 |
+ Tag string |
|
| 32 |
+ // Enabled is true when the plugin is running, is false when the plugin is not running, only installed. |
|
| 33 |
+ Enabled bool |
|
| 33 | 34 |
Config PluginConfig |
| 34 | 35 |
Manifest PluginManifest |
| 35 | 36 |
} |