command

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is returned when a VG or LV is not found.

Functions

func CallLVM

func CallLVM(cmd string, args ...string) error

CallLVM calls lvm sub-commands. cmd is a name of sub-command.

Types

type LVInfo

type LVInfo map[string]string

LVInfo is a map of lv attributes to values.

type LogicalVolume

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

LogicalVolume represents a logical volume.

func (*LogicalVolume) FullName

func (l *LogicalVolume) FullName() string

FullName returns a vg prefixed volume name.

func (*LogicalVolume) IsSnapshot

func (l *LogicalVolume) IsSnapshot() bool

IsSnapshot checks if the volume is snapshot or not.

func (*LogicalVolume) IsThin

func (l *LogicalVolume) IsThin() bool

IsThin checks if the volume is thin volume or not.

func (*LogicalVolume) MajorNumber

func (l *LogicalVolume) MajorNumber() uint32

MajorNumber returns the device major number.

func (*LogicalVolume) MinorNumber

func (l *LogicalVolume) MinorNumber() uint32

MinorNumber returns the device minor number.

func (*LogicalVolume) Name

func (l *LogicalVolume) Name() string

Name returns a volume name.

func (*LogicalVolume) Origin

func (l *LogicalVolume) Origin() (*LogicalVolume, error)

Origin returns logical volume instance if this is a snapshot, or nil if not.

func (*LogicalVolume) Path

func (l *LogicalVolume) Path() string

Path returns a path to the logical volume.

func (*LogicalVolume) Pool

func (l *LogicalVolume) Pool() (*ThinPool, error)

Pool returns thin pool if this is a thin pool, or nil if not.

func (*LogicalVolume) Remove

func (l *LogicalVolume) Remove() error

Remove this volume.

func (*LogicalVolume) Rename

func (l *LogicalVolume) Rename(name string) error

Rename this volume. This method also updates properties such as Name() or Path().

func (*LogicalVolume) Resize

func (l *LogicalVolume) Resize(newSize uint64) error

Resize this volume. newSize is a new size of this volume in bytes.

func (*LogicalVolume) Size

func (l *LogicalVolume) Size() uint64

Size returns a size of the volume.

func (*LogicalVolume) Snapshot

func (l *LogicalVolume) Snapshot(name string, cowSize uint64) (*LogicalVolume, error)

Snapshot takes a snapshot of this volume.

If this is a thin-provisioning volume, snapshots can be created unconditionally. Else, snapshots can be created only for non-snapshot volumes.

func (*LogicalVolume) Tags added in v0.3.0

func (l *LogicalVolume) Tags() []string

Tags returns the tags member.

func (*LogicalVolume) VG

func (l *LogicalVolume) VG() *VolumeGroup

VG returns a volume group in which the volume is.

type ThinPool

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

ThinPool represents a lvm thin pool.

func (*ThinPool) CreateVolume

func (t *ThinPool) CreateVolume(name string, size uint64) (*LogicalVolume, error)

CreateVolume creates a thin volume from this pool.

func (*ThinPool) FullName

func (t *ThinPool) FullName() string

FullName returns a VG prefixed name.

func (*ThinPool) ListVolumes

func (t *ThinPool) ListVolumes() ([]*LogicalVolume, error)

ListVolumes lists all volumes in this thin pool.

func (*ThinPool) Name

func (t *ThinPool) Name() string

Name returns thin pool name.

func (*ThinPool) Resize

func (t *ThinPool) Resize(newSize uint64) error

Resize the thin pool capacity.

func (*ThinPool) Size

func (t *ThinPool) Size() uint64

Size returns a size of the thin pool.

func (*ThinPool) VG

func (t *ThinPool) VG() *VolumeGroup

VG returns a volume group in which the thin pool is.

type VolumeGroup

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

VolumeGroup represents a volume group of linux lvm.

func CreateVolumeGroup

func CreateVolumeGroup(name, device string) (*VolumeGroup, error)

CreateVolumeGroup calls "vgcreate" to create a volume group. name is for creating volume name. device is path to a PV.

func FindVolumeGroup

func FindVolumeGroup(name string) (*VolumeGroup, error)

FindVolumeGroup finds a named volume group. name is volume group name to look up.

func ListVolumeGroups

func ListVolumeGroups() ([]*VolumeGroup, error)

ListVolumeGroups lists all volume groups.

func (*VolumeGroup) CreatePool

func (g *VolumeGroup) CreatePool(name string, size uint64) (*ThinPool, error)

CreatePool creates a pool for thin-provisioning volumes.

func (*VolumeGroup) CreateVolume

func (g *VolumeGroup) CreateVolume(name string, size uint64, tags []string) (*LogicalVolume, error)

CreateVolume creates logical volume in this volume group. name is a name of creating volume. size is volume size in bytes. volTags is a list of tags to add to the volume.

func (*VolumeGroup) FindPool

func (g *VolumeGroup) FindPool(name string) (*ThinPool, error)

FindPool finds a named thin pool in this volume group.

func (*VolumeGroup) FindVolume

func (g *VolumeGroup) FindVolume(name string) (*LogicalVolume, error)

FindVolume finds a named logical volume in this volume group.

func (*VolumeGroup) Free

func (g *VolumeGroup) Free() (uint64, error)

Free returns the free space of the volume group in bytes.

func (*VolumeGroup) ListPools

func (g *VolumeGroup) ListPools() ([]*ThinPool, error)

ListPools lists all thin pool volumes in this volume group.

func (*VolumeGroup) ListVolumes

func (g *VolumeGroup) ListVolumes() ([]*LogicalVolume, error)

ListVolumes lists all logical volumes in this volume group.

func (*VolumeGroup) Name

func (g *VolumeGroup) Name() string

Name returns the volume group name.

func (*VolumeGroup) Size

func (g *VolumeGroup) Size() (uint64, error)

Size returns the capacity of the volume group in bytes.

Jump to

Keyboard shortcuts

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