mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
replace filer.remote and parts[1]
This commit is contained in:
parent
877c192af2
commit
84488ebb33
|
@ -43,88 +43,90 @@ func runFuse(cmd *Command, args []string) bool {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
key, value := parts[0], parts[1]
|
||||||
|
|
||||||
// switch key keeping "weed mount" parameters
|
// switch key keeping "weed mount" parameters
|
||||||
switch parts[0] {
|
switch key {
|
||||||
case "filer":
|
case "filer":
|
||||||
mountOptions.filer = &parts[1]
|
mountOptions.filer = &value
|
||||||
case "filer.path":
|
case "filer.path":
|
||||||
mountOptions.filerMountRootPath = &parts[1]
|
mountOptions.filerMountRootPath = &value
|
||||||
case "dirAutoCreate":
|
case "dirAutoCreate":
|
||||||
if value, err := strconv.ParseBool(parts[1]); err != nil {
|
if parsed, err := strconv.ParseBool(value); err != nil {
|
||||||
mountOptions.dirAutoCreate = &value
|
mountOptions.dirAutoCreate = &parsed
|
||||||
} else {
|
} else {
|
||||||
panic(fmt.Errorf("dirAutoCreate: %s", err))
|
panic(fmt.Errorf("dirAutoCreate: %s", err))
|
||||||
}
|
}
|
||||||
case "collection":
|
case "collection":
|
||||||
mountOptions.collection = &parts[1]
|
mountOptions.collection = &value
|
||||||
case "replication":
|
case "replication":
|
||||||
mountOptions.replication = &parts[1]
|
mountOptions.replication = &value
|
||||||
case "disk":
|
case "disk":
|
||||||
mountOptions.diskType = &parts[1]
|
mountOptions.diskType = &value
|
||||||
case "ttl":
|
case "ttl":
|
||||||
if value, err := strconv.ParseInt(parts[1], 0, 32); err != nil {
|
if parsed, err := strconv.ParseInt(value, 0, 32); err != nil {
|
||||||
intValue := int(value)
|
intValue := int(parsed)
|
||||||
mountOptions.ttlSec = &intValue
|
mountOptions.ttlSec = &intValue
|
||||||
} else {
|
} else {
|
||||||
panic(fmt.Errorf("ttl: %s", err))
|
panic(fmt.Errorf("ttl: %s", err))
|
||||||
}
|
}
|
||||||
case "chunkSizeLimitMB":
|
case "chunkSizeLimitMB":
|
||||||
if value, err := strconv.ParseInt(parts[1], 0, 32); err != nil {
|
if parsed, err := strconv.ParseInt(value, 0, 32); err != nil {
|
||||||
intValue := int(value)
|
intValue := int(parsed)
|
||||||
mountOptions.chunkSizeLimitMB = &intValue
|
mountOptions.chunkSizeLimitMB = &intValue
|
||||||
} else {
|
} else {
|
||||||
panic(fmt.Errorf("chunkSizeLimitMB: %s", err))
|
panic(fmt.Errorf("chunkSizeLimitMB: %s", err))
|
||||||
}
|
}
|
||||||
case "concurrentWriters":
|
case "concurrentWriters":
|
||||||
if value, err := strconv.ParseInt(parts[1], 0, 32); err != nil {
|
if parsed, err := strconv.ParseInt(value, 0, 32); err != nil {
|
||||||
intValue := int(value)
|
intValue := int(parsed)
|
||||||
mountOptions.concurrentWriters = &intValue
|
mountOptions.concurrentWriters = &intValue
|
||||||
} else {
|
} else {
|
||||||
panic(fmt.Errorf("concurrentWriters: %s", err))
|
panic(fmt.Errorf("concurrentWriters: %s", err))
|
||||||
}
|
}
|
||||||
case "cacheDir":
|
case "cacheDir":
|
||||||
mountOptions.cacheDir = &parts[1]
|
mountOptions.cacheDir = &value
|
||||||
case "cacheCapacityMB":
|
case "cacheCapacityMB":
|
||||||
if value, err := strconv.ParseInt(parts[1], 0, 64); err != nil {
|
if parsed, err := strconv.ParseInt(value, 0, 64); err != nil {
|
||||||
mountOptions.cacheSizeMB = &value
|
mountOptions.cacheSizeMB = &parsed
|
||||||
} else {
|
} else {
|
||||||
panic(fmt.Errorf("cacheCapacityMB: %s", err))
|
panic(fmt.Errorf("cacheCapacityMB: %s", err))
|
||||||
}
|
}
|
||||||
case "dataCenter":
|
case "dataCenter":
|
||||||
mountOptions.dataCenter = &parts[1]
|
mountOptions.dataCenter = &value
|
||||||
case "allowOthers":
|
case "allowOthers":
|
||||||
if value, err := strconv.ParseBool(parts[1]); err != nil {
|
if parsed, err := strconv.ParseBool(value); err != nil {
|
||||||
mountOptions.allowOthers = &value
|
mountOptions.allowOthers = &parsed
|
||||||
} else {
|
} else {
|
||||||
panic(fmt.Errorf("allowOthers: %s", err))
|
panic(fmt.Errorf("allowOthers: %s", err))
|
||||||
}
|
}
|
||||||
case "umask":
|
case "umask":
|
||||||
mountOptions.umaskString = &parts[1]
|
mountOptions.umaskString = &value
|
||||||
case "nonempty":
|
case "nonempty":
|
||||||
if value, err := strconv.ParseBool(parts[1]); err != nil {
|
if parsed, err := strconv.ParseBool(value); err != nil {
|
||||||
mountOptions.nonempty = &value
|
mountOptions.nonempty = &parsed
|
||||||
} else {
|
} else {
|
||||||
panic(fmt.Errorf("nonempty: %s", err))
|
panic(fmt.Errorf("nonempty: %s", err))
|
||||||
}
|
}
|
||||||
case "volumeServerAccess":
|
case "volumeServerAccess":
|
||||||
mountOptions.volumeServerAccess = &parts[1]
|
mountOptions.volumeServerAccess = &value
|
||||||
case "map.uid":
|
case "map.uid":
|
||||||
mountOptions.uidMap = &parts[1]
|
mountOptions.uidMap = &value
|
||||||
case "map.gid":
|
case "map.gid":
|
||||||
mountOptions.gidMap = &parts[1]
|
mountOptions.gidMap = &value
|
||||||
case "readOnly":
|
case "readOnly":
|
||||||
if value, err := strconv.ParseBool(parts[1]); err != nil {
|
if parsed, err := strconv.ParseBool(value); err != nil {
|
||||||
mountOptions.readOnly = &value
|
mountOptions.readOnly = &parsed
|
||||||
} else {
|
} else {
|
||||||
panic(fmt.Errorf("readOnly: %s", err))
|
panic(fmt.Errorf("readOnly: %s", err))
|
||||||
}
|
}
|
||||||
case "cpuprofile":
|
case "cpuprofile":
|
||||||
mountCpuProfile = &parts[1]
|
mountCpuProfile = &value
|
||||||
case "memprofile":
|
case "memprofile":
|
||||||
mountMemProfile = &parts[1]
|
mountMemProfile = &value
|
||||||
case "readRetryTime":
|
case "readRetryTime":
|
||||||
if value, err := time.ParseDuration(parts[1]); err != nil {
|
if parsed, err := time.ParseDuration(value); err != nil {
|
||||||
mountReadRetryTime = &value
|
mountReadRetryTime = &parsed
|
||||||
} else {
|
} else {
|
||||||
panic(fmt.Errorf("readRetryTime: %s", err))
|
panic(fmt.Errorf("readRetryTime: %s", err))
|
||||||
}
|
}
|
||||||
|
@ -134,29 +136,29 @@ func runFuse(cmd *Command, args []string) bool {
|
||||||
// I don't know why PATH environment variable is lost
|
// I don't know why PATH environment variable is lost
|
||||||
if err := os.Setenv("PATH", "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"); err != nil {
|
if err := os.Setenv("PATH", "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"); err != nil {
|
||||||
panic(fmt.Errorf("setenv: %s", err))
|
panic(fmt.Errorf("setenv: %s", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
// just call "weed mount" command
|
// just call "weed mount" command
|
||||||
return runMount(cmdMount, []string{})
|
return runMount(cmdMount, []string{})
|
||||||
}
|
}
|
||||||
|
|
||||||
var cmdFuse = &Command{
|
var cmdFuse = &Command{
|
||||||
UsageLine: "fuse /mnt/mount/point -o \"filer=localhost:8888,filer.remote=/\"",
|
UsageLine: "fuse /mnt/mount/point -o \"filer=localhost:8888,filer.path=/\"",
|
||||||
Short: "Allow use weed with linux's mount command",
|
Short: "Allow use weed with linux's mount command",
|
||||||
Long: `Allow use weed with linux's mount command
|
Long: `Allow use weed with linux's mount command
|
||||||
|
|
||||||
You can use -t weed on mount command:
|
You can use -t weed on mount command:
|
||||||
mv weed /sbin/mount.weed
|
mv weed /sbin/mount.weed
|
||||||
mount -t weed fuse /mnt -o "filer=localhost:8888,filer.remote=/"
|
mount -t weed fuse /mnt -o "filer=localhost:8888,filer.path=/"
|
||||||
|
|
||||||
Or you can use -t fuse on mount command:
|
Or you can use -t fuse on mount command:
|
||||||
mv weed /sbin/weed
|
mv weed /sbin/weed
|
||||||
mount -t fuse.weed fuse /mnt -o "filer=localhost:8888,filer.remote=/"
|
mount -t fuse.weed fuse /mnt -o "filer=localhost:8888,filer.path=/"
|
||||||
mount -t fuse "weed#fuse" /mnt -o "filer=localhost:8888,filer.remote=/"
|
mount -t fuse "weed#fuse" /mnt -o "filer=localhost:8888,filer.path=/"
|
||||||
|
|
||||||
To use without mess with your /sbin:
|
To use without mess with your /sbin:
|
||||||
mount -t fuse./home/user/bin/weed fuse /mnt -o "filer=localhost:8888,filer.remote=/"
|
mount -t fuse./home/user/bin/weed fuse /mnt -o "filer=localhost:8888,filer.path=/"
|
||||||
mount -t fuse "/home/user/bin/weed#fuse" /mnt -o "filer=localhost:8888,filer.remote=/"
|
mount -t fuse "/home/user/bin/weed#fuse" /mnt -o "filer=localhost:8888,filer.path=/"
|
||||||
|
|
||||||
To check valid options look "weed mount --help"
|
To check valid options look "weed mount --help"
|
||||||
`,
|
`,
|
||||||
|
|
Loading…
Reference in a new issue