diff options
| author | 泽淼 周 <zhouzemiao@ihuman.com> | 2025-09-26 19:54:44 +0800 |
|---|---|---|
| committer | chrislusf <chris.lu@gmail.com> | 2025-12-05 17:51:28 -0800 |
| commit | bedb15e3e3742a4bd4e26e71e6d9818e9e1474bd (patch) | |
| tree | 7a60daa0bc9cf86204ddeddc94bc7dc748483cb5 /pkg/driver/nodeserver.go | |
| parent | fd2b35494095ccf7b06fb210305406f83ed17998 (diff) | |
| download | seaweedfs-csi-driver-bedb15e3e3742a4bd4e26e71e6d9818e9e1474bd.tar.xz seaweedfs-csi-driver-bedb15e3e3742a4bd4e26e71e6d9818e9e1474bd.zip | |
feat: Separated weed mount lifecycle into a dedicated service and rewired the CSI components to call it.
Diffstat (limited to 'pkg/driver/nodeserver.go')
| -rw-r--r-- | pkg/driver/nodeserver.go | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/pkg/driver/nodeserver.go b/pkg/driver/nodeserver.go index 21e68bf..9371d09 100644 --- a/pkg/driver/nodeserver.go +++ b/pkg/driver/nodeserver.go @@ -185,11 +185,12 @@ func (ns *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublis // Note: The returned Volume won't have an unmounter, so Unstage will need special handling. func (ns *NodeServer) rebuildVolumeFromStaging(volumeID string, stagingPath string) *Volume { return &Volume{ - VolumeId: volumeID, - StagedPath: stagingPath, - localSocket: GetLocalSocket(volumeID), + VolumeId: volumeID, + StagedPath: stagingPath, + driver: ns.Driver, // mounter and unmounter are nil - this is intentional // The FUSE process is already running, we just need to track the volume + // The mount service will have the mount tracked if it's still alive } } @@ -344,17 +345,7 @@ func (ns *NodeServer) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandV } func (ns *NodeServer) NodeCleanup() { - ns.volumes.Range(func(_, vol any) bool { - v := vol.(*Volume) - if len(v.StagedPath) > 0 { - glog.Infof("cleaning up volume %s at %s", v.VolumeId, v.StagedPath) - err := v.Unstage(v.StagedPath) - if err != nil { - glog.Warningf("error cleaning up volume %s at %s, err: %v", v.VolumeId, v.StagedPath, err) - } - } - return true - }) + glog.Infof("node cleanup skipped; mount service retains mounts across restarts") } func (ns *NodeServer) getVolumeMutex(volumeID string) *sync.Mutex { @@ -373,7 +364,7 @@ func (ns *NodeServer) stageNewVolume(volumeID, stagingTargetPath string, volCont return nil, err } - volume := NewVolume(volumeID, mounter) + volume := NewVolume(volumeID, mounter, ns.Driver) if err := volume.Stage(stagingTargetPath); err != nil { return nil, err } |
