feat: init

This commit is contained in:
2026-06-06 06:15:45 +03:30
commit a986de98b0
33 changed files with 2141 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
//go:build !linux
package driver
import (
"fmt"
mount "k8s.io/mount-utils"
utilexec "k8s.io/utils/exec"
)
const defaultLinuxFsType = "ext4"
func newMounter() *mount.SafeFormatAndMount {
return mount.NewSafeFormatAndMount(mount.New(""), utilexec.New())
}
func findDiskByLUN(lun int) (string, error) {
return "", fmt.Errorf("scsi volume mount is only supported on linux (lun %d)", lun)
}
func formatAndMount(source, target, fsType string, options []string, mounter *mount.SafeFormatAndMount) error {
return mounter.FormatAndMount(source, target, fsType, options)
}
func cleanupMountPoint(target string, mounter *mount.SafeFormatAndMount) error {
return mount.CleanupMountPoint(target, mounter, true)
}
func bindMount(source, target string) error {
m := newMounter()
return m.Mount(source, target, "", []string{"bind"})
}
func isMounted(path string) bool {
m := newMounter()
notMnt, err := m.IsLikelyNotMountPoint(path)
return err == nil && !notMnt
}