Loading pkg/s3/controllerserver.go +7 −4 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol var b *bucket b, err = cs.s3.client.getBucket(volumeID) if err != nil { return nil, err return nil, fmt.Errorf("failed to get bucket: %v", err) } // Check if volume capacity requested is bigger than the already existing capacity if capacityBytes > b.CapacityBytes { Loading @@ -69,16 +69,19 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol } } else { if err = cs.s3.client.createBucket(volumeID); err != nil { glog.V(3).Infof("failed to create volume: %v", err) return nil, err return nil, fmt.Errorf("failed to create volume: %v", err) } if err = cs.s3.client.createPrefix(volumeID, fsPrefix); err != nil { return nil, fmt.Errorf("failed to create prefix: %v", err) } } b := &bucket{ Name: volumeID, CapacityBytes: capacityBytes, FSPath: fsPrefix, } if err := cs.s3.client.setBucket(b); err != nil { return nil, err return nil, fmt.Errorf("Error setting bucket metadata: %v", err) } glog.V(4).Infof("create volume %s", volumeID) Loading pkg/s3/mounter_goofys.go +2 −1 Original line number Diff line number Diff line Loading @@ -60,8 +60,9 @@ func (goofys *goofysMounter) Mount(source string, target string) error { os.Setenv("AWS_ACCESS_KEY_ID", goofys.accessKeyID) os.Setenv("AWS_SECRET_ACCESS_KEY", goofys.secretAccessKey) fullPath := fmt.Sprintf("%s:%s", goofys.bucket.Name, goofys.bucket.FSPath) _, _, err := goofysApi.Mount(context.Background(), goofys.bucket.Name, goofysCfg) _, _, err := goofysApi.Mount(context.Background(), fullPath, goofysCfg) if err != nil { return fmt.Errorf("Error mounting via goofys: %s", err) Loading pkg/s3/mounter_s3backer.go +8 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ package s3 import ( "fmt" "net/url" "os" "os/exec" "path" Loading Loading @@ -29,6 +30,11 @@ const ( ) func newS3backerMounter(bucket *bucket, cfg *Config) (Mounter, error) { url, err := url.Parse(cfg.Endpoint) if err != nil { return nil, err } url.Path = path.Join(url.Path, bucket.Name, bucket.FSPath) // s3backer cannot work with 0 size volumes if bucket.CapacityBytes == 0 { bucket.CapacityBytes = s3backerDefaultSize Loading Loading @@ -88,8 +94,9 @@ func (s3backer *s3backerMounter) mountInit(path string) error { args := []string{ // baseURL must end with / fmt.Sprintf("--baseURL=%s/", s3backer.url), fmt.Sprintf("--blockSize=%v", s3backerBlockSize), fmt.Sprintf("--blockSize=%s", s3backerBlockSize), fmt.Sprintf("--size=%v", s3backer.bucket.CapacityBytes), fmt.Sprintf("--prefix=%s/", s3backer.bucket.FSPath), "--listBlocks", s3backer.bucket.Name, path, Loading pkg/s3/mounter_s3fs.go +1 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ func (s3fs *s3fsMounter) Mount(source string, target string) error { return err } args := []string{ fmt.Sprintf("%s", s3fs.bucket.Name), fmt.Sprintf("%s:/%s", s3fs.bucket.Name, s3fs.bucket.FSPath), fmt.Sprintf("%s", target), "-o", "sigv2", "-o", "use_path_request_style", Loading pkg/s3/mounter_s3ql.go +3 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,9 @@ func newS3qlMounter(b *bucket, cfg *Config) (Mounter, error) { ssl: ssl, } url.Path = path.Join(url.Path, b.Name) // s3ql requires a trailing slash or it will just // prepend the fspath to the s3ql files url.Path = path.Join(url.Path, b.Name, b.FSPath) + "/" s3ql.bucketURL = url.String() if !ssl { Loading Loading
pkg/s3/controllerserver.go +7 −4 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol var b *bucket b, err = cs.s3.client.getBucket(volumeID) if err != nil { return nil, err return nil, fmt.Errorf("failed to get bucket: %v", err) } // Check if volume capacity requested is bigger than the already existing capacity if capacityBytes > b.CapacityBytes { Loading @@ -69,16 +69,19 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol } } else { if err = cs.s3.client.createBucket(volumeID); err != nil { glog.V(3).Infof("failed to create volume: %v", err) return nil, err return nil, fmt.Errorf("failed to create volume: %v", err) } if err = cs.s3.client.createPrefix(volumeID, fsPrefix); err != nil { return nil, fmt.Errorf("failed to create prefix: %v", err) } } b := &bucket{ Name: volumeID, CapacityBytes: capacityBytes, FSPath: fsPrefix, } if err := cs.s3.client.setBucket(b); err != nil { return nil, err return nil, fmt.Errorf("Error setting bucket metadata: %v", err) } glog.V(4).Infof("create volume %s", volumeID) Loading
pkg/s3/mounter_goofys.go +2 −1 Original line number Diff line number Diff line Loading @@ -60,8 +60,9 @@ func (goofys *goofysMounter) Mount(source string, target string) error { os.Setenv("AWS_ACCESS_KEY_ID", goofys.accessKeyID) os.Setenv("AWS_SECRET_ACCESS_KEY", goofys.secretAccessKey) fullPath := fmt.Sprintf("%s:%s", goofys.bucket.Name, goofys.bucket.FSPath) _, _, err := goofysApi.Mount(context.Background(), goofys.bucket.Name, goofysCfg) _, _, err := goofysApi.Mount(context.Background(), fullPath, goofysCfg) if err != nil { return fmt.Errorf("Error mounting via goofys: %s", err) Loading
pkg/s3/mounter_s3backer.go +8 −1 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ package s3 import ( "fmt" "net/url" "os" "os/exec" "path" Loading Loading @@ -29,6 +30,11 @@ const ( ) func newS3backerMounter(bucket *bucket, cfg *Config) (Mounter, error) { url, err := url.Parse(cfg.Endpoint) if err != nil { return nil, err } url.Path = path.Join(url.Path, bucket.Name, bucket.FSPath) // s3backer cannot work with 0 size volumes if bucket.CapacityBytes == 0 { bucket.CapacityBytes = s3backerDefaultSize Loading Loading @@ -88,8 +94,9 @@ func (s3backer *s3backerMounter) mountInit(path string) error { args := []string{ // baseURL must end with / fmt.Sprintf("--baseURL=%s/", s3backer.url), fmt.Sprintf("--blockSize=%v", s3backerBlockSize), fmt.Sprintf("--blockSize=%s", s3backerBlockSize), fmt.Sprintf("--size=%v", s3backer.bucket.CapacityBytes), fmt.Sprintf("--prefix=%s/", s3backer.bucket.FSPath), "--listBlocks", s3backer.bucket.Name, path, Loading
pkg/s3/mounter_s3fs.go +1 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ func (s3fs *s3fsMounter) Mount(source string, target string) error { return err } args := []string{ fmt.Sprintf("%s", s3fs.bucket.Name), fmt.Sprintf("%s:/%s", s3fs.bucket.Name, s3fs.bucket.FSPath), fmt.Sprintf("%s", target), "-o", "sigv2", "-o", "use_path_request_style", Loading
pkg/s3/mounter_s3ql.go +3 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,9 @@ func newS3qlMounter(b *bucket, cfg *Config) (Mounter, error) { ssl: ssl, } url.Path = path.Join(url.Path, b.Name) // s3ql requires a trailing slash or it will just // prepend the fspath to the s3ql files url.Path = path.Join(url.Path, b.Name, b.FSPath) + "/" s3ql.bucketURL = url.String() if !ssl { Loading