Skip to content

Commit

Permalink
Merge pull request containers#9151 from rhatdan/mount
Browse files Browse the repository at this point in the history
Docker ignores mount flags that begin with constency
  • Loading branch information
openshift-merge-robot authored Feb 1, 2021
2 parents 4ead806 + 4a6d042 commit 15e5a5c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
16 changes: 16 additions & 0 deletions cmd/podman/common/volumes.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,10 @@ func getBindMount(args []string) (spec.Mount, error) {
default:
return newMount, errors.Wrapf(util.ErrBadMntOption, "%s mount option must be 'private' or 'shared'", kv[0])
}
case "consistency":
// Often used on MACs and mistakenly on Linux platforms.
// Since Docker ignores this option so shall we.
continue
default:
return newMount, errors.Wrapf(util.ErrBadMntOption, kv[0])
}
Expand Down Expand Up @@ -437,6 +441,10 @@ func getTmpfsMount(args []string) (spec.Mount, error) {
}
newMount.Destination = filepath.Clean(kv[1])
setDest = true
case "consistency":
// Often used on MACs and mistakenly on Linux platforms.
// Since Docker ignores this option so shall we.
continue
default:
return newMount, errors.Wrapf(util.ErrBadMntOption, kv[0])
}
Expand Down Expand Up @@ -534,6 +542,10 @@ func getNamedVolume(args []string) (*specgen.NamedVolume, error) {
}
newVolume.Dest = filepath.Clean(kv[1])
setDest = true
case "consistency":
// Often used on MACs and mistakenly on Linux platforms.
// Since Docker ignores this option so shall we.
continue
default:
return nil, errors.Wrapf(util.ErrBadMntOption, kv[0])
}
Expand Down Expand Up @@ -581,6 +593,10 @@ func getImageVolume(args []string) (*specgen.ImageVolume, error) {
default:
return nil, errors.Wrapf(util.ErrBadMntOption, "invalid rw value %q", kv[1])
}
case "consistency":
// Often used on MACs and mistakenly on Linux platforms.
// Since Docker ignores this option so shall we.
continue
default:
return nil, errors.Wrapf(util.ErrBadMntOption, kv[0])
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/util/mountOpts.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ func ProcessOptions(options []string, isTmpfs bool, sourcePath string) ([]string
return nil, errors.Wrapf(ErrDupeMntOption, "the 'tmpcopyup' or 'notmpcopyup' option can only be set once")
}
foundCopyUp = true
case "consistency":
// Often used on MACs and mistakenly on Linux platforms.
// Since Docker ignores this option so shall we.
continue
case "notmpcopyup":
if !isTmpfs {
return nil, errors.Wrapf(ErrBadMntOption, "the 'notmpcopyup' option is only allowed with tmpfs mounts")
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/run_volume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ var _ = Describe("Podman run with volumes", func() {
Expect(session.ExitCode()).To(Equal(0))
Expect(session.OutputToString()).To(ContainSubstring(dest + " ro"))

session = podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",shared", ALPINE, "grep", dest, "/proc/self/mountinfo"})
session = podmanTest.Podman([]string{"run", "--rm", "--mount", mount + ",consistency=delegated,shared", ALPINE, "grep", dest, "/proc/self/mountinfo"})
session.WaitWithDefaultTimeout()
Expect(session.ExitCode()).To(Equal(0))
found, matches := session.GrepString(dest)
Expand Down

0 comments on commit 15e5a5c

Please sign in to comment.