Browse code

Explictly set state of a disabled plugin.

While restoring plugins during daemon restart, some plugins can fail to
respond to net.Dial. These plugins should be explicitly set to disabled,
else they will retain their original state of enabled, which is
incorrect.

Tested with a plugin that fails to restart and observed that the state
was set to disabled.

Signed-off-by: Anusha Ragunathan <anusha.ragunathan@docker.com>

Anusha Ragunathan authored on 2017/03/25 04:05:12
Showing 1 changed files
... ...
@@ -97,6 +97,8 @@ func (pm *Manager) pluginPostStart(p *v2.Plugin, c *controller) error {
97 97
 		if retries > maxRetries {
98 98
 			logrus.Debugf("error net dialing plugin: %v", err)
99 99
 			c.restart = false
100
+			// While restoring plugins, we need to explicitly set the state to disabled
101
+			pm.config.Store.SetState(p, false)
100 102
 			shutdownPlugin(p, c, pm.containerdClient)
101 103
 			return err
102 104
 		}