Skip to content

Commit

Permalink
默认就 rw 吧, permdir 就是给应用瞎搞的
Browse files Browse the repository at this point in the history
  • Loading branch information
timfeirg committed May 16, 2017
1 parent 2e6ae27 commit bb07a96
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cluster/calcium/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func makeMountPaths(specs types.Specs, config types.Config) ([]string, map[strin
expanded := os.Expand(path, expandENV)
parts := strings.Split(expanded, ":")
if len(parts) == 2 {
binds = append(binds, fmt.Sprintf("%s:%s:ro", parts[0], parts[1]))
binds = append(binds, fmt.Sprintf("%s:%s:rw", parts[0], parts[1]))
volumes[parts[1]] = struct{}{}
} else if len(parts) == 3 {
binds = append(binds, fmt.Sprintf("%s:%s:%s", parts[0], parts[1], parts[2]))
Expand Down
2 changes: 1 addition & 1 deletion cluster/calcium/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ func TestMakeMountPaths(t *testing.T) {
config := types.Config{PermDir: "/mnt/mfs/permdirs", AppDir: "/home"}
specs := types.Specs{Appname: "foo", Volumes: []string{"$PERMDIR/foo-data:$APPDIR/foo-data"}}
binds, volumes := makeMountPaths(specs, config)
assert.Equal(t, binds, []string{"/mnt/mfs/permdirs/foo/foo-data:/home/foo/foo-data:ro", "/proc/sys:/writable-proc/sys:rw", "/sys/kernel/mm/transparent_hugepage:/writable-sys/kernel/mm/transparent_hugepage:rw"}, "binds should be the same")
assert.Equal(t, binds, []string{"/mnt/mfs/permdirs/foo/foo-data:/home/foo/foo-data:rw", "/proc/sys:/writable-proc/sys:rw", "/sys/kernel/mm/transparent_hugepage:/writable-sys/kernel/mm/transparent_hugepage:rw"}, "binds should be the same")
assert.Equal(t, volumes, map[string]struct{}{"/home/foo/foo-data": struct{}{}, "/writable-proc/sys": struct{}{}, "/writable-sys/kernel/mm/transparent_hugepage": struct{}{}})
}

0 comments on commit bb07a96

Please sign in to comment.