diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-01-28 07:06:02 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-28 07:06:02 -0500 |
commit | 1b544b74247e538a2cda7bd476cb340cf8f57b81 (patch) | |
tree | 914e97462c2efe403324b43b3ecad7af3164eb1b /pkg | |
parent | f9d2f99653193adbe422e169bb417db2b5c85c64 (diff) | |
parent | e64e6500d3a3bdbb2d3c9faa5e2d9d845f120b17 (diff) | |
download | podman-1b544b74247e538a2cda7bd476cb340cf8f57b81.tar.gz podman-1b544b74247e538a2cda7bd476cb340cf8f57b81.tar.bz2 podman-1b544b74247e538a2cda7bd476cb340cf8f57b81.zip |
Merge pull request #12712 from flouthoc/volume_overlay_advanced
volume: add support for non-volatile `upperdir`,`workdir` for overlay volumes
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/util/mountOpts.go | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/pkg/util/mountOpts.go b/pkg/util/mountOpts.go index 959763dba..f32cf6ea6 100644 --- a/pkg/util/mountOpts.go +++ b/pkg/util/mountOpts.go @@ -25,16 +25,30 @@ type defaultMountOptions struct { // The sourcePath variable, if not empty, contains a bind mount source. func ProcessOptions(options []string, isTmpfs bool, sourcePath string) ([]string, error) { var ( - foundWrite, foundSize, foundProp, foundMode, foundExec, foundSuid, foundDev, foundCopyUp, foundBind, foundZ, foundU bool + foundWrite, foundSize, foundProp, foundMode, foundExec, foundSuid, foundDev, foundCopyUp, foundBind, foundZ, foundU, foundOverlay bool ) newOptions := make([]string, 0, len(options)) for _, opt := range options { // Some options have parameters - size, mode splitOpt := strings.SplitN(opt, "=", 2) + + // add advanced options such as upperdir=/path and workdir=/path, when overlay is specified + if foundOverlay { + if strings.Contains(opt, "upperdir") { + newOptions = append(newOptions, opt) + continue + } + if strings.Contains(opt, "workdir") { + newOptions = append(newOptions, opt) + continue + } + } + switch splitOpt[0] { - case "idmap": case "O": + foundOverlay = true + case "idmap": if len(options) > 1 { return nil, errors.Wrapf(ErrDupeMntOption, "'O' option can not be used with other options") } |