From 5cc103e9e91d1025d88a86e3678167f6a4d6b632 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Tue, 9 Aug 2016 11:49:28 -0700 Subject: [PATCH] fix plugin restart on docker restart Signed-off-by: Victor Vieux (cherry picked from commit ab12ed4a5642edb4d96b54b6152f12260093f3ea) Signed-off-by: Tibor Vass --- plugin/backend.go | 2 +- plugin/manager.go | 2 +- plugin/manager_linux.go | 4 ++-- plugin/manager_windows.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugin/backend.go b/plugin/backend.go index ca31620602..975c51632b 100644 --- a/plugin/backend.go +++ b/plugin/backend.go @@ -35,7 +35,7 @@ func (pm *Manager) Enable(name string) error { if err != nil { return err } - if err := pm.enable(p); err != nil { + if err := pm.enable(p, false); err != nil { return err } pm.pluginEventLogger(p.PluginObj.ID, name, "enable") diff --git a/plugin/manager.go b/plugin/manager.go index aa7f5d642e..254db32f40 100644 --- a/plugin/manager.go +++ b/plugin/manager.go @@ -321,7 +321,7 @@ func (pm *Manager) init() error { if requiresManualRestore { // if liveRestore is not enabled, the plugin will be stopped now so we should enable it - if err := pm.enable(p); err != nil { + if err := pm.enable(p, true); err != nil { logrus.Errorf("Error enabling plugin '%s': %s", p.Name(), err) } } diff --git a/plugin/manager_linux.go b/plugin/manager_linux.go index b247aae912..06db3d41ac 100644 --- a/plugin/manager_linux.go +++ b/plugin/manager_linux.go @@ -20,8 +20,8 @@ import ( "github.com/opencontainers/specs/specs-go" ) -func (pm *Manager) enable(p *plugin) error { - if p.PluginObj.Active { +func (pm *Manager) enable(p *plugin, force bool) error { + if p.PluginObj.Active && !force { return fmt.Errorf("plugin %s is already enabled", p.Name()) } spec, err := pm.initSpec(p) diff --git a/plugin/manager_windows.go b/plugin/manager_windows.go index cbdb78b682..d423254e74 100644 --- a/plugin/manager_windows.go +++ b/plugin/manager_windows.go @@ -8,7 +8,7 @@ import ( "github.com/opencontainers/specs/specs-go" ) -func (pm *Manager) enable(p *plugin) error { +func (pm *Manager) enable(p *plugin, force bool) error { return fmt.Errorf("Not implemented") }