Documentation
¶
Index ¶
- Constants
- Variables
- type ExitError
- type HostLVM
- func (hlvm *HostLVM) ActivateLV(ctx context.Context, lvName, vgName string) error
- func (hlvm *HostLVM) AddTagToVG(ctx context.Context, vgName string) error
- func (hlvm *HostLVM) CreateLV(ctx context.Context, lvName, vgName string, sizePercent int, ...) error
- func (hlvm *HostLVM) CreateVG(ctx context.Context, vg VolumeGroup) error
- func (hlvm *HostLVM) DeleteLV(ctx context.Context, lvName, vgName string) error
- func (hlvm *HostLVM) DeleteVG(ctx context.Context, vg VolumeGroup) error
- func (hlvm *HostLVM) ExtendLV(ctx context.Context, lvName, vgName string, sizePercent int) error
- func (hlvm *HostLVM) ExtendThinPoolMetadata(ctx context.Context, lvName, vgName string, metadataSizeBytes int64) error
- func (hlvm *HostLVM) ExtendVG(ctx context.Context, vg VolumeGroup, pvs []string) (VolumeGroup, error)
- func (hlvm *HostLVM) GetVG(ctx context.Context, name string) (VolumeGroup, error)
- func (hlvm *HostLVM) LVExists(ctx context.Context, lvName, vgName string) (bool, error)
- func (hlvm *HostLVM) ListLVs(ctx context.Context, vgName string) (*LVReport, error)
- func (hlvm *HostLVM) ListLVsByName(ctx context.Context, vgName string) ([]string, error)
- func (hlvm *HostLVM) ListPVs(ctx context.Context, vgName string) ([]PhysicalVolume, error)
- func (hlvm *HostLVM) ListVGs(ctx context.Context, tagged bool) ([]VolumeGroup, error)
- type LVM
- type LVReport
- type LVReportItem
- type LogicalVolume
- type PVReport
- type PhysicalVolume
- type VGReport
- type VolumeGroup
Constants ¶
const (
DefaultTag = "@lvms"
)
Variables ¶
var (
DefaultListLVColumns = []string{
"lv_name",
"vg_name",
"pool_lv",
"lv_attr",
"lv_size",
"metadata_percent",
"chunk_size",
"lv_metadata_size",
}
)
var (
ErrVolumeGroupNotFound = fmt.Errorf("volume group not found")
)
Functions ¶
This section is empty.
Types ¶
type HostLVM ¶
func NewDefaultHostLVM ¶
func NewDefaultHostLVM() *HostLVM
func NewHostLVM ¶
func (*HostLVM) ActivateLV ¶
ActivateLV activates the logical volume
func (*HostLVM) AddTagToVG ¶
AddTagToVG adds a lvms tag to the volume group
func (*HostLVM) CreateLV ¶
func (hlvm *HostLVM) CreateLV(ctx context.Context, lvName, vgName string, sizePercent int, chunkSizeBytes, metadataSizeBytes int64) error
CreateLV creates the logical volume
func (*HostLVM) CreateVG ¶
func (hlvm *HostLVM) CreateVG(ctx context.Context, vg VolumeGroup) error
CreateVG creates a new volume group
func (*HostLVM) DeleteVG ¶
func (hlvm *HostLVM) DeleteVG(ctx context.Context, vg VolumeGroup) error
DeleteVG deletes a volume group and the physical volumes associated with it
func (*HostLVM) ExtendLV ¶
ExtendLV extends the logical volume, sizePercent has to be calculated based on virtual gibibytes.
func (*HostLVM) ExtendThinPoolMetadata ¶ added in v4.18.0
func (*HostLVM) ExtendVG ¶
func (hlvm *HostLVM) ExtendVG(ctx context.Context, vg VolumeGroup, pvs []string) (VolumeGroup, error)
ExtendVG Extend extends the volume group only if new physical volumes are available
func (*HostLVM) ListLVsByName ¶
ListLVsByName returns list of logical volumes for a volume group
type LVM ¶
type LVM interface {
CreateVG(ctx context.Context, vg VolumeGroup) error
ExtendVG(ctx context.Context, vg VolumeGroup, pvs []string) (VolumeGroup, error)
AddTagToVG(ctx context.Context, vgName string) error
DeleteVG(ctx context.Context, vg VolumeGroup) error
GetVG(ctx context.Context, name string) (VolumeGroup, error)
ListPVs(ctx context.Context, vgName string) ([]PhysicalVolume, error)
ListVGs(ctx context.Context, taggedByLVMS bool) ([]VolumeGroup, error)
ListLVsByName(ctx context.Context, vgName string) ([]string, error)
ListLVs(ctx context.Context, vgName string) (*LVReport, error)
LVExists(ctx context.Context, lvName, vgName string) (bool, error)
CreateLV(ctx context.Context, lvName, vgName string, sizePercent int, chunkSizeBytes, metadataSizeBytes int64) error
ExtendLV(ctx context.Context, lvName, vgName string, sizePercent int) error
ExtendThinPoolMetadata(ctx context.Context, lvName, vgName string, metadataSizeBytes int64) error
ActivateLV(ctx context.Context, lvName, vgName string) error
DeleteLV(ctx context.Context, lvName, vgName string) error
}
type LVReport ¶
type LVReport struct {
Report []LVReportItem `json:"report"`
}
LVReport represents the output of the `lvs --reportformat json` command
type LVReportItem ¶
type LVReportItem struct {
Lv []LogicalVolume `json:"lv"`
}
type LogicalVolume ¶
type LogicalVolume struct {
Name string `json:"lv_name"`
VgName string `json:"vg_name"`
PoolName string `json:"pool_lv"`
LvAttr string `json:"lv_attr"`
LvSize string `json:"lv_size"`
MetadataPercent string `json:"metadata_percent"`
ChunkSize string `json:"chunk_size"`
MetadataSize string `json:"lv_metadata_size"`
}
type PVReport ¶
type PVReport struct {
Report []struct {
Pv []PhysicalVolume `json:"pv"`
} `json:"report"`
}
PVReport represents the output of the `pvs --reportformat json` command
type PhysicalVolume ¶
type PhysicalVolume struct {
// PvName is the name of the Physical Volume
PvName string `json:"pv_name"`
// UUID is the unique identifier of the Physical Volume used in the devices file
UUID string `json:"pv_uuid"`
// VgName is the name of the associated Volume Group, if any
VgName string `json:"vg_name"`
// PvFmt is the file format of the PhysicalVolume
PvFmt string `json:"pv_fmt"`
// PvAttr describes the attributes of the PhysicalVolume
PvAttr string `json:"pv_attr"`
// PvSize describes the total space of the PhysicalVolume
PvSize string `json:"pv_size"`
// PvFree describes the free space of the PhysicalVolume
PvFree string `json:"pv_free"`
// DevSize describes the size of the underlying device on which the PhysicalVolume was created
DevSize string `json:"dev_size"`
}
PhysicalVolume represents a physical volume of linux lvm.
type VGReport ¶
type VGReport struct {
Report []struct {
Vg []struct {
Name string `json:"vg_name"`
VgSize string `json:"vg_size"`
Tags string `json:"vg_tags"`
} `json:"vg"`
} `json:"report"`
}
VGReport represents the output of the `vgs --reportformat json` command
type VolumeGroup ¶
type VolumeGroup struct {
// Name is the name of the volume group
Name string `json:"vg_name"`
// VgSize is the size of the volume group
VgSize string `json:"vg_size"`
// PVs is the list of physical volumes associated with the volume group
PVs []PhysicalVolume `json:"pvs"`
// Tags is the list of tags associated with the volume group
Tags []string `json:"vg_tags"`
}
VolumeGroup represents a volume group of linux lvm.