Skip to content

Commit

Permalink
Adapt to libfuse 3 (#3235)
Browse files Browse the repository at this point in the history
* Adapt to libfuse 3

Signed-off-by: ZhangXiaozheng <[email protected]>

* Fix unit test

Signed-off-by: trafalgarzzz <[email protected]>

---------

Signed-off-by: ZhangXiaozheng <[email protected]>
Signed-off-by: trafalgarzzz <[email protected]>
Co-authored-by: trafalgarzzz <[email protected]>
  • Loading branch information
zhang-x-z and TrafalgarZZZ authored May 16, 2023
1 parent 886a5c1 commit 66d64fd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pkg/ddc/alluxio/transform_fuse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func TestTransformFuseWithNoArgs(t *testing.T) {
MountPoint: "local:///mnt/test",
Name: "test",
}},
}}, &Alluxio{}, []string{"fuse", "--fuse-opts=kernel_cache,rw,max_read=131072,allow_other"}, true},
}}, &Alluxio{}, []string{"fuse", "--fuse-opts=kernel_cache,rw,allow_other"}, true},
{&datav1alpha1.AlluxioRuntime{
Spec: datav1alpha1.AlluxioRuntimeSpec{
Fuse: datav1alpha1.AlluxioFuseSpec{
Expand All @@ -59,7 +59,7 @@ func TestTransformFuseWithNoArgs(t *testing.T) {
MountPoint: "local:///mnt/test",
Name: "test",
}},
}}, &Alluxio{}, []string{"fuse", "--fuse-opts=kernel_cache,rw,max_read=131072,allow_other", "/alluxio/default/test/alluxio-fuse", "/"}, false},
}}, &Alluxio{}, []string{"fuse", "--fuse-opts=kernel_cache,rw,allow_other", "/alluxio/default/test/alluxio-fuse", "/"}, false},
}
for _, test := range tests {
engine := &AlluxioEngine{
Expand Down
12 changes: 10 additions & 2 deletions pkg/ddc/alluxio/transform_optimization.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func (e *AlluxioEngine) optimizeDefaultProperties(runtime *datav1alpha1.AlluxioR
}

setDefaultProperties(runtime, value, "alluxio.fuse.jnifuse.enabled", "true")
setDefaultProperties(runtime, value, "alluxio.fuse.jnifuse.libfuse.version", "3")
setDefaultProperties(runtime, value, "alluxio.master.metastore", "ROCKS")
setDefaultProperties(runtime, value, "alluxio.web.ui.enabled", "false")
setDefaultProperties(runtime, value, "alluxio.user.update.file.accesstime.disabled", "true")
Expand Down Expand Up @@ -243,10 +244,17 @@ func (e *AlluxioEngine) optimizeDefaultFuse(runtime *datav1alpha1.AlluxioRuntime
if len(runtime.Spec.Fuse.Args) > 0 {
value.Fuse.Args = runtime.Spec.Fuse.Args
} else {
readOnlyFuseOpts := "--fuse-opts=kernel_cache,ro,attr_timeout=7200,entry_timeout=7200"
readWriteFuseOpts := "--fuse-opts=kernel_cache,rw"
libfuseVersion, found := runtime.Spec.Properties["alluxio.fuse.jnifuse.libfuse.version"]
if found && libfuseVersion == "2" {
readOnlyFuseOpts = "--fuse-opts=kernel_cache,ro,max_read=131072,attr_timeout=7200,entry_timeout=7200,nonempty"
readWriteFuseOpts = "--fuse-opts=kernel_cache,rw,max_read=131072"
}
if readOnly {
value.Fuse.Args = []string{"fuse", "--fuse-opts=kernel_cache,ro,max_read=131072,attr_timeout=7200,entry_timeout=7200,nonempty"}
value.Fuse.Args = []string{"fuse", readOnlyFuseOpts}
} else {
value.Fuse.Args = []string{"fuse", "--fuse-opts=kernel_cache,rw,max_read=131072"}
value.Fuse.Args = []string{"fuse", readWriteFuseOpts}
}
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/ddc/alluxio/transform_optimization_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ func TestOptimizeDefaultForFuseNoValue(t *testing.T) {
"-XX:+UseG1GC",
"-XX:MaxDirectMemorySize=32g",
"-XX:+UnlockExperimentalVMOptions"},
[]string{"fuse", "--fuse-opts=kernel_cache,rw,max_read=131072", "/mnt/runtime", "/"},
[]string{"fuse", "--fuse-opts=kernel_cache,rw", "/mnt/runtime", "/"},
false},
{&datav1alpha1.AlluxioRuntime{
Spec: datav1alpha1.AlluxioRuntimeSpec{},
Expand All @@ -304,7 +304,7 @@ func TestOptimizeDefaultForFuseNoValue(t *testing.T) {
"-XX:+UseG1GC",
"-XX:MaxDirectMemorySize=32g",
"-XX:+UnlockExperimentalVMOptions"},
[]string{"fuse", "--fuse-opts=kernel_cache,rw,max_read=131072"},
[]string{"fuse", "--fuse-opts=kernel_cache,rw"},
true},
}
for _, test := range tests {
Expand Down
2 changes: 1 addition & 1 deletion pkg/ddc/alluxio/transform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestTransformFuse(t *testing.T) {
GID: &x,
},
},
}, &Alluxio{}, []string{"fuse", "--fuse-opts=kernel_cache,rw,max_read=131072,uid=1000,gid=1000,allow_other"}},
}, &Alluxio{}, []string{"fuse", "--fuse-opts=kernel_cache,rw,uid=1000,gid=1000,allow_other"}},
}
for _, test := range tests {
engine := &AlluxioEngine{}
Expand Down

0 comments on commit 66d64fd

Please sign in to comment.