add an example on how to add more mount options

This commit is contained in:
Chris Lu 2021-01-11 11:31:49 -08:00
parent fcc0835e93
commit e45e75e102
4 changed files with 13 additions and 7 deletions

BIN
_output/seaweedfs-csi-driver Executable file

Binary file not shown.

View File

@ -10,10 +10,11 @@ import (
)
var (
filer = flag.String("filer", "localhost:8888", "filer server")
endpoint = flag.String("endpoint", "unix://tmp/seaweedfs-csi.sock", "CSI endpoint to accept gRPC calls")
nodeID = flag.String("nodeid", "", "node id")
version = flag.Bool("version", false, "Print the version and exit.")
filer = flag.String("filer", "localhost:8888", "filer server")
endpoint = flag.String("endpoint", "unix://tmp/seaweedfs-csi.sock", "CSI endpoint to accept gRPC calls")
nodeID = flag.String("nodeid", "", "node id")
version = flag.Bool("version", false, "Print the version and exit.")
concurrentWriters = flag.Int("concurrentWriters", 128, "limit concurrent goroutine writers if not 0")
)
func main() {
@ -30,5 +31,6 @@ func main() {
}
drv := driver.NewSeaweedFsDriver(*filer, *nodeID, *endpoint)
drv.ConcurrentWriters = *concurrentWriters
drv.Run()
}

View File

@ -4,12 +4,12 @@ import (
"fmt"
"os"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/security"
"github.com/chrislusf/seaweedfs/weed/util"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/chrislusf/seaweedfs/weed/glog"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
@ -35,8 +35,9 @@ type SeaweedFsDriver struct {
vcap []*csi.VolumeCapability_AccessMode
cscap []*csi.ControllerServiceCapability
filer string
grpcDialOption grpc.DialOption
filer string
grpcDialOption grpc.DialOption
ConcurrentWriters int
}
func NewSeaweedFsDriver(filer, nodeID, endpoint string) *SeaweedFsDriver {

View File

@ -35,6 +35,9 @@ func (seaweedFs *seaweedFsMounter) Mount(target string) error {
fmt.Sprintf("-filer=%s", seaweedFs.driver.filer),
fmt.Sprintf("-filer.path=/buckets/%s", seaweedFs.bucketName),
}
if seaweedFs.driver.ConcurrentWriters > 0 {
args = append(args, fmt.Sprintf("-concurrentWriters %d", seaweedFs.driver.ConcurrentWriters))
}
err := fuseMount(target, seaweedFsCmd, args)
if err != nil {
glog.Errorf("mount %s%s to %s: %s", seaweedFs.driver.filer, seaweedFs.bucketName, target, err)