devicemapper

package
v0.0.0-...-e66715b Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: Apache-2.0 Imports: 25 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoShrinkage          = errors.New("you can't shrink a device")
	ErrInvalidOption        = errors.New("invalid option")
	ErrInvalidArg           = errors.New("invalid argument")
	ErrIncompatibleSnapshot = errors.New("incompatible snapshot")
	ErrDeleteBaseDevice     = errors.New("will not attempt to delete base device")
	ErrBaseDeviceHash       = errors.New("can't load a volume that uses the base device")
	ErrThinpoolDevMismatch  = errors.New("The uuid for the provided thinpool doesn't match the previous value. Check that the specified thinpool device is correct.")
)
View Source
var (
	ErrInvalidMetadata = errors.New("invalid metadata")
	ErrNoMetadata      = errors.New("Volume does not exist or is missing metadata")
)

Functions

func GetDevicePrefix

func GetDevicePrefix(root string) (string, error)

Calculate the same device prefix as Docker, using mostly their code

func Init

func Init(root string, options []string) (volume.Driver, error)

Init initializes the devicemapper driver

func SetStorageStatsUpdateInterval

func SetStorageStatsUpdateInterval(interval int)

SetStorageStatsUpdateInterval sets the interval to update storage stats at

Types

type DeviceBlockStats

type DeviceBlockStats struct {
	DeviceID int
	// contains filtered or unexported fields
}

DeviceBlockStats represents a devicemapper device

func (*DeviceBlockStats) UniqueBlocks

func (d *DeviceBlockStats) UniqueBlocks(other *DeviceBlockStats) uint64

UniqueBlocks returns the number of unique blocks that this device has allocated compared to another device

type DeviceMapperDriver

type DeviceMapperDriver struct {
	DeviceSet    *devmapper.DeviceSet
	DevicePrefix string
	// contains filtered or unexported fields
}

func (*DeviceMapperDriver) Cleanup

func (d *DeviceMapperDriver) Cleanup() error

Cleanup implements volume.Driver.Cleanup

func (*DeviceMapperDriver) Create

func (d *DeviceMapperDriver) Create(volumeName string) (volume.Volume, error)

Create implements volume.Driver.Create

func (*DeviceMapperDriver) DeactivateDevice

func (d *DeviceMapperDriver) DeactivateDevice(deviceHash string) error

Issues the underlying dm remove operation.

func (*DeviceMapperDriver) DriverType

func (d *DeviceMapperDriver) DriverType() volume.DriverType

DriverType implements volume.Driver.DriverType

func (*DeviceMapperDriver) Exists

func (d *DeviceMapperDriver) Exists(volumeName string) bool

Exists implements volume.Driver.Exists

func (*DeviceMapperDriver) Get

func (d *DeviceMapperDriver) Get(volumeName string) (volume.Volume, error)

Get implements volume.Driver.Get

func (*DeviceMapperDriver) GetTenant

func (d *DeviceMapperDriver) GetTenant(volumeName string) (volume.Volume, error)

GetTenant implements volume.Driver.GetTenant

func (*DeviceMapperDriver) GetTenantStorageStats

func (d *DeviceMapperDriver) GetTenantStorageStats() ([]volume.TenantStorageStats, error)

GetTenantStorageStats returns storage stats for each tenant in the system.

func (*DeviceMapperDriver) List

func (d *DeviceMapperDriver) List() (result []string)

List implements volume.Driver.List

func (*DeviceMapperDriver) ListTenants

func (d *DeviceMapperDriver) ListTenants() (result []string)

func (*DeviceMapperDriver) MetadataDir

func (d *DeviceMapperDriver) MetadataDir() string

snapshotDir returns the path under which volume metadata will be stored

func (*DeviceMapperDriver) MetadataPath

func (d *DeviceMapperDriver) MetadataPath(tenant string) string

metadataPath returns the path of the json metadata file

func (*DeviceMapperDriver) Release

func (d *DeviceMapperDriver) Release(volumeName string) error

Release implements volume.Driver.Release

func (*DeviceMapperDriver) Remove

func (d *DeviceMapperDriver) Remove(volumeName string) error

Remove implements volume.Driver.Remove

func (*DeviceMapperDriver) Resize

func (d *DeviceMapperDriver) Resize(volumeName string, size uint64) error

Resize implements volume.Driver.Resize.

func (*DeviceMapperDriver) Root

func (d *DeviceMapperDriver) Root() string

Root implements volume.Driver.Root

func (*DeviceMapperDriver) Status

func (d *DeviceMapperDriver) Status() (volume.Status, error)

func (*DeviceMapperDriver) ThinpoolDevPath

func (d *DeviceMapperDriver) ThinpoolDevPath() string

ThinpoolDevPath returns the path of the saved thinpool device file

type DeviceMapperVolume

type DeviceMapperVolume struct {
	Metadata *SnapshotMetadata
	sync.Mutex
	// contains filtered or unexported fields
}

func (*DeviceMapperVolume) Driver

