Fix the issue where fuse command on a node cannot specify multiple configuration directory paths (#7874)
Changes:
Modified weed/command/fuse.go to add a function GetFuseCommandName to return the name of the fuse command.
Modified weed/weed.go to conditionally initialize the global HTTP client only if the command is not "fuse".
Modified weed/command/fuse_std.go to parse parameters and ensure the global HTTP client is initialized for the fuse command.
Tests:
Use /etc/fstab like:
fuse /repos fuse.weed filer=192.168.1.101:7202,filer.path=/hpc/repos,config_dir=/etc/seaweedfs/seaweedfs_01 0 0
fuse /opt/ohpc/pub fuse.weed filer=192.168.1.102:7202,filer.path=/hpc_cluster/pub,config_dir=/etc/seaweedfs/seaweedfs_02 0 0
Co-authored-by: zhangxl56 <zhangxl56@lenovo.com>
This commit is contained in:
@@ -28,3 +28,7 @@ var cmdFuse = &Command{
|
|||||||
To check valid options look "weed mount --help"
|
To check valid options look "weed mount --help"
|
||||||
`,
|
`,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetFuseCommandName() string {
|
||||||
|
return cmdFuse.Name()
|
||||||
|
}
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/seaweedfs/seaweedfs/weed/util"
|
||||||
|
util_http "github.com/seaweedfs/seaweedfs/weed/util/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
type parameter struct {
|
type parameter struct {
|
||||||
@@ -219,6 +222,8 @@ func runFuse(cmd *Command, args []string) bool {
|
|||||||
}
|
}
|
||||||
case "fusermount.path":
|
case "fusermount.path":
|
||||||
fusermountPath = parameter.value
|
fusermountPath = parameter.value
|
||||||
|
case "config_dir":
|
||||||
|
util.ConfigurationFileDirectory.Set(parameter.value)
|
||||||
default:
|
default:
|
||||||
t := parameter.name
|
t := parameter.name
|
||||||
if parameter.value != "true" {
|
if parameter.value != "true" {
|
||||||
@@ -228,6 +233,8 @@ func runFuse(cmd *Command, args []string) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
util_http.InitGlobalHttpClient()
|
||||||
|
|
||||||
// the master start the child, release it then finish himself
|
// the master start the child, release it then finish himself
|
||||||
if masterProcess {
|
if masterProcess {
|
||||||
arg0, err := os.Executable()
|
arg0, err := os.Executable()
|
||||||
|
|||||||
@@ -85,8 +85,9 @@ func main() {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if args[0] != command.GetFuseCommandName() {
|
||||||
util_http.InitGlobalHttpClient()
|
util_http.InitGlobalHttpClient()
|
||||||
|
}
|
||||||
for _, cmd := range commands {
|
for _, cmd := range commands {
|
||||||
if cmd.Name() == args[0] && cmd.Run != nil {
|
if cmd.Name() == args[0] && cmd.Run != nil {
|
||||||
cmd.Flag.Usage = func() { cmd.Usage() }
|
cmd.Flag.Usage = func() { cmd.Usage() }
|
||||||
|
|||||||
Reference in New Issue
Block a user