Documentation
¶
Index ¶
- Constants
- func DetermineFSType(publishInfoType, existingType, volumeMode string) (string, error)
- func GetDeviceFilePath(ctx context.Context, path, volumeId string) (string, error)
- func ValidateOctalUnixPermissions(perms string) error
- func VerifyFilesystemSupport(fs string) (string, error)
- type FSClient
- func (f *FSClient) DeleteFile(ctx context.Context, filepath, fileDescription string) (string, error)
- func (f *FSClient) ExpandFilesystemOnNode(ctx context.Context, publishInfo *models.VolumePublishInfo, ...) (int64, error)
- func (f *FSClient) FormatVolume(ctx context.Context, device, fstype, options string) error
- func (f *FSClient) GetDFOutput(ctx context.Context) ([]models.DFInfo, error)
- func (f *FSClient) GetFilesystemSize(ctx context.Context, path string) (int64, error)
- func (f *FSClient) GetFilesystemStats(ctx context.Context, path string) (available, capacity, usage, inodes, inodesFree, inodesUsed int64, err error)
- func (f *FSClient) GetUnmountPath(ctx context.Context, trackingInfo *models.VolumeTrackingInfo) (string, error)
- func (f *FSClient) RepairVolume(ctx context.Context, device, fstype string)
- func (f *FSClient) ScanDir(path string) ([]os.FileInfo, error)
- func (f *FSClient) ScanFile(filename string) ([]byte, error)
- type Filesystem
- type JSONReaderWriter
- type Mount
Constants ¶
const ( // Filesystem types Xfs = "xfs" Ext3 = "ext3" Ext4 = "ext4" Raw = "raw" UnknownFstype = "<unknown>" )
const (
FormatOptionsSeparator = " "
)
Variables ¶
This section is empty.
Functions ¶
func DetermineFSType ¶
DetermineFSType resolves the effective filesystem type to use for a volume. Priority order:
- publishInfoType — use it as-is when provided (explicit caller intent).
- existingType — adopt the type already on disk when it is known (non-empty, non-UnknownFstype), so that subsequent format/mount logic stays consistent.
- volumeMode fallback — when no usable on-disk type is available, default to ext4 for Filesystem volumes or raw for Block volumes. A Filesystem volume whose on-disk type is UnknownFstype still defaults to ext4 but also returns an error because the LUN's existing format is unrecognisable.
func GetDeviceFilePath ¶
GetDeviceFilePath returns the staging path for volume.
func VerifyFilesystemSupport ¶
VerifyFilesystemSupport checks for a supported file system type
Types ¶
type FSClient ¶
type FSClient struct {
// contains filtered or unexported fields
}
func NewDetailed ¶
func (*FSClient) DeleteFile ¶
func (f *FSClient) DeleteFile(ctx context.Context, filepath, fileDescription string) (string, error)
DeleteFile deletes the file at the provided path, and provides additional logging.
func (*FSClient) ExpandFilesystemOnNode ¶
func (f *FSClient) ExpandFilesystemOnNode( ctx context.Context, publishInfo *models.VolumePublishInfo, devicePath, stagedTargetPath, fsType, mountOptions string, targetSizeBytes int64, ) (int64, error)
ExpandFilesystemOnNode expands the filesystem after the volume capacity step.
func (*FSClient) FormatVolume ¶
FormatVolume creates a filesystem for the supplied device of the supplied type.
func (*FSClient) GetDFOutput ¶
GetDFOutput returns parsed DF output
func (*FSClient) GetFilesystemSize ¶
GetFilesystemSize returns the total capacity in bytes of the filesystem at the given path.
func (*FSClient) GetFilesystemStats ¶
func (f *FSClient) GetFilesystemStats( ctx context.Context, path string, ) (available, capacity, usage, inodes, inodesFree, inodesUsed int64, err error)
GetFilesystemStats returns the size of the filesystem for the given path. The caller of the func is responsible for verifying the mountPoint existence and readiness.
func (*FSClient) GetUnmountPath ¶
func (f *FSClient) GetUnmountPath(ctx context.Context, trackingInfo *models.VolumeTrackingInfo) (string, error)
GetUnmountPath is a dummy added for compilation
func (*FSClient) RepairVolume ¶
RepairVolume runs fsck on a volume. This is best-effort, does not return error.
type Filesystem ¶
type Filesystem interface {
GetDFOutput(ctx context.Context) ([]models.DFInfo, error)
FormatVolume(ctx context.Context, device, fstype, options string) error
RepairVolume(ctx context.Context, device, fstype string)
ExpandFilesystemOnNode(
ctx context.Context, publishInfo *models.VolumePublishInfo, devicePath, stagedTargetPath, fsType, mountOptions string,
targetSizeBytes int64,
) (int64, error)
DeleteFile(ctx context.Context, filepath, fileDescription string) (string, error)
GetFilesystemStats(
ctx context.Context, path string,
) (available, capacity, usage, inodes, inodesFree, inodesUsed int64, err error)
GetFilesystemSize(ctx context.Context, path string) (int64, error)
GetUnmountPath(ctx context.Context, trackingInfo *models.VolumeTrackingInfo) (string, error)
ScanFile(filename string) ([]byte, error)
ScanDir(path string) ([]os.FileInfo, error)
}
type JSONReaderWriter ¶
type JSONReaderWriter interface {
WriteJSONFile(ctx context.Context, fileContents interface{}, filepath, fileDescription string) error
ReadJSONFile(ctx context.Context, fileContents interface{}, filepath, fileDescription string) error
}
func NewJSONReaderWriter ¶
func NewJSONReaderWriter(osFs afero.Fs) JSONReaderWriter