From fa9df85c6a6bbf9ddbdc0e79f190c0e2aede13a8 Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Thu, 28 Feb 2019 16:52:30 -0800 Subject: [PATCH] Had `HasExperimental()` to cluster backend It's already defined on the daemon. This allows us to not call `SystemInfo` which is failry heavy and potentially can even error. Takes care of todo item from Derek's containerd integration PR. https://github.com/moby/moby/blob/51c412f26e03ac564ace2de5a8a43c900ef80ef7/daemon/cluster/services.go#L148-L149 Signed-off-by: Brian Goff --- daemon/cluster/executor/backend.go | 1 + daemon/cluster/executor/container/executor.go | 3 +-- daemon/cluster/services.go | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/daemon/cluster/executor/backend.go b/daemon/cluster/executor/backend.go index cfbc86ce36..c40f85716b 100644 --- a/daemon/cluster/executor/backend.go +++ b/daemon/cluster/executor/backend.go @@ -61,6 +61,7 @@ type Backend interface { PluginManager() *plugin.Manager PluginGetter() *plugin.Store GetAttachmentStore() *networkSettings.AttachmentStore + HasExperimental() bool } // VolumeBackend is used by an executor to perform volume operations diff --git a/daemon/cluster/executor/container/executor.go b/daemon/cluster/executor/container/executor.go index 940a943e4f..f54dc7b511 100644 --- a/daemon/cluster/executor/container/executor.go +++ b/daemon/cluster/executor/container/executor.go @@ -229,8 +229,7 @@ func (e *executor) Controller(t *api.Task) (exec.Controller, error) { } switch runtimeKind { case string(swarmtypes.RuntimePlugin): - info, _ := e.backend.SystemInfo() - if !info.ExperimentalBuild { + if !e.backend.HasExperimental() { return ctlr, fmt.Errorf("runtime type %q only supported in experimental", swarmtypes.RuntimePlugin) } c, err := plugin.NewController(e.pluginBackend, t) diff --git a/daemon/cluster/services.go b/daemon/cluster/services.go index d82c0f0f3a..933e2bcac3 100644 --- a/daemon/cluster/services.go +++ b/daemon/cluster/services.go @@ -144,8 +144,7 @@ func (c *Cluster) CreateService(s types.ServiceSpec, encodedAuth string, queryRe case *swarmapi.TaskSpec_Generic: switch serviceSpec.Task.GetGeneric().Kind { case string(types.RuntimePlugin): - info, _ := c.config.Backend.SystemInfo() - if !info.ExperimentalBuild { + if !c.config.Backend.HasExperimental() { return fmt.Errorf("runtime type %q only supported in experimental", types.RuntimePlugin) } if s.TaskTemplate.PluginSpec == nil {