Documentation ¶
Index ¶
- Variables
- func CallLVM(cmd string, args ...string) error
- type LVInfo
- type LogicalVolume
- func (l *LogicalVolume) FullName() string
- func (l *LogicalVolume) IsSnapshot() bool
- func (l *LogicalVolume) IsThin() bool
- func (l *LogicalVolume) MajorNumber() uint32
- func (l *LogicalVolume) MinorNumber() uint32
- func (l *LogicalVolume) Name() string
- func (l *LogicalVolume) Origin() (*LogicalVolume, error)
- func (l *LogicalVolume) Path() string
- func (l *LogicalVolume) Pool() (*ThinPool, error)
- func (l *LogicalVolume) Remove() error
- func (l *LogicalVolume) Rename(name string) error
- func (l *LogicalVolume) Resize(newSize uint64) error
- func (l *LogicalVolume) Size() uint64
- func (l *LogicalVolume) Snapshot(name string, cowSize uint64) (*LogicalVolume, error)
- func (l *LogicalVolume) Tags() []string
- func (l *LogicalVolume) VG() *VolumeGroup
- type ThinPool
- func (t *ThinPool) CreateVolume(name string, size uint64) (*LogicalVolume, error)
- func (t *ThinPool) FullName() string
- func (t *ThinPool) ListVolumes() ([]*LogicalVolume, error)
- func (t *ThinPool) Name() string
- func (t *ThinPool) Resize(newSize uint64) error
- func (t *ThinPool) Size() uint64
- func (t *ThinPool) VG() *VolumeGroup
- type VolumeGroup
- func (g *VolumeGroup) CreatePool(name string, size uint64) (*ThinPool, error)
- func (g *VolumeGroup) CreateVolume(name string, size uint64, tags []string) (*LogicalVolume, error)
- func (g *VolumeGroup) FindPool(name string) (*ThinPool, error)
- func (g *VolumeGroup) FindVolume(name string) (*LogicalVolume, error)
- func (g *VolumeGroup) Free() (uint64, error)
- func (g *VolumeGroup) ListPools() ([]*ThinPool, error)
- func (g *VolumeGroup) ListVolumes() ([]*LogicalVolume, error)
- func (g *VolumeGroup) Name() string
- func (g *VolumeGroup) Size() (uint64, error)
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound is returned when a VG or LV is not found.
Functions ¶
Types ¶
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) 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) 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) ListVolumes ¶
func (t *ThinPool) ListVolumes() ([]*LogicalVolume, error)
ListVolumes lists all volumes in this 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) Size ¶
func (g *VolumeGroup) Size() (uint64, error)
Size returns the capacity of the volume group in bytes.