topolvm: github.com/cybozu-go/topolvm/lvmd/command Index | Files

package command

import "github.com/cybozu-go/topolvm/lvmd/command"

Index

Package Files

lvm.go

Variables

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

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

func CallLVM Uses

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

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

type LVInfo Uses

type LVInfo map[string]string

LVInfo is a map of lv attributes to values.

type LogicalVolume Uses

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

LogicalVolume represents a logical volume.

func (*LogicalVolume) FullName Uses

func (l *LogicalVolume) FullName() string

FullName returns a vg prefixed volume name.

func (*LogicalVolume) IsSnapshot Uses

func (l *LogicalVolume) IsSnapshot() bool

IsSnapshot checks if the volume is snapshot or not.

func (*LogicalVolume) IsThin Uses

func (l *LogicalVolume) IsThin() bool

IsThin checks if the volume is thin volume or not.

func (*LogicalVolume) MajorNumber Uses

func (l *LogicalVolume) MajorNumber() uint32

MajorNumber returns the device major number.

func (*LogicalVolume) MinorNumber Uses

func (l *LogicalVolume) MinorNumber() uint32

MinorNumber returns the device minor number.

func (*LogicalVolume) Name Uses

func (l *LogicalVolume) Name() string

Name returns a volume name.

func (*LogicalVolume) Origin Uses

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

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

func (*LogicalVolume) Path Uses

func (l *LogicalVolume) Path() string

Path returns a path to the logical volume.

func (*LogicalVolume) Pool Uses

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

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

func (*LogicalVolume) Remove Uses

func (l *LogicalVolume) Remove() error

Remove this volume.

func (*LogicalVolume) Rename Uses

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

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

func (*LogicalVolume) Resize Uses

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

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

func (*LogicalVolume) Size Uses

func (l *LogicalVolume) Size() uint64

Size returns a size of the volume.

func (*LogicalVolume) Snapshot Uses

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) VG Uses

func (l *LogicalVolume) VG() *VolumeGroup

VG returns a volume group in which the volume is.

type ThinPool Uses

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

ThinPool represents a lvm thin pool.

func (*ThinPool) CreateVolume Uses

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

CreateVolume creates a thin volume from this pool.

func (*ThinPool) FullName Uses

func (t *ThinPool) FullName() string

FullName returns a VG prefixed name.

func (*ThinPool) ListVolumes Uses

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

ListVolumes lists all volumes in this thin pool.

func (*ThinPool) Name Uses

func (t *ThinPool) Name() string

Name returns thin pool name.

func (*ThinPool) Resize Uses

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

Resize the thin pool capacity.

func (*ThinPool) Size Uses

func (t *ThinPool) Size() uint64

Size returns a size of the thin pool.

func (*ThinPool) VG Uses

func (t *ThinPool) VG() *VolumeGroup

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

type VolumeGroup Uses

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

VolumeGroup represents a volume group of linux lvm.

func CreateVolumeGroup Uses

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 Uses

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

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

func ListVolumeGroups Uses

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

ListVolumeGroups lists all volume groups.

func (*VolumeGroup) CreatePool Uses

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

CreatePool creates a pool for thin-provisioning volumes.

func (*VolumeGroup) CreateVolume Uses

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

CreateVolume creates logical volume in this volume group. name is a name of creating volume. size is volume size in bytes.

func (*VolumeGroup) FindPool Uses

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

FindPool finds a named thin pool in this volume group.

func (*VolumeGroup) FindVolume Uses

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

FindVolume finds a named logical volume in this volume group.

func (*VolumeGroup) Free Uses

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

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

func (*VolumeGroup) ListPools Uses

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

ListPools lists all thin pool volumes in this volume group.

func (*VolumeGroup) ListVolumes Uses

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

ListVolumes lists all logical volumes in this volume group.

func (*VolumeGroup) Name Uses

func (g *VolumeGroup) Name() string

Name returns the volume group name.

func (*VolumeGroup) Size Uses

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

Size returns the capacity of the volume group in bytes.

Package command imports 9 packages (graph) and is imported by 1 packages. Updated 2019-08-05. Refresh now. Tools for package owners.