Documentation ¶
Index ¶
- Constants
- Variables
- func IsLogicalVolumeNotFound(err error) bool
- func IsPhysicalVolumeNotFound(err error) bool
- func IsVolumeGroupNotFound(err error) bool
- func ListVolumeGroupNames() ([]string, error)
- func ListVolumeGroupUUIDs() ([]string, error)
- func PVScan(dev string) error
- func VGScan(name string) error
- func ValidateLogicalVolumeName(name string) error
- func ValidateTag(tag string) error
- func ValidateVolumeGroupName(name string) error
- type LogicalVolume
- func (lv *LogicalVolume) Expand(size uint64) error
- func (lv *LogicalVolume) IsSnapshot() bool
- func (lv *LogicalVolume) Name() string
- func (lv *LogicalVolume) OriginLVName() string
- func (lv *LogicalVolume) Path() (string, error)
- func (lv *LogicalVolume) Remove() error
- func (lv *LogicalVolume) SizeInBytes() uint64
- func (lv *LogicalVolume) Usage() float64
- type PhysicalVolume
- type VolumeGroup
- func (vg *VolumeGroup) BytesFree() (uint64, error)
- func (vg *VolumeGroup) BytesTotal() (uint64, error)
- func (vg *VolumeGroup) Check() error
- func (vg *VolumeGroup) CreateLogicalVolume(name string, sizeInBytes uint64, tags []string) (*LogicalVolume, error)
- func (vg *VolumeGroup) ExtentCount() (uint64, error)
- func (vg *VolumeGroup) ExtentFreeCount() (uint64, error)
- func (vg *VolumeGroup) ExtentSize() (uint64, error)
- func (vg *VolumeGroup) ListLogicalVolumeNames() ([]string, error)
- func (vg *VolumeGroup) ListPhysicalVolumeNames() ([]string, error)
- func (vg *VolumeGroup) LookupLogicalVolume(name string) (*LogicalVolume, error)
- func (vg *VolumeGroup) Name() string
- func (vg *VolumeGroup) Remove() error
Constants ¶
const ErrInvalidLVName = simpleError("lvm: Name contains invalid character, valid set includes: [A-Za-z0-9_+.-]")
const ErrInvalidVGName = simpleError("lvm: Name contains invalid character, valid set includes: [A-Za-z0-9_+.-]")
const ErrLogicalVolumeNotFound = simpleError("lvm: logical volume not found")
const ErrNoSpace = simpleError("lvm: not enough free space")
const ErrPhysicalVolumeNotFound = simpleError("lvm: physical volume not found")
const ErrTagHasInvalidChars = simpleError("lvm: Tag must consist of only [A-Za-z0-9_+.-] and cannot start with a '-'")
const ErrTagInvalidLength = simpleError("lvm: Tag length must be between 1 and 1024 characters")
const ErrVolumeGroupNotFound = simpleError("lvm: volume group not found")
const MaxSize uint64 = 0
MaxSize states that all available space should be used by the create operation.
Variables ¶
var Verbose bool
Control verbose output of all LVM CLI commands
Functions ¶
func IsLogicalVolumeNotFound ¶
func IsVolumeGroupNotFound ¶
func ListVolumeGroupNames ¶
ListVolumeGroupNames returns the names of the list of volume groups. This does not normally scan for devices. To scan for devices, use the `Scan()` function.
func ListVolumeGroupUUIDs ¶
ListVolumeGroupUUIDs returns the UUIDs of the list of volume groups. This does not normally scan for devices. To scan for devices, use the `Scan()` function.
func PVScan ¶
PVScan runs the `pvscan --cache <dev>` command. It scans for the device at `dev` and adds it to the LVM metadata cache if `lvmetad` is running. If `dev` is an empty string, it scans all devices.
func VGScan ¶
VGScan runs the `vgscan --cache <name>` command. It scans for the volume group and adds it to the LVM metadata cache if `lvmetad` is running. If `name` is an empty string, it scans all volume groups.
func ValidateLogicalVolumeName ¶
ValidateLogicalVolumeName validates a volume group name. A valid volume group name can consist of a limited range of characters only. The allowed characters are [A-Za-z0-9_+.-].
func ValidateTag ¶
ValidateTag validates a tag. LVM tags are strings of up to 1024 characters. LVM tags cannot start with a hyphen. A valid tag can consist of a limited range of characters only. The allowed characters are [A-Za-z0-9_+.-]. As of the Red Hat Enterprise Linux 6.1 release, the list of allowed characters was extended, and tags can contain the /, =, !, :, #, and & characters. See https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/logical_volume_manager_administration/lvm_tags
func ValidateVolumeGroupName ¶
ValidateVolumeGroupName validates a volume group name. A valid volume group name can consist of a limited range of characters only. The allowed characters are [A-Za-z0-9_+.-].
Types ¶
type LogicalVolume ¶
type LogicalVolume struct {
// contains filtered or unexported fields
}
func (*LogicalVolume) Expand ¶
func (lv *LogicalVolume) Expand(size uint64) error
func (*LogicalVolume) IsSnapshot ¶
func (lv *LogicalVolume) IsSnapshot() bool
func (*LogicalVolume) Name ¶
func (lv *LogicalVolume) Name() string
func (*LogicalVolume) OriginLVName ¶
func (lv *LogicalVolume) OriginLVName() string
func (*LogicalVolume) Path ¶
func (lv *LogicalVolume) Path() (string, error)
Path returns the device path for the logical volume.
func (*LogicalVolume) Remove ¶
func (lv *LogicalVolume) Remove() error
func (*LogicalVolume) SizeInBytes ¶
func (lv *LogicalVolume) SizeInBytes() uint64
func (*LogicalVolume) Usage ¶
func (lv *LogicalVolume) Usage() float64
type PhysicalVolume ¶
type PhysicalVolume struct {
// contains filtered or unexported fields
}
func CreatePhysicalVolume ¶
func CreatePhysicalVolume(dev string, force bool) (*PhysicalVolume, error)
CreatePhysicalVolume creates a physical volume of the given device.
func ListPhysicalVolumes ¶
func ListPhysicalVolumes() ([]*PhysicalVolume, error)
ListPhysicalVolumes lists all physical volumes.
func LookupPhysicalVolume ¶
func LookupPhysicalVolume(name string) (*PhysicalVolume, error)
LookupPhysicalVolume returns a physical volume with the given name.
func (*PhysicalVolume) Check ¶
func (pv *PhysicalVolume) Check() error
Check runs the pvck command on the physical volume.
func (*PhysicalVolume) Remove ¶
func (pv *PhysicalVolume) Remove() error
Remove removes the physical volume.
type VolumeGroup ¶
type VolumeGroup struct {
// contains filtered or unexported fields
}
func CreateVolumeGroup ¶
func CreateVolumeGroup( name string, pvs []*PhysicalVolume, tags []string, force bool) (*VolumeGroup, error)
CreateVolumeGroup creates a new volume group.
func LookupVolumeGroup ¶
func LookupVolumeGroup(name string) (*VolumeGroup, error)
LookupVolumeGroup returns the volume group with the given name.
func (*VolumeGroup) BytesFree ¶
func (vg *VolumeGroup) BytesFree() (uint64, error)
BytesFree returns the unallocated space in bytes of the volume group.
func (*VolumeGroup) BytesTotal ¶
func (vg *VolumeGroup) BytesTotal() (uint64, error)
BytesTotal returns the current size in bytes of the volume group.
func (*VolumeGroup) Check ¶
func (vg *VolumeGroup) Check() error
Check runs the vgck command on the volume group.
func (*VolumeGroup) CreateLogicalVolume ¶
func (vg *VolumeGroup) CreateLogicalVolume(name string, sizeInBytes uint64, tags []string) (*LogicalVolume, error)
CreateLogicalVolume creates a logical volume of the given device and size.
The actual size may be larger than asked for as the smallest increment is the size of an extent on the volume group in question.
If sizeInBytes is zero the entire available space is allocated.
func (*VolumeGroup) ExtentCount ¶
func (vg *VolumeGroup) ExtentCount() (uint64, error)
ExtentCount returns the number of extents.
func (*VolumeGroup) ExtentFreeCount ¶
func (vg *VolumeGroup) ExtentFreeCount() (uint64, error)
ExtentFreeCount returns the number of free extents.
func (*VolumeGroup) ExtentSize ¶
func (vg *VolumeGroup) ExtentSize() (uint64, error)
ExtentSize returns the size in bytes of a single extent.
func (*VolumeGroup) ListLogicalVolumeNames ¶
func (vg *VolumeGroup) ListLogicalVolumeNames() ([]string, error)
ListLogicalVolumes returns the names of the logical volumes in this volume group.
func (*VolumeGroup) ListPhysicalVolumeNames ¶
func (vg *VolumeGroup) ListPhysicalVolumeNames() ([]string, error)
ListPhysicalVolumeNames returns the names of the physical volumes in this volume group.
func (*VolumeGroup) LookupLogicalVolume ¶
func (vg *VolumeGroup) LookupLogicalVolume(name string) (*LogicalVolume, error)
LookupLogicalVolume looks up the logical volume in the volume group with the given name.
func (*VolumeGroup) Name ¶
func (vg *VolumeGroup) Name() string
func (*VolumeGroup) Remove ¶
func (vg *VolumeGroup) Remove() error
Remove removes the volume group from disk.