disk

package
v2.73.1+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const MaxFdiskPartitionSize = uint64(2 * 1024 * 1024 * 1024 * 1024)

Variables

View Source
var ErrGPTPartitionEncountered = errors.New("sfdisk detected a GPT partition")

Functions

func IsGPTError

func IsGPTError(err error) bool

func NewPartitionStrategy

func NewPartitionStrategy(
	retryable boshretry.Retryable,
	timeService clock.Clock,
	logger boshlog.Logger,
) boshretry.RetryStrategy

Types

type FileSystemType

type FileSystemType string
const (
	FileSystemSwap    FileSystemType = "swap"
	FileSystemExt4    FileSystemType = "ext4"
	FileSystemXFS     FileSystemType = "xfs"
	FileSystemDefault FileSystemType = ""
)

type Formatter

type Formatter interface {
	Format(partitionPath string, fsType FileSystemType) (err error)
}

func NewLinuxFormatter

func NewLinuxFormatter(runner boshsys.CmdRunner, fs boshsys.FileSystem) Formatter

type LinuxDiskManagerOpts

type LinuxDiskManagerOpts struct {
	BindMount       bool
	PartitionerType string
}

type Manager

type Manager interface {
	GetEphemeralDevicePartitioner() Partitioner
	GetFormatter() Formatter
	GetMounter() Mounter
	GetMountsSearcher() MountsSearcher
	GetPersistentDevicePartitioner() Partitioner
	GetRootDevicePartitioner() Partitioner
	GetUtil() Util
}

func NewLinuxDiskManager

func NewLinuxDiskManager(
	logger boshlog.Logger,
	runner boshsys.CmdRunner,
	fs boshsys.FileSystem,
	opts LinuxDiskManagerOpts,
) (manager Manager)

type Mount

type Mount struct {
	PartitionPath string
	MountPoint    string
}

type Mounter

type Mounter interface {
	Mount(partitionPath, mountPoint string, mountOptions ...string) (err error)
	MountFilesystem(partitionPath, mountPoint, fstype string, mountOptions ...string) (err error)
	Unmount(partitionOrMountPoint string) (didUnmount bool, err error)

	RemountAsReadonly(mountPoint string) (err error)
	Remount(fromMountPoint, toMountPoint string, mountOptions ...string) (err error)
	RemountInPlace(mountPoint string, mountOptions ...string) (err error)

	SwapOn(partitionPath string) (err error)

	IsMountPoint(path string) (parititionPath string, result bool, err error)
	IsMounted(devicePathOrMountPoint string) (result bool, err error)
}

func NewLinuxBindMounter

func NewLinuxBindMounter(delegateMounter Mounter) Mounter

func NewLinuxMounter

func NewLinuxMounter(
	runner boshsys.CmdRunner,
	mountsSearcher MountsSearcher,
	unmountRetrySleep time.Duration,
) Mounter

type MountsSearcher

type MountsSearcher interface {
	SearchMounts() ([]Mount, error)
}

func NewCmdMountsSearcher

func NewCmdMountsSearcher(runner boshsys.CmdRunner) MountsSearcher

func NewProcMountsSearcher

func NewProcMountsSearcher(fs boshsys.FileSystem) MountsSearcher

type Partition

type Partition struct {
	SizeInBytes uint64
	Type        PartitionType
}

func (Partition) String

func (p Partition) String() string

type PartitionType

type PartitionType string
const (
	PartitionTypeSwap    PartitionType = "swap"
	PartitionTypeLinux   PartitionType = "linux"
	PartitionTypeEmpty   PartitionType = "empty"
	PartitionTypeUnknown PartitionType = "unknown"
	PartitionTypeGPT     PartitionType = "gpt"
)

type Partitioner

type Partitioner interface {
	Partition(devicePath string, partitions []Partition) (err error)
	GetDeviceSizeInBytes(devicePath string) (size uint64, err error)
}

func NewPartedPartitioner

func NewPartedPartitioner(logger boshlog.Logger, cmdRunner boshsys.CmdRunner, timeService clock.Clock) Partitioner

func NewRootDevicePartitioner

func NewRootDevicePartitioner(logger boshlog.Logger, cmdRunner boshsys.CmdRunner, deltaInBytes uint64) Partitioner

func NewSfdiskPartitioner

func NewSfdiskPartitioner(logger boshlog.Logger, cmdRunner boshsys.CmdRunner, timeService clock.Clock) Partitioner

type PersistentDevicePartitioner

type PersistentDevicePartitioner struct {
	// contains filtered or unexported fields
}

func NewPersistentDevicePartitioner

func NewPersistentDevicePartitioner(
	sfDiskPartitioner Partitioner,
	partedPartitioner Partitioner,
	deviceUtil Util,
	logger logger.Logger,
) *PersistentDevicePartitioner

func (*PersistentDevicePartitioner) GetDeviceSizeInBytes

func (p *PersistentDevicePartitioner) GetDeviceSizeInBytes(devicePath string) (uint64, error)

func (*PersistentDevicePartitioner) Partition

func (p *PersistentDevicePartitioner) Partition(devicePath string, partitions []Partition) error

type Util

type Util interface {
	GetFilesContents(diskPath string, fileNames []string) (contents [][]byte, err error)
	GetBlockDeviceSize(diskPath string) (size uint64, err error)
}

func NewUtil

func NewUtil(runner boshsys.CmdRunner, mounter Mounter, fs boshsys.FileSystem, logger boshlog.Logger) Util

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL