diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2022-07-01 02:19:02 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-01 02:19:02 -0700 |
| commit | 3a5a3406256bc10263f0815baef112a19b62556b (patch) | |
| tree | ec08f9e968af823d73c16327b86f79707e198eab /pkg/driver/nodeserver.go | |
| parent | 27586e9139d4bacf1d37525a2fb7726f472931f4 (diff) | |
| parent | 96d415ad3e121518552629f31a7cbe6eee9c76e4 (diff) | |
| download | seaweedfs-csi-driver-3a5a3406256bc10263f0815baef112a19b62556b.tar.xz seaweedfs-csi-driver-3a5a3406256bc10263f0815baef112a19b62556b.zip | |
Merge pull request #66 from garenchan/ck-dev1
Fix error when managing multiple volumes
Diffstat (limited to 'pkg/driver/nodeserver.go')
| -rw-r--r-- | pkg/driver/nodeserver.go | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/pkg/driver/nodeserver.go b/pkg/driver/nodeserver.go index 6c6fa19..d48875f 100644 --- a/pkg/driver/nodeserver.go +++ b/pkg/driver/nodeserver.go @@ -2,9 +2,7 @@ package driver import ( "context" - "fmt" "os" - "strconv" "strings" "github.com/chrislusf/seaweedfs/weed/glog" @@ -56,31 +54,7 @@ func (ns *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis } volContext := req.GetVolumeContext() - - path, ok := volContext["path"] - if !ok { - path = fmt.Sprintf("/buckets/%s", volumeID) - } - - collection, ok := volContext["collection"] - if !ok { - collection = volumeID - } - - if diskType, ok := volContext["diskType"]; ok { - ns.Driver.DiskType = diskType - } - - if volumeCapacity, ok := volContext["volumeCapacity"]; ok { - vCap, err := strconv.ParseInt(volumeCapacity, 10, 64) - if err != nil { - glog.Errorf("volumeCapacity %s can not be parsed to Int64, err is: %v", volumeCapacity, err) - } else { - ns.Driver.Capacity = vCap - } - } - - mounter, err := newMounter(path, collection, req.GetReadonly(), ns.Driver, volContext) + mounter, err := newMounter(volumeID, req.GetReadonly(), ns.Driver, volContext) if err != nil { return nil, err } @@ -173,8 +147,11 @@ func (ns *NodeServer) NodeStageVolume(ctx context.Context, req *csi.NodeStageVol } func (ns *NodeServer) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error) { + volumeID := req.GetVolumeId() + glog.V(0).Infof("Node expand volume %s to %d bytes", volumeID, req.CapacityRange.RequiredBytes) - clientConn, err := grpc.Dial("passthrough:///unix://"+ns.Driver.mountSocket, grpc.WithTransportCredentials(insecure.NewCredentials())) + localSocket := GetLocalSocket(volumeID) + clientConn, err := grpc.Dial("passthrough:///unix://"+localSocket, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { return nil, err } |
