diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2022-04-12 07:07:46 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-12 07:07:46 -0700 |
| commit | 5cffc070f9d3f009de526f10ac38dde80d55e644 (patch) | |
| tree | 4ef9f2120b6a5fe185c91943b95d525fa95c29ac /pkg/driver/controllerserver.go | |
| parent | 909a9ce4fac5a04a4de4ee1f83c556dd90d8f1bc (diff) | |
| parent | 83c16cd58b2c252eebded20c3b910cefcab1fb4b (diff) | |
| download | seaweedfs-csi-driver-5cffc070f9d3f009de526f10ac38dde80d55e644.tar.xz seaweedfs-csi-driver-5cffc070f9d3f009de526f10ac38dde80d55e644.zip | |
Merge pull request #56 from joy717/fix/collection-quota-not-work
Diffstat (limited to 'pkg/driver/controllerserver.go')
| -rw-r--r-- | pkg/driver/controllerserver.go | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/pkg/driver/controllerserver.go b/pkg/driver/controllerserver.go index 6f57359..535759d 100644 --- a/pkg/driver/controllerserver.go +++ b/pkg/driver/controllerserver.go @@ -5,6 +5,10 @@ import ( "crypto/sha1" "encoding/hex" "fmt" + "io" + "strconv" + "strings" + "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/pb/mount_pb" @@ -14,8 +18,6 @@ import ( "google.golang.org/grpc/credentials/insecure" _ "google.golang.org/grpc/resolver/passthrough" "google.golang.org/grpc/status" - "io" - "strings" ) type ControllerServer struct { @@ -42,11 +44,19 @@ func (cs *ControllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol } params := req.GetParameters() + if params == nil { + params = make(map[string]string) + } glog.V(4).Infof("params:%v", params) - capacity := req.GetCapacityRange().GetLimitBytes() + capacity := req.GetCapacityRange().GetRequiredBytes() cs.Driver.Capacity = capacity cs.Driver.DiskType = params["diskType"] + if capacity > 0 { + glog.V(4).Infof("volume capacity: %d", capacity) + params["volumeCapacity"] = strconv.FormatInt(capacity, 10) + } + if err := filer_pb.Mkdir(cs.Driver, "/buckets", volumeId, nil); err != nil { return nil, fmt.Errorf("Error setting bucket metadata: %v", err) } |
