mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-12-17 17:51:20 +08:00
mount: avoid the need to specify different cache directory for different mount
fix https://github.com/seaweedfs/seaweedfs-csi-driver/issues/11
This commit is contained in:
@@ -169,6 +169,7 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
seaweedFileSystem := filesys.NewSeaweedFileSystem(&filesys.Option{
|
seaweedFileSystem := filesys.NewSeaweedFileSystem(&filesys.Option{
|
||||||
|
MountDirectory: dir,
|
||||||
FilerAddress: filer,
|
FilerAddress: filer,
|
||||||
FilerGrpcAddress: filerGrpcAddress,
|
FilerGrpcAddress: filerGrpcAddress,
|
||||||
GrpcDialOption: grpcDialOption,
|
GrpcDialOption: grpcDialOption,
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Option struct {
|
type Option struct {
|
||||||
|
MountDirectory string
|
||||||
FilerAddress string
|
FilerAddress string
|
||||||
FilerGrpcAddress string
|
FilerGrpcAddress string
|
||||||
GrpcDialOption grpc.DialOption
|
GrpcDialOption grpc.DialOption
|
||||||
@@ -92,7 +93,7 @@ func NewSeaweedFileSystem(option *Option) *WFS {
|
|||||||
},
|
},
|
||||||
signature: util.RandomInt32(),
|
signature: util.RandomInt32(),
|
||||||
}
|
}
|
||||||
cacheUniqueId := util.Md5String([]byte(option.FilerGrpcAddress + option.FilerMountRootPath + util.Version()))[0:4]
|
cacheUniqueId := util.Md5String([]byte(option.MountDirectory + option.FilerGrpcAddress + option.FilerMountRootPath + util.Version()))[0:8]
|
||||||
cacheDir := path.Join(option.CacheDir, cacheUniqueId)
|
cacheDir := path.Join(option.CacheDir, cacheUniqueId)
|
||||||
if option.CacheSizeMB > 0 {
|
if option.CacheSizeMB > 0 {
|
||||||
os.MkdirAll(cacheDir, os.FileMode(0777)&^option.Umask)
|
os.MkdirAll(cacheDir, os.FileMode(0777)&^option.Umask)
|
||||||
|
|||||||
Reference in New Issue
Block a user