From 70beb57faa1cfb1a2e9be411628477bc1618c3cf Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Tue, 23 Apr 2019 15:35:38 -0400 Subject: Fix options for non-bind and non-tmpfs volumes We were unconditionally resetting volume mount options for all mount points (and by the looks of things, completely dropping tmpfs mounts), which was causing runc to refuse to run containers and all the tests to consequently fail. Signed-off-by: Matthew Heon --- pkg/spec/storage.go | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'pkg/spec') diff --git a/pkg/spec/storage.go b/pkg/spec/storage.go index 7806a8c72..6f8398513 100644 --- a/pkg/spec/storage.go +++ b/pkg/spec/storage.go @@ -100,6 +100,8 @@ func (config *CreateConfig) parseVolumes(runtime *libpod.Runtime) ([]spec.Mount, unifiedMounts[dest] = tmpfs } + // TODO: Check for conflicts between volumes and named volumes. + // If requested, add container init binary if config.Init { initPath := config.InitPath @@ -143,6 +145,9 @@ func (config *CreateConfig) parseVolumes(runtime *libpod.Runtime) ([]spec.Mount, finalVolumes = append(finalVolumes, volume) } + logrus.Debugf("Got mounts: %v", finalMounts) + logrus.Debugf("Got volumes: %v", finalVolumes) + return finalMounts, finalVolumes, nil } @@ -377,9 +382,6 @@ func getBindMount(args []string) (spec.Mount, error) { newMount.Source = newMount.Destination } - // Process options - newMount.Options = processOptions(newMount.Options) - return newMount, nil } @@ -579,7 +581,7 @@ func (config *CreateConfig) getVolumeMounts() (map[string]spec.Mount, map[string Destination: dest, Type: string(TypeBind), Source: src, - Options: processOptions(options), + Options: options, } if _, ok := mounts[newMount.Destination]; ok { return nil, nil, errors.Wrapf(errDuplicateDest, newMount.Destination) @@ -754,12 +756,13 @@ func supercedeUserMounts(mounts []spec.Mount, configMount []spec.Mount) []spec.M func initFSMounts(inputMounts []spec.Mount) []spec.Mount { var mounts []spec.Mount for _, m := range inputMounts { - m.Options = processOptions(m.Options) - if m.Type == "tmpfs" { + if m.Type == TypeBind { + m.Options = processOptions(m.Options) + } + if m.Type == TypeTmpfs { m.Options = append(m.Options, "tmpcopyup") - } else { - mounts = append(mounts, m) } + mounts = append(mounts, m) } return mounts } -- cgit v1.2.3-54-g00ecf