Skip to content

Commit

Permalink
Fix options for non-bind and non-tmpfs volumes
Browse files Browse the repository at this point in the history
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 <matthew.heon@pm.me>
  • Loading branch information
mheon committed May 1, 2019
1 parent 2e00d41 commit 70beb57
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions pkg/spec/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
}

0 comments on commit 70beb57

Please sign in to comment.