func (v *DeviceMapperVolume) Driver() volume.Driver

Driver implements volume.Volume.Driver

func (*DeviceMapperVolume) Export

func (v *DeviceMapperVolume) Export(label, parent string, writer io.Writer, excludes []string) error

Export implements volume.Volume.Export

func (*DeviceMapperVolume) GetSnapshotWithTag

func (v *DeviceMapperVolume) GetSnapshotWithTag(tagName string) (*volume.SnapshotInfo, error)

GetSnapshotWithTag implements volume.Volume.GetSnapshotWithTag

func (*DeviceMapperVolume) Import

func (v *DeviceMapperVolume) Import(label string, reader io.Reader) (err error)

Import implements volume.Volume.Import

func (*DeviceMapperVolume) Name

func (v *DeviceMapperVolume) Name() string

Name implements volume.Volume.Name

func (*DeviceMapperVolume) Path

func (v *DeviceMapperVolume) Path() string

Path implements volume.Volume.Path

func (*DeviceMapperVolume) ReadMetadata

func (v *DeviceMapperVolume) ReadMetadata(label, name string) (io.ReadCloser, error)

ReadMetadata reads the metadata info from a snapshot

func (*DeviceMapperVolume) RemoveSnapshot

func (v *DeviceMapperVolume) RemoveSnapshot(label string) error

RemoveSnapshot implements volume.Volume.RemoveSnapshot

func (*DeviceMapperVolume) Rollback

func (v *DeviceMapperVolume) Rollback(label string) error

Rollback implements volume.Volume.Rollback

func (*DeviceMapperVolume) SizeOf

func (v *DeviceMapperVolume) SizeOf() (uint64, error)

func (*DeviceMapperVolume) Snapshot

func (v *DeviceMapperVolume) Snapshot(label, message string, tags []string) error

Snapshot implements volume.Volume.Snapshot

func (*DeviceMapperVolume) SnapshotInfo

func (v *DeviceMapperVolume) SnapshotInfo(label string) (*volume.SnapshotInfo, error)

SnapshotInfo returns the meta info for a snapshot

func (*DeviceMapperVolume) Snapshots

func (v *DeviceMapperVolume) Snapshots() ([]string, error)

Snapshots implements volume.Volume.Snapshots

func (*DeviceMapperVolume) TagSnapshot

func (v *DeviceMapperVolume) TagSnapshot(label string, tagName string) error

TagSnapshot implements volume.Volume.TagSnapshot

func (*DeviceMapperVolume) Tenant

func (v *DeviceMapperVolume) Tenant() string

Tenant implements volume.Volume.Tenant

func (*DeviceMapperVolume) UntagSnapshot

func (v *DeviceMapperVolume) UntagSnapshot(tagName string) (string, error)

UntagSnapshot implements volume.Volume.UntagSnapshot

func (*DeviceMapperVolume) WriteMetadata

func (v *DeviceMapperVolume) WriteMetadata(label, name string) (io.WriteCloser, error)

WriteMetadata writes the metadata info for a snapshot

type RangeMapping

type RangeMapping struct {
	OriginBegin int `xml:"origin_begin,attr"`
	DataBegin   int `xml:"data_begin,attr"`
	Length      int `xml:"length,attr"`
	Time        int `xml:"time,attr"`
}

RangeMapping represents a range of blocks in a metadata xml file

type SingleMapping

type SingleMapping struct {
	OriginBlock int `xml:"origin_block,attr"`
	DataBlock   int `xml:"data_block,attr"`
	Time        int `xml:"time,attr"`
}

SingleMapping represents a single block in a metadata xml file

type SnapshotMetadata

type SnapshotMetadata struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewMetadata

func NewMetadata(path string, create bool) (*SnapshotMetadata, error)

Creates a new metadata object based on the path provided. If a metadata file does not

already exist, it will create one if create is true (else return an error)

func (*SnapshotMetadata) AddSnapshot

func (m *SnapshotMetadata) AddSnapshot(snapshot, device string) error

func (*SnapshotMetadata) CurrentDevice

func (m *SnapshotMetadata) CurrentDevice() string

Get the current device for this volume

func (*SnapshotMetadata) ListDevices

func (m *SnapshotMetadata) ListDevices() (devices []string)

func (*SnapshotMetadata) ListSnapshots

func (m *SnapshotMetadata) ListSnapshots() (snaps []string)

func (*SnapshotMetadata) LookupSnapshotDevice

func (m *SnapshotMetadata) LookupSnapshotDevice(snapshot string) (string, error)

func (*SnapshotMetadata) RemoveSnapshot

func (m *SnapshotMetadata) RemoveSnapshot(snapshot string) error

Remove snapshot info from the metadata. If the snapshot doesn't exist, it's a no-op.

func (*SnapshotMetadata) SetCurrentDevice

func (m *SnapshotMetadata) SetCurrentDevice(device string) error

func (*SnapshotMetadata) SnapshotExists

func (m *SnapshotMetadata) SnapshotExists(snapshot string) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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