Documentation ¶
Index ¶
- func ForceGGroupsV1() bool
- func Mount(mountpoints *Points) (err error)
- func Move(mountpoints *Points, prefix string) (err error)
- func PrefixMountTargets(mountpoints *Points, targetPrefix string) error
- func SafeUnmount(ctx context.Context, logger *log.Logger, target string) error
- func SystemPartitionMount(ctx context.Context, r runtime.Runtime, logger *log.Logger, label string, ...) (err error)
- func SystemPartitionUnmount(r runtime.Runtime, logger *log.Logger, label string) (err error)
- func Unmount(mountpoints *Points) (err error)
- func UnmountAll() error
- type Flags
- type Hook
- type Option
- func WithEncryptionConfig(cfg config.Encryption) Option
- func WithFlags(flags Flags) Option
- func WithLogger(logger *log.Logger) Option
- func WithPostUnmountHooks(hooks ...Hook) Option
- func WithPreMountHooks(hooks ...Hook) Option
- func WithPrefix(o string) Option
- func WithProjectQuota(enable bool) Option
- func WithSystemInformationGetter(getter helpers.SystemInformationGetter) Option
- type Options
- type Point
- func (p *Point) Data() string
- func (p *Point) Flags() uintptr
- func (p *Point) Fstype() string
- func (p *Point) GrowFilesystem() (err error)
- func (p *Point) IsMounted() (bool, error)
- func (p *Point) Mount() (err error)
- func (p *Point) Move(prefix string) (err error)
- func (p *Point) Repair() error
- func (p *Point) ResizePartition() (resized bool, err error)
- func (p *Point) Source() string
- func (p *Point) Target() string
- func (p *Point) Unmount() (err error)
- type PointMap
- type Points
- func BPFMountPoints() (mountpoints *Points, err error)
- func CGroupMountPoints() (mountpoints *Points, err error)
- func NewMountPoints() *Points
- func OverlayMountPoints() (mountpoints *Points, err error)
- func PseudoMountPoints() (mountpoints *Points, err error)
- func PseudoSubMountPoints() (mountpoints *Points, err error)
- func SquashfsMountPoints(prefix string) (mountpoints *Points, err error)
- func SystemMountPointsForDevice(ctx context.Context, devpath string, opts ...Option) (mountpoints *Points, err error)
- type PointsIterator
- type RetryFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForceGGroupsV1 ¶
func ForceGGroupsV1() bool
ForceGGroupsV1 returns the cgroup version to be used (only for !container mode).
func Move ¶
Move moves the device(s). TODO(andrewrynhard): We need to skip calling the move method on mountpoints that are a child of another mountpoint. The kernel will handle moving the child mountpoints for us.
func PrefixMountTargets ¶
PrefixMountTargets prefixes all mountpoints targets with fixed path.
func SafeUnmount ¶ added in v1.4.2
SafeUnmount unmounts the target path, first without force, then with force if the first attempt fails.
It makes sure that unmounting has a finite operation timeout.
func SystemPartitionMount ¶
func SystemPartitionMount(ctx context.Context, r runtime.Runtime, logger *log.Logger, label string, opts ...Option) (err error)
SystemPartitionMount mounts a system partition by the label.
func SystemPartitionUnmount ¶
SystemPartitionUnmount unmounts a system partition by the label.
func UnmountAll ¶
func UnmountAll() error
UnmountAll attempts to unmount all the mounted filesystems via "self" mountinfo.
Types ¶
type Flags ¶
type Flags uint
Flags is the mount flags.
const ( // ReadOnly is a flag for setting the mount point as readonly. ReadOnly Flags = 1 << iota Shared // Resize indicates that a the partition for a given mount point should be // resized to the maximum allowed. Resize // Overlay indicates that a the partition for a given mount point should be // mounted using overlayfs. Overlay // SystemOverlay indicates that overlay directory should be created under tmpfs. // // SystemOverlay should be combined with Overlay option. SystemOverlay // ReadonlyOverlay indicates that a the partition for a given mount point should be // mounted using multi-layer readonly overlay from multiple partitions given as sources. ReadonlyOverlay // SkipIfMounted is a flag for skipping mount if the mountpoint is already mounted. SkipIfMounted // SkipIfNoFilesystem is a flag for skipping formatting and mounting if the mountpoint has not filesystem. SkipIfNoFilesystem )
func (Flags) Intersects ¶
Intersects checks if at least one flag is set.
type Option ¶
type Option func(*Options)
Option is the functional option func.
func WithEncryptionConfig ¶
func WithEncryptionConfig(cfg config.Encryption) Option
WithEncryptionConfig partition encryption configuration.
func WithPostUnmountHooks ¶
WithPostUnmountHooks adds functions to be called after unmounting the partition.
func WithPreMountHooks ¶
WithPreMountHooks adds functions to be called before mounting the partition.
func WithPrefix ¶
WithPrefix is a functional option for setting the mount point prefix.
func WithProjectQuota ¶ added in v1.5.0
WithProjectQuota enables project quota mount option.
func WithSystemInformationGetter ¶ added in v1.5.0
func WithSystemInformationGetter(getter helpers.SystemInformationGetter) Option
WithSystemInformationGetter the function to get system information on the node.
type Options ¶
type Options struct { Loopback string Prefix string MountFlags Flags PreMountHooks []Hook PostUnmountHooks []Hook Encryption config.Encryption SystemInformationGetter helpers.SystemInformationGetter Logger *log.Logger ProjectQuota bool }
Options is the functional options struct.
func NewDefaultOptions ¶
NewDefaultOptions initializes a Options struct with default values.
type Point ¶
type Point struct { *Options // contains filtered or unexported fields }
Point represents a Linux mount point.
func NewMountPoint ¶
func NewMountPoint(source, target, fstype string, flags uintptr, data string, setters ...Option) *Point
NewMountPoint initializes and returns a Point struct.
func SystemMountPointForLabel ¶
func SystemMountPointForLabel(ctx context.Context, device *blockdevice.BlockDevice, label string, opts ...Option) (mountpoint *Point, err error)
SystemMountPointForLabel returns a mount point for the specified device and label.
func (*Point) GrowFilesystem ¶
GrowFilesystem grows a partition's filesystem to the maximum size allowed. NB: An XFS partition MUST be mounted, or this will fail.
func (*Point) Mount ¶
Mount attempts to retry a mount on EBUSY. It will attempt a retry every 100 milliseconds over the course of 5 seconds.
func (*Point) ResizePartition ¶
ResizePartition resizes a partition to the maximum size allowed.
type Points ¶
type Points struct {
// contains filtered or unexported fields
}
Points represents an ordered set of mount points.
func BPFMountPoints ¶
BPFMountPoints returns the bpf mount points.
func CGroupMountPoints ¶
CGroupMountPoints returns the cgroup mount points.
func NewMountPoints ¶
func NewMountPoints() *Points
NewMountPoints initializes and returns a Points struct.
func OverlayMountPoints ¶
OverlayMountPoints returns the mountpoints required to boot the system. These mountpoints are used as overlays on top of the read only rootfs.
func PseudoMountPoints ¶
PseudoMountPoints returns the mountpoints required to boot the system.
func PseudoSubMountPoints ¶
PseudoSubMountPoints returns the mountpoints required to boot the system.
func SquashfsMountPoints ¶
SquashfsMountPoints returns the mountpoints required to boot the system.
func SystemMountPointsForDevice ¶
func SystemMountPointsForDevice(ctx context.Context, devpath string, opts ...Option) (mountpoints *Points, err error)
SystemMountPointsForDevice returns the mountpoints required to boot the system. This function is called exclusively during installations ( both image creation and bare metall installs ). This is why we want to look up device by specified disk as well as why we don't want to grow any filesystems.
func (*Points) Iter ¶
func (p *Points) Iter() *PointsIterator
Iter initializes and returns a mount point iterator.
func (*Points) IterRev ¶
func (p *Points) IterRev() *PointsIterator
IterRev initializes and returns a mount point iterator that advances in reverse.
type PointsIterator ¶
type PointsIterator struct {
// contains filtered or unexported fields
}
PointsIterator represents an iteratable group of mount points.
func (*PointsIterator) Next ¶
func (i *PointsIterator) Next() bool
Next advances the iterator to the next value.
func (*PointsIterator) Value ¶
func (i *PointsIterator) Value() *Point
Value returns current mount point.