fix(host): cephfs mount (#22010)

This commit is contained in:
屈轩
2025-01-23 10:33:10 +08:00
committed by GitHub
parent 61998734a0
commit 0dbdf592cf
2 changed files with 15 additions and 18 deletions
+13
View File
@@ -55,6 +55,19 @@ func Mount(devPath string, mountPoint string, fsType string) error {
})
}
func MountWithParams(devPath string, mountPoint string, fsType string, opts []string) error {
return mountWrap(mountPoint, func() error {
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
args := []string{"-t", fsType, devPath, mountPoint}
args = append(args, opts...)
if out, err := procutils.NewRemoteCommandContextAsFarAsPossible(ctx, "mount", args...).Output(); err != nil {
return errors.Wrapf(err, "mount %s to %s with fs %s: %s", devPath, mountPoint, fsType, string(out))
}
return nil
})
}
func MountOverlay(lowerDir []string, upperDir string, workDir string, mergedDir string) error {
return mountOverlay(lowerDir, upperDir, workDir, mergedDir, nil)
}