feat!: remove the rsync backend
The native libcephfs backend is the only transfer path. The rsync transport, the mounted-filesystem access and its helpers (mount check, path resolution below a mount, mount claim, quota and hardlink repair through the mount) are removed, together with the rsync lab test and the client image that only added rsync. The claim and release tests now exercise the native claim through a local test file system with real flock locks. BREAKING CHANGE: "backend": "rsync" and the endpoint field "mount" are rejected. "backend" is optional and only accepts "native"; jobs created with "native" resume without it. Journals of rsync jobs cannot be resumed. Builds without the build tag ceph only support doctor and status. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f0ea1fd7cd
commit
330a3ec12c
31 files changed
+263
-1522
No files matched your search
@@ -11,8 +11,7 @@ import (
|
||||
)
|
||||
|
||||
// Endpoint describes how to reach one side of a migration: the Ceph
|
||||
// client identity and configuration, the subvolume and, for the rsync
|
||||
// backend, the local mount of the CephFS filesystem root.
|
||||
// client identity and configuration and the subvolume.
|
||||
type Endpoint struct {
|
||||
User string `json:"user,omitempty"`
|
||||
Config string `json:"config"`
|
||||
@@ -20,11 +19,10 @@ type Endpoint struct {
|
||||
Filesystem string `json:"filesystem"`
|
||||
Group string `json:"group"`
|
||||
Subvolume string `json:"subvolume"`
|
||||
Mount string `json:"mount,omitempty"`
|
||||
}
|
||||
|
||||
// Config is the JSON migration configuration read by ReadConfig.
|
||||
// Backend selects "native" (libcephfs) or "rsync" (the default).
|
||||
// Backend is optional; the only backend is "native" (libcephfs).
|
||||
type Config struct {
|
||||
Backend string `json:"backend,omitempty"`
|
||||
Workers int `json:"workers,omitempty"`
|
||||
@@ -77,8 +75,8 @@ func validName(s string) bool {
|
||||
// Validate checks names, paths, worker and bandwidth limits and reports
|
||||
// the first problem found.
|
||||
func (c Config) Validate() error {
|
||||
if c.Backend != "" && c.Backend != "rsync" && c.Backend != "native" {
|
||||
return errors.New("backend must be native or rsync")
|
||||
if c.Backend != "" && c.Backend != "native" {
|
||||
return errors.New(`backend must be "native"; the rsync backend was removed`)
|
||||
}
|
||||
|
||||
if c.Workers < 0 || c.Workers > 64 {
|
||||
@@ -103,12 +101,7 @@ func (c Config) Validate() error {
|
||||
return fmt.Errorf("%s: invalid group", p.name)
|
||||
}
|
||||
|
||||
paths := []string{p.e.Config, p.e.Keyring}
|
||||
if c.Backend != "native" || p.e.Mount != "" {
|
||||
paths = append(paths, p.e.Mount)
|
||||
}
|
||||
|
||||
for _, path := range paths {
|
||||
for _, path := range []string{p.e.Config, p.e.Keyring} {
|
||||
if !filepath.IsAbs(path) || filepath.Clean(path) != path {
|
||||
return fmt.Errorf("%s: paths must be absolute and clean: %q", p.name, path)
|
||||
}
|
||||
@@ -119,45 +112,5 @@ func (c Config) Validate() error {
|
||||
return errors.New("bandwidth_kib must be nonnegative and fit in bytes per second")
|
||||
}
|
||||
|
||||
if c.Backend != "native" && overlaps(c.Source.Mount, c.Target.Mount) {
|
||||
return errors.New("source and target mounts must not overlap")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func beneath(root, path string) bool {
|
||||
rel, err := filepath.Rel(root, path)
|
||||
return err == nil && rel != ".." && !strings.HasPrefix(rel, ".."+string(filepath.Separator))
|
||||
}
|
||||
|
||||
func overlaps(a, b string) bool { return beneath(a, b) || beneath(b, a) }
|
||||
|
||||
// dataPath resolves cephPath to a real directory below the filesystem mount
|
||||
// root. No symlink component is permitted, including in the mount path.
|
||||
func dataPath(root, cephPath string) (string, error) {
|
||||
if !filepath.IsAbs(cephPath) || filepath.Clean(cephPath) != cephPath || cephPath == "/" {
|
||||
return "", fmt.Errorf("invalid Ceph path %q", cephPath)
|
||||
}
|
||||
|
||||
p := filepath.Join(root, strings.TrimPrefix(cephPath, "/"))
|
||||
resolved, err := filepath.EvalSymlinks(p)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if resolved != p || !beneath(root, p) {
|
||||
return "", fmt.Errorf("path escapes mount or contains symlinks: %q", p)
|
||||
}
|
||||
|
||||
st, err := os.Stat(p)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if !st.IsDir() {
|
||||
return "", fmt.Errorf("not a directory: %s", p)
|
||||
}
|
||||
|
||||
return p, nil
|
||||
}
|
||||
Reference in new issue
Block a user