From 9371e0d88339ab911b9b2a4d5876a06abd28f1c0 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Tue, 14 Jun 2016 09:25:39 -0700 Subject: [PATCH] fix 2 potential panics with mounts in swarm Signed-off-by: Victor Vieux Upstream-commit: ffeb9fcb2a155f3495be333f9c6df41ea14c809b Component: engine --- components/engine/api/client/service/opts.go | 3 +++ components/engine/daemon/cluster/executor/container/adapter.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/components/engine/api/client/service/opts.go b/components/engine/api/client/service/opts.go index f54c81b00a..00ede4d028 100644 --- a/components/engine/api/client/service/opts.go +++ b/components/engine/api/client/service/opts.go @@ -154,6 +154,9 @@ func (m *MountOpt) Set(value string) error { Labels: make(map[string]string), } } + if mount.VolumeOptions.DriverConfig == nil { + mount.VolumeOptions.DriverConfig = &swarm.Driver{} + } return mount.VolumeOptions } diff --git a/components/engine/daemon/cluster/executor/container/adapter.go b/components/engine/daemon/cluster/executor/container/adapter.go index c9751caeff..ffe1ce6538 100644 --- a/components/engine/daemon/cluster/executor/container/adapter.go +++ b/components/engine/daemon/cluster/executor/container/adapter.go @@ -192,7 +192,7 @@ func (c *containerAdapter) createVolumes(ctx context.Context, backend executorpk continue } - if mount.VolumeOptions != nil { + if mount.VolumeOptions == nil { continue }