diff options
Diffstat (limited to 'pkg/mountmanager')
| -rw-r--r-- | pkg/mountmanager/client.go | 5 | ||||
| -rw-r--r-- | pkg/mountmanager/manager.go | 2 | ||||
| -rw-r--r-- | pkg/mountmanager/socket.go | 12 |
3 files changed, 15 insertions, 4 deletions
diff --git a/pkg/mountmanager/client.go b/pkg/mountmanager/client.go index 6288c44..7cbfe63 100644 --- a/pkg/mountmanager/client.go +++ b/pkg/mountmanager/client.go @@ -85,7 +85,10 @@ func (c *Client) doPost(path string, payload any, out any) error { if err := json.NewDecoder(resp.Body).Decode(&errResp); err == nil && errResp.Error != "" { return errors.New(errResp.Error) } - data, _ := io.ReadAll(resp.Body) + data, readErr := io.ReadAll(resp.Body) + if readErr != nil { + return fmt.Errorf("mount service error: %s (failed to read body: %v)", resp.Status, readErr) + } return fmt.Errorf("mount service error: %s (%s)", resp.Status, string(data)) } diff --git a/pkg/mountmanager/manager.go b/pkg/mountmanager/manager.go index 0fa3e0a..7e94b89 100644 --- a/pkg/mountmanager/manager.go +++ b/pkg/mountmanager/manager.go @@ -98,7 +98,7 @@ func (m *Manager) Unmount(req *UnmountRequest) (*UnmountResponse, error) { if ok, err := kubeMounter.IsMountPoint(entry.targetPath); ok || mount.IsCorruptedMnt(err) { if err = kubeMounter.Unmount(entry.targetPath); err != nil { - return &UnmountResponse{}, err + return nil, err } } diff --git a/pkg/mountmanager/socket.go b/pkg/mountmanager/socket.go index 1b8a079..f327dcb 100644 --- a/pkg/mountmanager/socket.go +++ b/pkg/mountmanager/socket.go @@ -2,15 +2,23 @@ package mountmanager import ( "fmt" + "path/filepath" "github.com/seaweedfs/seaweedfs/weed/util" ) +// DefaultSocketDir is the default directory for volume sockets. +const DefaultSocketDir = "/var/lib/seaweedfs-mount" + // LocalSocketPath returns the unix socket path used to communicate with the weed mount process. -func LocalSocketPath(volumeID string) string { +// The baseDir parameter should be the directory where sockets are stored (e.g., derived from mountEndpoint). +func LocalSocketPath(baseDir, volumeID string) string { + if baseDir == "" { + baseDir = DefaultSocketDir + } hash := util.HashToInt32([]byte(volumeID)) if hash < 0 { hash = -hash } - return fmt.Sprintf("/var/lib/seaweedfs-mount/seaweedfs-mount-%d.sock", hash) + return filepath.Join(baseDir, fmt.Sprintf("seaweedfs-mount-%d.sock", hash)) } |
