Documentation ¶
Overview ¶
Package lvm2go implements a Go API for the lvm2 command line tools.
The API is designed to be simple and easy to use, while still providing access to the full functionality of the LVM2 command line tools.
Compared to a simple command line wrapper, lvm2go provides a more structured way to interact with lvm2, and allows for more complex interactions while safeguarding typing and allowing for fine-grained control over the input of various usually problematic parameters, such as sizes (and their conversion), validation of input parameters, and caching of data.
A simple usage example:
func main() { // Create a new LVM client c, err := lvm2go.NewClient() if err != nil { panic(err) } // List all volume groups vgs, err := c.VGs() if err != nil { panic(err) } // Create a new Logical Volume in the first group if err = c.LVCreate( LogicalVolumeName("mylv"), VolumeGroupName(vgs[0].Name), MustParseSize("1G"), ); err != nil { panic(err) } }
Index ¶
- Constants
- Variables
- func CommandContext(ctx context.Context, cmd string, args ...string) *exec.Cmd
- func CommandWithCustomEnvironment(ctx context.Context, cmd *exec.Cmd) *exec.Cmd
- func DefaultVersionOutputProcessor() (*Version, RawOutputProcessor)
- func DefaultVolumeGroup(ctx context.Context) string
- func GetCustomEnvironment(ctx context.Context) map[string]string
- func GetFromRawConfig[T any](config RawConfig, key string) (T, error)
- func GetLVMPath() string
- func GetProcessCancelWaitDelay(ctx context.Context) time.Duration
- func IsConfigurationSectionNotCustomizableByProfile(err error) bool
- func IsContainerized(ctx context.Context) bool
- func IsCouldNotFindDeviceWithUUID(err error) bool
- func IsDeviceNotFound(err error) bool
- func IsLVMError(err error, pattern *regexp.Regexp) bool
- func IsLogicalVolumeNotFound(err error) bool
- func IsMaximumLogicalVolumesReached(err error) bool
- func IsMaximumPhysicalVolumesReached(err error) bool
- func IsNoDataToMove(err error) bool
- func IsNoFreeExtents(err error) bool
- func IsNoSuchCommand(err error) bool
- func IsNotFound(err error) bool
- func IsPartialLVNeedsRepairOrRemove(err error) bool
- func IsThereAreStillPartialLVs(err error) bool
- func IsUnitOrDigit(unit Unit) bool
- func IsVGImmutableDueToMissingPVs(err error) bool
- func IsVGMissingPVs(err error) bool
- func IsVolumeGroupNotFound(err error) bool
- func NewContextPropagatingSlogHandler(handler slog.Handler) slog.Handler
- func NewTestingHandler(tb testing.TB) slog.Handler
- func SetLVMPath(path string)
- func SetProcessCancelWaitDelay(ctx context.Context, delay time.Duration) context.Context
- func SetUseStandardLocale(use bool)
- func StreamedCommand(ctx context.Context, cmd *exec.Cmd) (io.ReadCloser, error)
- func SymboledTag(tag string) string
- func UseStandardLocale() bool
- func VGMissingPVsDetails(err error) (vg string, pv string, lastWrittenTo string, ok bool)
- func WithCustomEnvironment(ctx context.Context, env map[string]string) context.Context
- func WithDefaultVolumeGroup(ctx context.Context, vg string) context.Context
- func WithValue(parent context.Context, key string, val any) context.Context
- type ActivationMode
- type ActivationState
- type AllocationPolicy
- func (opt AllocationPolicy) ApplyToArgs(args Arguments) error
- func (opt AllocationPolicy) ApplyToLVChangeOptions(opts *LVCreateOptions)
- func (opt AllocationPolicy) ApplyToLVCreateOptions(opts *LVCreateOptions)
- func (opt AllocationPolicy) ApplyToPVMoveOptions(opts *PVMoveOptions)
- func (opt AllocationPolicy) ApplyToVGChangeOptions(opts *VGChangeOptions)
- func (opt AllocationPolicy) ApplyToVGCreateOptions(opts *VGCreateOptions)
- type ArgsType
- type Argument
- type ArgumentGenerator
- type Arguments
- type AutoActivation
- type AutoActivationFromReport
- type ChunkSize
- type Client
- type ClusteredOrShared
- type ColumnOptions
- type CommonOptions
- type Compression
- type ConfigOption
- type ConfigOptions
- type ConfigOptionsList
- type ConfigType
- type ContextPropagatingSlogHandler
- func (h *ContextPropagatingSlogHandler) Enabled(ctx context.Context, level slog.Level) bool
- func (h *ContextPropagatingSlogHandler) Handle(ctx context.Context, record slog.Record) error
- func (h *ContextPropagatingSlogHandler) WithAttrs(attrs []slog.Attr) slog.Handler
- func (h *ContextPropagatingSlogHandler) WithGroup(name string) slog.Handler
- type DataAlignment
- type DataAlignmentOffset
- type Deduplication
- type DelTags
- type DeleteNotFound
- type DevCheckOption
- type DevCheckOptions
- type DevCheckOptionsList
- type DevListOption
- type DevListOptions
- type DevListOptionsList
- type DevModifyOption
- type DevModifyOptions
- type DevModifyOptionsList
- type DevUpdateOption
- type DevUpdateOptions
- type DevUpdateOptionsList
- type DeviceIDType
- type DeviceList
- type DeviceListEntry
- type Devices
- func (opt Devices) ApplyToArgs(args Arguments) error
- func (opt Devices) ApplyToLVChangeOptions(opts *LVChangeOptions)
- func (opt Devices) ApplyToLVCreateOptions(opts *LVCreateOptions)
- func (opt Devices) ApplyToLVExtendOptions(opts *LVExtendOptions)
- func (opt Devices) ApplyToLVReduceOptions(opts *LVReduceOptions)
- func (opt Devices) ApplyToLVRemoveOptions(opts *LVRemoveOptions)
- func (opt Devices) ApplyToLVRenameOptions(opts *LVRenameOptions)
- func (opt Devices) ApplyToLVResizeOptions(opts *LVResizeOptions)
- func (opt Devices) ApplyToLVsOptions(opts *LVsOptions)
- func (opt Devices) ApplyToPVChangeOptions(opts *PVChangeOptions)
- func (opt Devices) ApplyToPVCreateOptions(opts *PVCreateOptions)
- func (opt Devices) ApplyToPVMoveOptions(opts *PVMoveOptions)
- func (opt Devices) ApplyToPVRemoveOptions(opts *PVRemoveOptions)
- func (opt Devices) ApplyToPVResizeOptions(opts *PVResizeOptions)
- func (opt Devices) ApplyToPVsOptions(opts *PVsOptions)
- func (opt Devices) ApplyToVGChangeOptions(opts *VGChangeOptions)
- func (opt Devices) ApplyToVGCreateOptions(opts *VGCreateOptions)
- func (opt Devices) ApplyToVGExtendOptions(opts *VGExtendOptions)
- func (opt Devices) ApplyToVGReduceOptions(opts *VGReduceOptions)
- func (opt Devices) ApplyToVGRemoveOptions(opts *VGRemoveOptions)
- func (opt Devices) ApplyToVGRenameOptions(opts *VGRenameOptions)
- func (opt Devices) ApplyToVGsOptions(opts *VGsOptions)
- type DevicesClient
- type DevicesFile
- func (opt DevicesFile) ApplyToArgs(args Arguments) error
- func (opt DevicesFile) ApplyToDevListOptions(opts *DevListOptions)
- func (opt DevicesFile) ApplyToDevModifyOptions(opts *DevModifyOptions)
- func (opt DevicesFile) ApplyToLVChangeOptions(opts *LVChangeOptions)
- func (opt DevicesFile) ApplyToLVCreateOptions(opts *LVCreateOptions)
- func (opt DevicesFile) ApplyToLVExtendOptions(opts *LVExtendOptions)
- func (opt DevicesFile) ApplyToLVReduceOptions(opts *LVReduceOptions)
- func (opt DevicesFile) ApplyToLVRemoveOptions(opts *LVRemoveOptions)
- func (opt DevicesFile) ApplyToLVRenameOptions(opts *LVRenameOptions)
- func (opt DevicesFile) ApplyToLVResizeOptions(opts *LVResizeOptions)
- func (opt DevicesFile) ApplyToLVsOptions(opts *LVsOptions)
- func (opt DevicesFile) ApplyToPVChangeOptions(opts *PVChangeOptions)
- func (opt DevicesFile) ApplyToPVCreateOptions(opts *PVCreateOptions)
- func (opt DevicesFile) ApplyToPVMoveOptions(opts *PVMoveOptions)
- func (opt DevicesFile) ApplyToPVRemoveOptions(opts *PVRemoveOptions)
- func (opt DevicesFile) ApplyToPVResizeOptions(opts *PVResizeOptions)
- func (opt DevicesFile) ApplyToPVsOptions(opts *PVsOptions)
- func (opt DevicesFile) ApplyToVGChangeOptions(opts *VGChangeOptions)
- func (opt DevicesFile) ApplyToVGCreateOptions(opts *VGCreateOptions)
- func (opt DevicesFile) ApplyToVGExtendOptions(opts *VGExtendOptions)
- func (opt DevicesFile) ApplyToVGReduceOptions(opts *VGReduceOptions)
- func (opt DevicesFile) ApplyToVGRemoveOptions(opts *VGRemoveOptions)
- func (opt DevicesFile) ApplyToVGRenameOptions(opts *VGRenameOptions)
- func (opt DevicesFile) ApplyToVGsOptions(opts *VGsOptions)
- type Discards
- type DuplicateAllocatableUsed
- type ErrorWhenFull
- type ExitCodeError
- type Exported
- type Extendable
- type ExtentPercent
- type Extents
- type FQLogicalVolumeName
- func (opt *FQLogicalVolumeName) ApplyToArgs(args Arguments) error
- func (opt *FQLogicalVolumeName) ApplyToLVChangeOptions(opts *LVChangeOptions)
- func (opt *FQLogicalVolumeName) ApplyToLVCreateOptions(opts *LVCreateOptions)
- func (opt *FQLogicalVolumeName) ApplyToLVExtendOptions(opts *LVExtendOptions)
- func (opt *FQLogicalVolumeName) ApplyToLVReduceOptions(opts *LVReduceOptions)
- func (opt *FQLogicalVolumeName) ApplyToLVRemoveOptions(opts *LVRemoveOptions)
- func (opt *FQLogicalVolumeName) ApplyToLVRenameOptions(opts *LVRenameOptions)
- func (opt *FQLogicalVolumeName) ApplyToLVResizeOptions(opts *LVResizeOptions)
- func (opt *FQLogicalVolumeName) ApplyToLVsOptions(opts *LVsOptions)
- func (opt *FQLogicalVolumeName) Split() (VolumeGroupName, LogicalVolumeName)
- func (opt *FQLogicalVolumeName) String() string
- func (opt *FQLogicalVolumeName) Validate() error
- type Force
- func (opt Force) ApplyToArgs(args Arguments) error
- func (opt Force) ApplyToLVRemoveOptions(opts *LVRemoveOptions)
- func (opt Force) ApplyToPVCreateOptions(opts *PVCreateOptions)
- func (opt Force) ApplyToPVRemoveOptions(opts *PVRemoveOptions)
- func (opt Force) ApplyToVGReduceOptions(opts *VGReduceOptions)
- func (opt Force) ApplyToVGRemoveOptions(opts *VGRemoveOptions)
- type LVAllocationPolicyAttr
- type LVAttributes
- type LVChangeOption
- type LVChangeOptions
- type LVChangeOptionsList
- type LVCreateOption
- type LVCreateOptionList
- type LVCreateOptions
- type LVExtendOption
- type LVExtendOptions
- type LVExtendOptionsList
- type LVMStdErr
- type LVPermissions
- type LVReduceOption
- type LVReduceOptions
- type LVReduceOptionsList
- type LVRemoveOption
- type LVRemoveOptions
- type LVRemoveOptionsList
- type LVRenameOption
- type LVRenameOptions
- type LVRenameOptionsList
- type LVResizeOption
- type LVResizeOptions
- type LVResizeOptionsList
- type LVsOption
- type LVsOptions
- type LVsOptionsList
- type LogicalAndGroupingOperator
- type LogicalVolume
- type LogicalVolumeClient
- type LogicalVolumeName
- func (opt LogicalVolumeName) ApplyToArgs(args Arguments) error
- func (opt LogicalVolumeName) ApplyToLVChangeOptions(opts *LVChangeOptions)
- func (opt LogicalVolumeName) ApplyToLVCreateOptions(opts *LVCreateOptions)
- func (opt LogicalVolumeName) ApplyToLVExtendOptions(opts *LVExtendOptions)
- func (opt LogicalVolumeName) ApplyToLVReduceOptions(opts *LVReduceOptions)
- func (opt LogicalVolumeName) ApplyToLVRemoveOptions(opts *LVRemoveOptions)
- func (opt LogicalVolumeName) ApplyToLVRenameOptions(opts *LVRenameOptions)
- func (opt LogicalVolumeName) ApplyToLVResizeOptions(opts *LVResizeOptions)
- func (opt LogicalVolumeName) ApplyToLVsOptions(opts *LVsOptions)
- func (opt LogicalVolumeName) ApplyToPVMoveOptions(opts *PVMoveOptions)
- type LoopbackDevice
- type MaximumLogicalVolumes
- type MaximumPhysicalVolumes
- type MetaClient
- type MetadataSize
- type Minor
- type Mirrors
- type Missing
- type ModifyDevice
- type ModifyDeviceType
- type Open
- type OpenTarget
- type PVAttributes
- type PVChangeOption
- type PVChangeOptions
- type PVChangeOptionsList
- type PVCreateOption
- type PVCreateOptions
- type PVCreateOptionsList
- type PVMoveOption
- type PVMoveOptions
- type PVMoveOptionsList
- type PVRemoveOption
- type PVRemoveOptions
- type PVRemoveOptionsList
- type PVResizeOption
- type PVResizeOptions
- type PVResizeOptionsList
- type PVsOption
- type PVsOptions
- type PVsOptionsList
- type Partial
- type PartialAttr
- type Permission
- type PhysicalExtentSize
- type PhysicalVolume
- type PhysicalVolumeClient
- type PhysicalVolumeName
- func (opt PhysicalVolumeName) ApplyToArgs(args Arguments) error
- func (opt PhysicalVolumeName) ApplyToPVChangeOptions(opts *PVChangeOptions)
- func (opt PhysicalVolumeName) ApplyToPVMoveOptions(opts *PVMoveOptions)
- func (opt PhysicalVolumeName) ApplyToPVRemoveOptions(opts *PVRemoveOptions)
- func (opt PhysicalVolumeName) ApplyToVGCreateOptions(opts *VGCreateOptions)
- func (opt PhysicalVolumeName) ApplyToVGExtendOptions(opts *VGExtendOptions)
- func (opt PhysicalVolumeName) ApplyToVGReduceOptions(opts *VGReduceOptions)
- type PhysicalVolumeNames
- func (opt PhysicalVolumeNames) ApplyToArgs(args Arguments) error
- func (opt PhysicalVolumeNames) ApplyToPVMoveOptions(opts *PVMoveOptions)
- func (opt PhysicalVolumeNames) ApplyToVGCreateOptions(opts *VGCreateOptions)
- func (opt PhysicalVolumeNames) ApplyToVGExtendOptions(opts *VGExtendOptions)
- func (opt PhysicalVolumeNames) ApplyToVGReduceOptions(opts *VGReduceOptions)
- type PoolMetadataPrefixedSize
- type PoolMetadataSize
- type PrefixedExtents
- type PrefixedSize
- type Profile
- func (opt Profile) ApplyToArgs(args Arguments) error
- func (opt Profile) ApplyToConfigOptions(opts *ConfigOptions)
- func (opt Profile) ApplyToLVChangeOptions(opts *LVChangeOptions)
- func (opt Profile) ApplyToLVCreateOptions(opts *LVCreateOptions)
- func (opt Profile) ApplyToLVExtendOptions(opts *LVExtendOptions)
- func (opt Profile) ApplyToLVReduceOptions(opts *LVReduceOptions)
- func (opt Profile) ApplyToLVRemoveOptions(opts *LVRemoveOptions)
- func (opt Profile) ApplyToLVRenameOptions(opts *LVRenameOptions)
- func (opt Profile) ApplyToLVResizeOptions(opts *LVResizeOptions)
- func (opt Profile) ApplyToLVsOptions(opts *LVsOptions)
- func (opt Profile) ApplyToPVChangeOptions(opts *PVChangeOptions)
- func (opt Profile) ApplyToPVCreateOptions(opts *PVCreateOptions)
- func (opt Profile) ApplyToPVMoveOptions(opts *PVMoveOptions)
- func (opt Profile) ApplyToPVRemoveOptions(opts *PVRemoveOptions)
- func (opt Profile) ApplyToPVResizeOptions(opts *PVResizeOptions)
- func (opt Profile) ApplyToPVsOptions(opts *PVsOptions)
- func (opt Profile) ApplyToVGChangeOptions(opts *VGChangeOptions)
- func (opt Profile) ApplyToVGCreateOptions(opts *VGCreateOptions)
- func (opt Profile) ApplyToVGExtendOptions(opts *VGExtendOptions)
- func (opt Profile) ApplyToVGReduceOptions(opts *VGReduceOptions)
- func (opt Profile) ApplyToVGRemoveOptions(opts *VGRemoveOptions)
- func (opt Profile) ApplyToVGRenameOptions(opts *VGRenameOptions)
- func (opt Profile) ApplyToVGsOptions(opts *VGsOptions)
- type RawConfig
- type RawOutputProcessor
- type Rebuild
- type RefreshDevices
- type RemoveMissing
- type RequestConfirm
- type Resizeable
- type Resync
- type Select
- func NewCombinedSelect(operator LogicalAndGroupingOperator, selects ...Select) Select
- func NewMatchesAllSelect(selects ...Select) Select
- func NewMatchesAllSelector(fields map[string]string) Select
- func NewMatchesAnySelect(selects ...Select) Select
- func NewMatchesAnySelector(fields map[string]string) Select
- func NewSelector(lo LogicalAndGroupingOperator, co SelectionComparisonOperator, ...) Select
- func NotSelect(sel Select) Select
- func (opt Select) ApplyToArgs(args Arguments) error
- func (opt Select) ApplyToLVRemoveOptions(opts *LVRemoveOptions)
- func (opt Select) ApplyToLVsOptions(opts *LVsOptions)
- func (opt Select) ApplyToPVsOptions(opts *PVsOptions)
- func (opt Select) ApplyToVGRemoveOptions(opts *VGRemoveOptions)
- func (opt Select) ApplyToVGsOptions(opts *VGsOptions)
- type SelectionComparisonOperator
- type SelectionOperator
- type Shared
- type Size
- func (opt Size) ApplyToArgs(args Arguments) error
- func (opt Size) ApplyToLVCreateOptions(opts *LVCreateOptions)
- func (opt Size) ApplyToLVResizeOptions(opts *LVResizeOptions)
- func (opt Size) IsEqualTo(other Size) (bool, error)
- func (opt Size) MarshalText() ([]byte, error)
- func (opt Size) String() string
- func (opt Size) ToExtents(extentSize uint64, percent ExtentPercent) (Extents, error)
- func (opt Size) ToPoolMetadata() PoolMetadataSize
- func (opt Size) ToUnit(unit Unit) (Size, error)
- func (opt Size) Validate() error
- func (opt Size) Virtual() VirtualSize
- type SizePrefix
- type SkipActivation
- type State
- type StripeSize
- type Stripes
- type SyncAction
- type Tags
- func (opt Tags) ApplyToArgs(args Arguments) error
- func (opt Tags) ApplyToLVChangeOptions(opts *LVChangeOptions)
- func (opt Tags) ApplyToLVCreateOptions(opts *LVCreateOptions)
- func (opt Tags) ApplyToLVRemoveOptions(opts *LVRemoveOptions)
- func (opt Tags) ApplyToLVsOptions(opts *LVsOptions)
- func (opt Tags) ApplyToPVChangeOptions(opts *PVChangeOptions)
- func (opt Tags) ApplyToVGChangeOptions(opts *VGChangeOptions)
- func (opt Tags) ApplyToVGCreateOptions(opts *VGCreateOptions)
- func (opt Tags) ApplyToVGRemoveOptions(opts *VGRemoveOptions)
- func (opt Tags) ApplyToVGsOptions(opts *VGsOptions)
- type TestingHandler
- type Thin
- type ThinPool
- type Type
- type Unit
- func (unit Unit) ApplyToArgs(args Arguments) error
- func (unit Unit) ApplyToLVsOptions(opts *LVsOptions)
- func (unit Unit) ApplyToPVsOptions(opts *PVsOptions)
- func (unit Unit) ApplyToVGsOptions(opts *VGsOptions)
- func (unit Unit) MarshalText() ([]byte, error)
- func (unit Unit) String() string
- func (unit Unit) Validate() error
- type VGAllocationPolicyAttr
- type VGAttributes
- type VGChangeOption
- type VGChangeOptions
- type VGChangeOptionsList
- type VGCreateOption
- type VGCreateOptionList
- type VGCreateOptions
- type VGExtendOption
- type VGExtendOptions
- type VGExtendOptionsList
- type VGPermissions
- type VGReduceOption
- type VGReduceOptions
- type VGReduceOptionsList
- type VGRemoveOption
- type VGRemoveOptions
- type VGRemoveOptionsList
- type VGRenameOption
- type VGRenameOptions
- type VGRenameOptionsList
- type VGsOption
- type VGsOptions
- type VGsOptionsList
- type Verbose
- type Version
- type VersionOption
- type VersionOptions
- type VersionOptionsList
- type VirtualPrefixedSize
- type VirtualSize
- type VolumeGroup
- type VolumeGroupClient
- type VolumeGroupName
- func (opt VolumeGroupName) ApplyToArgs(args Arguments) error
- func (opt VolumeGroupName) ApplyToLVChangeOptions(opts *LVChangeOptions)
- func (opt VolumeGroupName) ApplyToLVCreateOptions(opts *LVCreateOptions)
- func (opt VolumeGroupName) ApplyToLVExtendOptions(opts *LVExtendOptions)
- func (opt VolumeGroupName) ApplyToLVReduceOptions(opts *LVReduceOptions)
- func (opt VolumeGroupName) ApplyToLVRemoveOptions(opts *LVRemoveOptions)
- func (opt VolumeGroupName) ApplyToLVRenameOptions(opts *LVRenameOptions)
- func (opt VolumeGroupName) ApplyToLVResizeOptions(opts *LVResizeOptions)
- func (opt VolumeGroupName) ApplyToLVsOptions(opts *LVsOptions)
- func (opt VolumeGroupName) ApplyToPVsOptions(opts *PVsOptions)
- func (opt VolumeGroupName) ApplyToVGChangeOptions(opts *VGChangeOptions)
- func (opt VolumeGroupName) ApplyToVGCreateOptions(opts *VGCreateOptions)
- func (opt VolumeGroupName) ApplyToVGExtendOptions(opts *VGExtendOptions)
- func (opt VolumeGroupName) ApplyToVGReduceOptions(opts *VGReduceOptions)
- func (opt VolumeGroupName) ApplyToVGRemoveOptions(opts *VGRemoveOptions)
- func (opt VolumeGroupName) ApplyToVGRenameOptions(opts *VGRenameOptions)
- func (opt VolumeGroupName) ApplyToVGsOptions(opts *VGsOptions)
- type VolumeHealth
- type VolumeType
- type Warning
- type WipeSignatures
- type Zero
- type ZeroAttr
Constants ¶
const ( OpenTargetMirror = 'm' OpenTargetRaid = 'r' OpenTargetSnapshot = 's' OpenTargetThin = 't' OpenTargetUnknown = 'u' OpenTargetVirtual = 'v' )
const ( VolumeHealthPartialActivation = 'p' VolumeHealthUnknown = 'X' VolumeHealthOK = '-' VolumeHealthRAIDRefreshNeeded = 'r' VolumeHealthRAIDMismatchesExist = 'm' VolumeHealthRAIDWriteMostly = 'w' VolumeHealthRAIDReshaping = 's' VolumeHealthRAIDReshapeRemoved = 'R' VolumeHealthThinFailed = 'F' VolumeHealthThinPoolOutOfDataSpace = 'D' VolumeHealthThinPoolMetadataReadOnly = 'M' VolumeHealthWriteCacheError = 'E' )
const ( DefaultLVMSystemDir = "/etc/lvm" LVMSystemDirEnv = "LVM_SYSTEM_DIR" LVMGlobalConfigurationFileName = "lvm.conf" LVMLocalConfigurationFileName = "lvmlocal.conf" )
const BackingFilePattern = "loopback-%s"
const DefaultModuleID = "github.com/jakobmoellerdev/lvm2go"
const (
DefaultVolumeGroupEnv = "LVM_VG_NAME"
)
const ExtentPercentSymbol = "%"
const LVMConfigStructTag = "lvm"
const LVMProfileExtension = ".profile"
const LVMWarningPrefix = "WARNING: "
const PhysicalVolumeNameUnknown = PhysicalVolumeName("[unknown]")
PhysicalVolumeNameUnknown is a placeholder for an unknown physical volume name used by lvm2 in case of failure to retrieve the name.
const TagSymbol = "@"
Variables ¶
var ( ErrVolumeGroupNotFound = errors.New("volume group not found") ErrLogicalVolumeNotFound = errors.New("logical volume not found") )
var ( DefaultLVsColumnOptions = ColumnOptions{ "lv_all", } DefaultVGsColumnOptions = ColumnOptions{ "vg_all", } DefaultPVsColumnOptions = ColumnOptions{ "pv_all", } )
var ( ErrPartialActivation = errors.New("found partial activation of physical volumes, one or more physical volumes are setup incorrectly") ErrUnknownVolumeHealth = errors.New("unknown volume health reported, verification on the host system is required") ErrWriteCacheError = errors.New("write cache error signifies that dm-writecache reports an error") ErrThinPoolFailed = errors.New("thin pool encounters serious failures and hence no further I/O is permitted at all") ErrThinPoolOutOfDataSpace = errors.New("thin pool is out of data space, no further data can be written to the thin pool without extension") ErrThinPoolMetadataReadOnly = errors.New("metadata read only signifies that thin pool encounters certain types of failures, but it's still possible to do data reads. However, no metadata changes are allowed") ErrThinVolumeFailed = errors.New("the underlying thin pool entered a failed state and no further I/O is permitted") ErrRAIDRefreshNeeded = errors.New("RAID volume requires a refresh, one or more Physical Volumes have suffered a write error. This could be due to temporary failure of the Physical Volume or an indication it is failing. The device should be refreshed or replaced") ErrRAIDMismatchesExist = errors.New("RAID volume has portions of the array that are not coherent. Inconsistencies are detected by initiating a check RAID logical volume. The scrubbing operations, \"check\" and \"repair\", can be performed on a RAID volume via the \"lvchange\" command") ErrRAIDReshaping = errors.New("RAID volume is currently reshaping. Reshaping signifies a RAID Logical Volume is either undergoing a stripe addition/removal, a stripe size or RAID algorithm change") ErrRAIDReshapeRemoved = errors.New("RAID volume signifies freed raid images after reshaping") ErrRAIDWriteMostly = errors.New("RAID volume is marked as write-mostly. this signifies the devices in a RAID 1 logical volume have been marked write-mostly. This means that reading from this device will be avoided, and other devices will be preferred for reading (unless no other devices are available). This minimizes the I/O to the specified device") ErrLogicalVolumeSuspended = errors.New("logical volume is in a suspended state, no I/O is permitted") ErrInvalidSnapshot = errors.New("logical volume is an invalid snapshot, no I/O is permitted") ErrSnapshotMergeFailed = errors.New("snapshot merge failed, no I/O is permitted") ErrMappedDevicePresentWithInactiveTables = errors.New("mapped device present with inactive tables, no I/O is permitted") ErrMappedDevicePresentWithoutTables = errors.New("mapped device present without tables, no I/O is permitted") ErrThinPoolCheckNeeded = errors.New("a thin pool check is needed") ErrUnknownVolumeState = errors.New("unknown volume state, verification on the host system is required") ErrHistoricalVolumeState = errors.New("historical volume state (volume no longer exists but is kept around in logs), verification on the host system is required") ErrLogicalVolumeUnderlyingDeviceStateUnknown = errors.New("logical volume underlying device state is unknown, verification on the host system is required") )
var ( VolumeGroupNotFoundPattern = regexp.MustCompile(volumeGroupNotFoundPattern) LogicalVolumeNotFoundPattern = regexp.MustCompile(logicalVolumeNotFoundPattern) DeviceNotFoundPattern = regexp.MustCompile(deviceNotFoundPattern) NotFoundPattern = regexp.MustCompile(fmt.Sprintf(`%s|%s|%s`, volumeGroupNotFoundPattern, logicalVolumeNotFoundPattern, deviceNotFoundPattern)) // NoSuchCommandPattern is a regular expression that matches the error message when a command is not found. NoSuchCommandPattern = regexp.MustCompile(`no such command`) // MaximumNumberOfLogicalVolumesPattern is a regular expression that matches the error message when the maximum number of logical volumes is reached. MaximumNumberOfLogicalVolumesPattern = regexp.MustCompile(`Maximum number of logical volumes \(\d+\) reached in volume group (.*?)`) // MaximumNumberOfPhysicalVolumesPattern is a regular expression that matches the error message when the maximum number of physical volumes is reached. MaximumNumberOfPhysicalVolumesPattern = regexp.MustCompile(`No space for '(.*?)' - volume group '(.*?)' holds max \d+ physical volume\(s\)\.`) // CannotChangeVGWhilePVsAreMissingPattern is a regular expression that matches the error message when the volume group is immutable because physical volumes are missing. CannotChangeVGWhilePVsAreMissingPattern = regexp.MustCompile(`Cannot change VG (.*?) while PVs are missing\.`) // CouldNotFindDeviceWithUUIDPattern is a regular expression that matches the error message when a device with a specific UUID is not found. CouldNotFindDeviceWithUUIDPattern = regexp.MustCompile(`Couldn't find device with uuid [\w-]+\.`) // VGMissingPVsPattern is a regular expression that matches the error message when a volume group is missing physical volumes. VGMissingPVsPattern = regexp.MustCompile(`VG (.*?) is missing PV (.*?) \(last written to (.*?)\)`) // ThereAreStillPartialLVsPattern is a regular expression that matches the error message when there are still partial logical volumes in a volume group. ThereAreStillPartialLVsPattern = regexp.MustCompile(`There are still partial LVs in VG (.*?)\.`) // PartialLVNeedsRepairOrRemovePattern is a regular expression that matches the error message when a logical volume needs repair or remove. PartialLVNeedsRepairOrRemovePattern = regexp.MustCompile(`Partial LV (.*?) needs to be repaired or removed\.`) // NoDataToMovePattern is a regular expression that matches the error message when there is no data to move for a specific volume group during a pvmove operation. NoDataToMovePattern = regexp.MustCompile(`No data to move for (.*?)`) // NoFreeExtentsPattern is a regular expression that matches the error message when there are no free extents on a physical volume. NoFreeExtentsPattern = regexp.MustCompile(`No free extents on physical volume "(.*?)"`) ConfigurationSectionNotCustomizableByProfilePattern = regexp.MustCompile(`Configuration section "(.*?)" is not customizable by a profile\.`) )
var DefaultWaitDelay = time.Duration(0)
DefaultWaitDelay for Commands If WaitDelay is zero (the default), I/ O pipes will be read until EOF, which might not occur until orphaned subprocesses of the command have also closed their descriptors for the pipes see exec.Cmd.Wait for more information
var ErrDeviceAlreadyClosed = errors.New("loopback device already closed")
var ErrDeviceAlreadyOpened = errors.New("loopback device was not already opened")
var ErrInvalidCannotStartWithPercent = fmt.Errorf("invalid extents, cannot start with %q", ExtentPercentSymbol)
var ErrInvalidExtentsGTZero = errors.New("invalid extents specified, must be set")
var ErrInvalidMultiplePercent = fmt.Errorf("multiple %q found", ExtentPercentSymbol)
var ErrInvalidPercentDefinition = fmt.Errorf("invalid percent definition, must be one of %v", percentCandidates)
var ErrInvalidProfileExtension = fmt.Errorf("profile extension must be empty or %q", LVMProfileExtension)
var ErrInvalidSizeGEZero = errors.New("invalid size specified, must be greater than or equal to zero")
var ErrInvalidSizePrefix = fmt.Errorf("invalid size prefix specified, must be one of %v", prefixCandidates)
var ErrInvalidUnit = errors.New("invalid unit specified")
var ErrLogicalVolumeNameRequired = errors.New("LogicalVolumeName is required for a fully qualified logical volume")
var ErrNANExtents = errors.New("invalid extents specified, must be a valid integer number")
var ErrNoBackingFileSet = errors.New("no backing file set")
var ErrNoDeviceSet = errors.New("no device set")
var ErrNoDevicesSpecifiedForModification = errors.New("no devices specified for modification")
var ErrPhysicalVolumeNameRequired = errors.New("PhysicalVolumeName is required")
var ErrProfileNameEmpty = errors.New("profile name is empty")
var ErrVolumeGroupNameRequired = errors.New("VolumeGroupName is required for a fully qualified logical volume")
var InvalidPrefixedSize = PrefixedSize{SizePrefix: SizePrefixNone, Size: InvalidSize}
var InvalidSize = Size{Val: -1, Unit: UnitUnknown}
var LVMGlobalConfiguration = fmt.Sprintf("%s/%s", LVMSystemDir(), LVMGlobalConfigurationFileName)
LVMGlobalConfiguration is the path to the global LVM configuration file. It usually defaults to "/etc/lvm/lvm.conf", but can be changed by setting the LVM_SYSTEM_DIR environment variable
var LVMLocalConfiguration = fmt.Sprintf("%s/%s", LVMSystemDir(), LVMLocalConfigurationFileName)
LVMLocalConfiguration is the path to the local LVM configuration file. It usually defaults to "/etc/lvm/lvmlocal.conf", but can be changed by setting the LVM_SYSTEM_DIR environment variable
var LVMSystemDir = sync.OnceValue[string](lvmSystemDir)
LVMSystemDir returns the system directory for LVM configuration files. If the LVM_SYSTEM_DIR environment variable is set, its value will be returned. Otherwise, the default value "/etc/lvm" will be returned.
var ModuleID = sync.OnceValue(moduleID)
ModuleID returns the module ID of the library used for identification in the logs and other places. It defaults to using the BuildInfo but can be overridden by setting ModuleID to a different value.
Functions ¶
func CommandContext ¶
CommandContext creates exec.Cmd with custom args. it is equivalent to exec.Command(cmd, args...) when not containerized. When containerized, it calls nsenter with the provided command and args.
func DefaultVersionOutputProcessor ¶
func DefaultVersionOutputProcessor() (*Version, RawOutputProcessor)
func DefaultVolumeGroup ¶
func GetFromRawConfig ¶
GetFromRawConfig retrieves a value from a RawConfig by key and attempts to cast it to the type of T. If the key is not found, an error is returned. If the key is found but the value is not of type T, an error is returned.
func GetLVMPath ¶
func GetLVMPath() string
GetLVMPath returns the Path to the lvmBinaryPath command.
func IsContainerized ¶
func IsDeviceNotFound ¶
func IsLVMError ¶
IsLVMError returns true if the error is an LVM error with a specific exit code and matches a specific pattern. The validExitCodes are the exit codes that are considered valid for the error. While lvm2go packages a lot of predefined patterns, it is possible to use a custom pattern.
Example:
func IsLVMCustomError(err error) bool { return IsLVMError(err, regexp.MustCompile(`custom error pattern`)) }
func IsLogicalVolumeNotFound ¶
func IsNoDataToMove ¶
func IsNoFreeExtents ¶
func IsNoSuchCommand ¶
func IsNotFound ¶
func IsUnitOrDigit ¶
IsUnitOrDigit returns true if the unit is a valid unit. a valid unit is defined as a unit that is a member of validUnits. if the unit is not part of a valid unit, IsUnitOrDigit checks if the unit is a digit.
func IsVGMissingPVs ¶
func IsVolumeGroupNotFound ¶
func NewContextPropagatingSlogHandler ¶
NewContextPropagatingSlogHandler returns a new slog.Handler that propagates context values as slog attributes. The handler is a wrapper around the provided handler.
func SetLVMPath ¶
func SetLVMPath(path string)
SetLVMPath sets the Path to the lvmBinaryPath command.
func SetUseStandardLocale ¶
func SetUseStandardLocale(use bool)
func StreamedCommand ¶
StreamedCommand runs the command and returns the stdout as a ReadCloser that also Waits for the command to finish. After the Close command is called the cmd is closed and the resources are released. Not calling close on this method will result in a resource leak.
func SymboledTag ¶
func UseStandardLocale ¶
func UseStandardLocale() bool
func VGMissingPVsDetails ¶
func WithCustomEnvironment ¶
func WithDefaultVolumeGroup ¶
Types ¶
type ActivationMode ¶
type ActivationMode string
const ( ActivationModePartial ActivationMode = "partial" ActivationModeDegraded ActivationMode = "degraded" ActivationModeComplete ActivationMode = "complete" )
func (ActivationMode) ApplyToArgs ¶
func (opt ActivationMode) ApplyToArgs(args Arguments) error
func (ActivationMode) ApplyToLVChangeOptions ¶
func (opt ActivationMode) ApplyToLVChangeOptions(opts *LVChangeOptions)
type ActivationState ¶
type ActivationState string
const ( Activate ActivationState = "y" Deactivate ActivationState = "n" AutoActivate ActivationState = "ay" )
func (ActivationState) ApplyToArgs ¶
func (opt ActivationState) ApplyToArgs(args Arguments) error
func (ActivationState) ApplyToLVChangeOptions ¶
func (opt ActivationState) ApplyToLVChangeOptions(opts *LVChangeOptions)
func (ActivationState) ApplyToLVCreateOptions ¶
func (opt ActivationState) ApplyToLVCreateOptions(opts *LVCreateOptions)
type AllocationPolicy ¶
type AllocationPolicy string
const ( Contiguous AllocationPolicy = "contiguous" Normal AllocationPolicy = "normal" Cling AllocationPolicy = "cling" ClingByTags AllocationPolicy = "cling_by_tags" Anywhere AllocationPolicy = "anywhere" Inherit AllocationPolicy = "inherit" )
func (AllocationPolicy) ApplyToArgs ¶
func (opt AllocationPolicy) ApplyToArgs(args Arguments) error
func (AllocationPolicy) ApplyToLVChangeOptions ¶
func (opt AllocationPolicy) ApplyToLVChangeOptions(opts *LVCreateOptions)
func (AllocationPolicy) ApplyToLVCreateOptions ¶
func (opt AllocationPolicy) ApplyToLVCreateOptions(opts *LVCreateOptions)
func (AllocationPolicy) ApplyToPVMoveOptions ¶
func (opt AllocationPolicy) ApplyToPVMoveOptions(opts *PVMoveOptions)
func (AllocationPolicy) ApplyToVGChangeOptions ¶
func (opt AllocationPolicy) ApplyToVGChangeOptions(opts *VGChangeOptions)
func (AllocationPolicy) ApplyToVGCreateOptions ¶
func (opt AllocationPolicy) ApplyToVGCreateOptions(opts *VGCreateOptions)
type ArgumentGenerator ¶
type Arguments ¶
type AutoActivation ¶
type AutoActivation string
const ( SetAutoActivate AutoActivation = "y" SetNoAutoActivate AutoActivation = "n" )
func (AutoActivation) ApplyToArgs ¶
func (opt AutoActivation) ApplyToArgs(args Arguments) error
func (AutoActivation) ApplyToVGChangeOptions ¶
func (opt AutoActivation) ApplyToVGChangeOptions(opts *VGChangeOptions)
func (AutoActivation) ApplyToVGCreateOptions ¶
func (opt AutoActivation) ApplyToVGCreateOptions(opts *VGCreateOptions)
type AutoActivationFromReport ¶
type AutoActivationFromReport string
const ( AutoActivationFromReportEnabled AutoActivationFromReport = "enabled" AutoActivationFromReportDisabled AutoActivationFromReport = "" )
func (AutoActivationFromReport) True ¶
func (opt AutoActivationFromReport) True() bool
type ChunkSize ¶
type ChunkSize Size
func (ChunkSize) ApplyToArgs ¶
func (ChunkSize) ApplyToLVCreateOptions ¶
func (opt ChunkSize) ApplyToLVCreateOptions(opts *LVCreateOptions)
type Client ¶
type Client interface { LogicalVolumeClient VolumeGroupClient PhysicalVolumeClient DevicesClient MetaClient DevicesClient }
Client provides operations on lvm2 logical volumes, volume groups, and physical volumes as well as the hosts lvm2 subsystem.
func NewLockingClient ¶
NewLockingClient returns a new Client that locks all methods with a read-write mutex. This is useful when you want to ensure that only one operation is happening at a time. This can however only work if all operations are done through the same client. It is a helper for synchronizing dangerous concurrent calls to the same client. Note that this can introduce significant performance overhead if the client is used in a highly concurrent environment.
type ColumnOptions ¶
type ColumnOptions []string
func (ColumnOptions) ApplyToArgs ¶
func (opt ColumnOptions) ApplyToArgs(args Arguments) error
func (ColumnOptions) ApplyToLVsOptions ¶
func (opt ColumnOptions) ApplyToLVsOptions(opts *LVsOptions)
func (ColumnOptions) ApplyToVGsOptions ¶
func (opt ColumnOptions) ApplyToVGsOptions(opts *VGsOptions)
type CommonOptions ¶
type CommonOptions struct { Devices DevicesFile Profile Verbose RequestConfirm }
func (CommonOptions) ApplyToArgs ¶
func (opts CommonOptions) ApplyToArgs(args Arguments) error
type Compression ¶
type Compression bool
func (*Compression) ApplyToArgs ¶
func (opt *Compression) ApplyToArgs(args Arguments) error
func (*Compression) ApplyToLVChangeOptions ¶
func (opt *Compression) ApplyToLVChangeOptions(opts *LVChangeOptions)
type ConfigOption ¶
type ConfigOption interface {
ApplyToConfigOptions(opts *ConfigOptions)
}
type ConfigOptions ¶
type ConfigOptions struct { ConfigType Profile }
func (*ConfigOptions) ApplyToArgs ¶
func (opts *ConfigOptions) ApplyToArgs(args Arguments) error
func (*ConfigOptions) ApplyToConfigOptions ¶
func (opts *ConfigOptions) ApplyToConfigOptions(new *ConfigOptions)
func (*ConfigOptions) ApplyToVersionOptions ¶
func (opts *ConfigOptions) ApplyToVersionOptions(new *ConfigOptions)
type ConfigOptionsList ¶
type ConfigOptionsList []ConfigOption
func (ConfigOptionsList) AsArgs ¶
func (list ConfigOptionsList) AsArgs() (Arguments, error)
type ConfigType ¶
type ConfigType string
const ( ConfigTypeFull ConfigType = "full" ConfigTypeCurrent ConfigType = "current" ConfigTypeDefault ConfigType = "default" ConfigTypeDiff ConfigType = "diff" ConfigTypeMissing ConfigType = "missing" ConfigTypeNew ConfigType = "new" ConfigTypeProfilable ConfigType = "profilable" ConfigTypeProfilableCommand ConfigType = "profilable-command" ConfigTypeProfilableMetadata ConfigType = "profilable-metadata" )
func (ConfigType) ApplyToArgs ¶
func (c ConfigType) ApplyToArgs(arguments Arguments) error
func (ConfigType) ApplyToConfigOptions ¶
func (c ConfigType) ApplyToConfigOptions(opts *ConfigOptions)
func (ConfigType) AsArgs ¶
func (c ConfigType) AsArgs() []string
func (ConfigType) String ¶
func (c ConfigType) String() string
type ContextPropagatingSlogHandler ¶
type ContextPropagatingSlogHandler struct {
// contains filtered or unexported fields
}
type DataAlignment ¶
type DataAlignment Size
func (DataAlignment) ApplyToArgs ¶
func (opt DataAlignment) ApplyToArgs(args Arguments) error
func (DataAlignment) ApplyToPVCreateOptions ¶
func (opt DataAlignment) ApplyToPVCreateOptions(opts *PVCreateOptions)
func (DataAlignment) ApplyToVGCreateOptions ¶
func (opt DataAlignment) ApplyToVGCreateOptions(opts *VGCreateOptions)
type DataAlignmentOffset ¶
type DataAlignmentOffset Size
func (DataAlignmentOffset) ApplyToArgs ¶
func (opt DataAlignmentOffset) ApplyToArgs(args Arguments) error
func (DataAlignmentOffset) ApplyToPVCreateOptions ¶
func (opt DataAlignmentOffset) ApplyToPVCreateOptions(opts *PVCreateOptions)
func (DataAlignmentOffset) ApplyToVGCreateOptions ¶
func (opt DataAlignmentOffset) ApplyToVGCreateOptions(opts *VGCreateOptions)
type Deduplication ¶
type Deduplication bool
func (*Deduplication) ApplyToArgs ¶
func (opt *Deduplication) ApplyToArgs(args Arguments) error
func (*Deduplication) ApplyToLVChangeOptions ¶
func (opt *Deduplication) ApplyToLVChangeOptions(opts *LVChangeOptions)
type DelTags ¶
type DelTags Tags
func (DelTags) ApplyToArgs ¶
func (DelTags) ApplyToLVChangeOptions ¶
func (opt DelTags) ApplyToLVChangeOptions(opts *LVChangeOptions)
func (DelTags) ApplyToPVChangeOptions ¶
func (opt DelTags) ApplyToPVChangeOptions(opts *PVChangeOptions)
func (DelTags) ApplyToVGChangeOptions ¶
func (opt DelTags) ApplyToVGChangeOptions(opts *VGChangeOptions)
type DeleteNotFound ¶
type DeleteNotFound bool
func (DeleteNotFound) ApplyToArgs ¶
func (opt DeleteNotFound) ApplyToArgs(args Arguments) error
func (DeleteNotFound) ApplyToDevUpdateOptions ¶
func (opt DeleteNotFound) ApplyToDevUpdateOptions(opts *DevUpdateOptions)
type DevCheckOption ¶
type DevCheckOption interface {
ApplyToDevCheckOptions(opts *DevCheckOptions)
}
type DevCheckOptions ¶
type DevCheckOptions struct { DevicesFile RefreshDevices }
func (*DevCheckOptions) ApplyToArgs ¶
func (opts *DevCheckOptions) ApplyToArgs(args Arguments) error
func (*DevCheckOptions) ApplyToDevCheckOptions ¶
func (opts *DevCheckOptions) ApplyToDevCheckOptions(new *DevCheckOptions)
type DevCheckOptionsList ¶
type DevCheckOptionsList []DevCheckOption
func (DevCheckOptionsList) AsArgs ¶
func (list DevCheckOptionsList) AsArgs() (Arguments, error)
type DevListOption ¶
type DevListOption interface {
ApplyToDevListOptions(opts *DevListOptions)
}
type DevListOptions ¶
type DevListOptions struct {
DevicesFile
}
func (*DevListOptions) ApplyToArgs ¶
func (opts *DevListOptions) ApplyToArgs(args Arguments) error
func (*DevListOptions) ApplyToDevListOptions ¶
func (opts *DevListOptions) ApplyToDevListOptions(new *DevListOptions)
type DevListOptionsList ¶
type DevListOptionsList []DevListOption
func (DevListOptionsList) AsArgs ¶
func (list DevListOptionsList) AsArgs() (Arguments, error)
type DevModifyOption ¶
type DevModifyOption interface {
ApplyToDevModifyOptions(opts *DevModifyOptions)
}
type DevModifyOptions ¶
type DevModifyOptions struct { DevicesFile ModifyDevice DeviceIDType }
func (*DevModifyOptions) ApplyToArgs ¶
func (opts *DevModifyOptions) ApplyToArgs(args Arguments) error
func (*DevModifyOptions) ApplyToDevModifyOptions ¶
func (opts *DevModifyOptions) ApplyToDevModifyOptions(new *DevModifyOptions)
type DevModifyOptionsList ¶
type DevModifyOptionsList []DevModifyOption
func (DevModifyOptionsList) AsArgs ¶
func (list DevModifyOptionsList) AsArgs() (Arguments, error)
type DevUpdateOption ¶
type DevUpdateOption interface {
ApplyToDevUpdateOptions(opts *DevUpdateOptions)
}
type DevUpdateOptions ¶
type DevUpdateOptions struct { DevicesFile DeleteNotFound RefreshDevices }
func (*DevUpdateOptions) ApplyToArgs ¶
func (opts *DevUpdateOptions) ApplyToArgs(args Arguments) error
type DevUpdateOptionsList ¶
type DevUpdateOptionsList []DevUpdateOption
func (DevUpdateOptionsList) AsArgs ¶
func (list DevUpdateOptionsList) AsArgs() (Arguments, error)
type DeviceIDType ¶
type DeviceIDType string
const ( DeviceIDTypeSysWWID DeviceIDType = "sys_wwid" DeviceIDTypeWWIDNAA DeviceIDType = "wwid_naa" DeviceIDTypeWWIDT10 DeviceIDType = "wwid_t10" DeviceIDTypeWWIDEUI DeviceIDType = "wwid_eui" DeviceIDTypeSysSerial DeviceIDType = "sys_serial" DeviceIDTypeMPathUUID DeviceIDType = "mpath_uuid" DeviceIDTypeCryptUUID DeviceIDType = "crypt_uuid" DeviceIDTypeMDUUID DeviceIDType = "md_uuid" DeviceIDTypeLVMLVUUID DeviceIDType = "lvmlv_uuid" DeviceIDTypeLoopFile DeviceIDType = "loop_file" DeviceIDTypeDevname DeviceIDType = "devname" )
func (DeviceIDType) ApplyToArgs ¶
func (opt DeviceIDType) ApplyToArgs(args Arguments) error
func (DeviceIDType) ApplyToDevModifyOptions ¶
func (opt DeviceIDType) ApplyToDevModifyOptions(opts *DevModifyOptions)
type DeviceList ¶
type DeviceList []DeviceListEntry
type DeviceListEntry ¶
type DeviceListEntry struct { IDType DeviceIDType `json:"id_type"` IDName string `json:"id_name"` DevName string `json:"dev_name"` PVID string `json:"pvid"` }
type Devices ¶
type Devices []string
func (Devices) ApplyToArgs ¶
func (Devices) ApplyToLVChangeOptions ¶
func (opt Devices) ApplyToLVChangeOptions(opts *LVChangeOptions)
func (Devices) ApplyToLVCreateOptions ¶
func (opt Devices) ApplyToLVCreateOptions(opts *LVCreateOptions)
func (Devices) ApplyToLVExtendOptions ¶
func (opt Devices) ApplyToLVExtendOptions(opts *LVExtendOptions)
func (Devices) ApplyToLVReduceOptions ¶
func (opt Devices) ApplyToLVReduceOptions(opts *LVReduceOptions)
func (Devices) ApplyToLVRemoveOptions ¶
func (opt Devices) ApplyToLVRemoveOptions(opts *LVRemoveOptions)
func (Devices) ApplyToLVRenameOptions ¶
func (opt Devices) ApplyToLVRenameOptions(opts *LVRenameOptions)
func (Devices) ApplyToLVResizeOptions ¶
func (opt Devices) ApplyToLVResizeOptions(opts *LVResizeOptions)
func (Devices) ApplyToLVsOptions ¶
func (opt Devices) ApplyToLVsOptions(opts *LVsOptions)
func (Devices) ApplyToPVChangeOptions ¶
func (opt Devices) ApplyToPVChangeOptions(opts *PVChangeOptions)
func (Devices) ApplyToPVCreateOptions ¶
func (opt Devices) ApplyToPVCreateOptions(opts *PVCreateOptions)
func (Devices) ApplyToPVMoveOptions ¶
func (opt Devices) ApplyToPVMoveOptions(opts *PVMoveOptions)
func (Devices) ApplyToPVRemoveOptions ¶
func (opt Devices) ApplyToPVRemoveOptions(opts *PVRemoveOptions)
func (Devices) ApplyToPVResizeOptions ¶
func (opt Devices) ApplyToPVResizeOptions(opts *PVResizeOptions)
func (Devices) ApplyToPVsOptions ¶
func (opt Devices) ApplyToPVsOptions(opts *PVsOptions)
func (Devices) ApplyToVGChangeOptions ¶
func (opt Devices) ApplyToVGChangeOptions(opts *VGChangeOptions)
func (Devices) ApplyToVGCreateOptions ¶
func (opt Devices) ApplyToVGCreateOptions(opts *VGCreateOptions)
func (Devices) ApplyToVGExtendOptions ¶
func (opt Devices) ApplyToVGExtendOptions(opts *VGExtendOptions)
func (Devices) ApplyToVGReduceOptions ¶
func (opt Devices) ApplyToVGReduceOptions(opts *VGReduceOptions)
func (Devices) ApplyToVGRemoveOptions ¶
func (opt Devices) ApplyToVGRemoveOptions(opts *VGRemoveOptions)
func (Devices) ApplyToVGRenameOptions ¶
func (opt Devices) ApplyToVGRenameOptions(opts *VGRenameOptions)
func (Devices) ApplyToVGsOptions ¶
func (opt Devices) ApplyToVGsOptions(opts *VGsOptions)
type DevicesClient ¶
type DevicesClient interface { // DevList returns a list of devices that match the given options. // // Replicates lvmdevices // See man lvmdevices for more information. DevList(ctx context.Context, opts ...DevListOption) ([]DeviceListEntry, error) // DevCheck checks the device files and returns an error if any inconsistencies are found. // // Replicates lvmdevices --check // See man lvmdevices for more information. DevCheck(ctx context.Context, opts ...DevCheckOption) error // DevUpdate updates the device files through attempted automatic corrections. // // Replicates lvmdevices --update // See man lvmdevices for more information. DevUpdate(ctx context.Context, opts ...DevUpdateOption) error // DevModify adds and removes devices in device files with the given options. // // Replicates lvmdevices --adddev, --addpvid, --deldev and --delpvid // See man lvmdevices for more information. DevModify(ctx context.Context, opts ...DevModifyOption) error }
DevicesClient is a client that provides operations on lvm2 device files.
type DevicesFile ¶
type DevicesFile string
const SystemDevices DevicesFile = "system.devices"
func (DevicesFile) ApplyToArgs ¶
func (opt DevicesFile) ApplyToArgs(args Arguments) error
func (DevicesFile) ApplyToDevListOptions ¶
func (opt DevicesFile) ApplyToDevListOptions(opts *DevListOptions)
func (DevicesFile) ApplyToDevModifyOptions ¶
func (opt DevicesFile) ApplyToDevModifyOptions(opts *DevModifyOptions)
func (DevicesFile) ApplyToLVChangeOptions ¶
func (opt DevicesFile) ApplyToLVChangeOptions(opts *LVChangeOptions)
func (DevicesFile) ApplyToLVCreateOptions ¶
func (opt DevicesFile) ApplyToLVCreateOptions(opts *LVCreateOptions)
func (DevicesFile) ApplyToLVExtendOptions ¶
func (opt DevicesFile) ApplyToLVExtendOptions(opts *LVExtendOptions)
func (DevicesFile) ApplyToLVReduceOptions ¶
func (opt DevicesFile) ApplyToLVReduceOptions(opts *LVReduceOptions)
func (DevicesFile) ApplyToLVRemoveOptions ¶
func (opt DevicesFile) ApplyToLVRemoveOptions(opts *LVRemoveOptions)
func (DevicesFile) ApplyToLVRenameOptions ¶
func (opt DevicesFile) ApplyToLVRenameOptions(opts *LVRenameOptions)
func (DevicesFile) ApplyToLVResizeOptions ¶
func (opt DevicesFile) ApplyToLVResizeOptions(opts *LVResizeOptions)
func (DevicesFile) ApplyToLVsOptions ¶
func (opt DevicesFile) ApplyToLVsOptions(opts *LVsOptions)
func (DevicesFile) ApplyToPVChangeOptions ¶
func (opt DevicesFile) ApplyToPVChangeOptions(opts *PVChangeOptions)
func (DevicesFile) ApplyToPVCreateOptions ¶
func (opt DevicesFile) ApplyToPVCreateOptions(opts *PVCreateOptions)
func (DevicesFile) ApplyToPVMoveOptions ¶
func (opt DevicesFile) ApplyToPVMoveOptions(opts *PVMoveOptions)
func (DevicesFile) ApplyToPVRemoveOptions ¶
func (opt DevicesFile) ApplyToPVRemoveOptions(opts *PVRemoveOptions)
func (DevicesFile) ApplyToPVResizeOptions ¶
func (opt DevicesFile) ApplyToPVResizeOptions(opts *PVResizeOptions)
func (DevicesFile) ApplyToPVsOptions ¶
func (opt DevicesFile) ApplyToPVsOptions(opts *PVsOptions)
func (DevicesFile) ApplyToVGChangeOptions ¶
func (opt DevicesFile) ApplyToVGChangeOptions(opts *VGChangeOptions)
func (DevicesFile) ApplyToVGCreateOptions ¶
func (opt DevicesFile) ApplyToVGCreateOptions(opts *VGCreateOptions)
func (DevicesFile) ApplyToVGExtendOptions ¶
func (opt DevicesFile) ApplyToVGExtendOptions(opts *VGExtendOptions)
func (DevicesFile) ApplyToVGReduceOptions ¶
func (opt DevicesFile) ApplyToVGReduceOptions(opts *VGReduceOptions)
func (DevicesFile) ApplyToVGRemoveOptions ¶
func (opt DevicesFile) ApplyToVGRemoveOptions(opts *VGRemoveOptions)
func (DevicesFile) ApplyToVGRenameOptions ¶
func (opt DevicesFile) ApplyToVGRenameOptions(opts *VGRenameOptions)
func (DevicesFile) ApplyToVGsOptions ¶
func (opt DevicesFile) ApplyToVGsOptions(opts *VGsOptions)
type Discards ¶
type Discards string
func (Discards) ApplyToArgs ¶
func (Discards) ApplyToLVChangeOptions ¶
func (opt Discards) ApplyToLVChangeOptions(opts *LVChangeOptions)
type DuplicateAllocatableUsed ¶
type DuplicateAllocatableUsed rune
const ( Duplicate DuplicateAllocatableUsed = 'd' Allocatable DuplicateAllocatableUsed = 'a' Used DuplicateAllocatableUsed = 'u' )
type ErrorWhenFull ¶
type ErrorWhenFull bool
func (*ErrorWhenFull) ApplyToArgs ¶
func (opt *ErrorWhenFull) ApplyToArgs(args Arguments) error
func (*ErrorWhenFull) ApplyToLVChangeOptions ¶
func (opt *ErrorWhenFull) ApplyToLVChangeOptions(opts *LVChangeOptions)
type ExitCodeError ¶
ExitCodeError is an error that wraps the original error and the stderr output of the command run. It also provides an exit code if present that can be used to determine the type of error from LVM. Regular inaccessible errors will have an exit code of 5.
func AsExitCodeError ¶
func AsExitCodeError(err error) (ExitCodeError, bool)
AsExitCodeError returns the ExitCodeError from the error if it exists and a bool indicating if is an ExitCodeError or not.
func NewExitCodeError ¶
func NewExitCodeError(err error) ExitCodeError
NewExitCodeError returns a new ExitCodeError with the provided error and stderr output.
type Extendable ¶
type Extendable string
const ( ExtendableTrue Extendable = "extendable" ExtendableFalse Extendable = "" )
func (Extendable) True ¶
func (e Extendable) True() bool
type ExtentPercent ¶
type ExtentPercent string
const ( // ExtentPercentFree determines percentage of remaining free space in the VG ExtentPercentFree ExtentPercent = ExtentPercentSymbol + "FREE" // ExtentPercentOrigin determines percentage of the total size of the origin LV ExtentPercentOrigin ExtentPercent = ExtentPercentSymbol + "ORIGIN" // ExtentPercentPVS determines percentage of the total size of the specified PVs ExtentPercentPVS ExtentPercent = ExtentPercentSymbol + "PVS" // ExtentPercentVG determines percentage of the total size of the VG ExtentPercentVG ExtentPercent = ExtentPercentSymbol + "VG" )
type Extents ¶
type Extents struct { Val uint64 ExtentPercent }
func MustParseExtents ¶
func NewExtents ¶
func NewExtents(val uint64, percent ExtentPercent) Extents
func ParseExtents ¶
func (Extents) ApplyToArgs ¶
func (Extents) ApplyToLVCreateOptions ¶
func (opt Extents) ApplyToLVCreateOptions(opts *LVCreateOptions)
type FQLogicalVolumeName ¶
type FQLogicalVolumeName struct { VolumeGroupName LogicalVolumeName }
func MustNewFQLogicalVolumeName ¶
func MustNewFQLogicalVolumeName(vg VolumeGroupName, lv LogicalVolumeName) *FQLogicalVolumeName
func NewFQLogicalVolumeName ¶
func NewFQLogicalVolumeName(vg VolumeGroupName, lv LogicalVolumeName) (*FQLogicalVolumeName, error)
func (*FQLogicalVolumeName) ApplyToArgs ¶
func (opt *FQLogicalVolumeName) ApplyToArgs(args Arguments) error
func (*FQLogicalVolumeName) ApplyToLVChangeOptions ¶
func (opt *FQLogicalVolumeName) ApplyToLVChangeOptions(opts *LVChangeOptions)
func (*FQLogicalVolumeName) ApplyToLVCreateOptions ¶
func (opt *FQLogicalVolumeName) ApplyToLVCreateOptions(opts *LVCreateOptions)
func (*FQLogicalVolumeName) ApplyToLVExtendOptions ¶
func (opt *FQLogicalVolumeName) ApplyToLVExtendOptions(opts *LVExtendOptions)
func (*FQLogicalVolumeName) ApplyToLVReduceOptions ¶
func (opt *FQLogicalVolumeName) ApplyToLVReduceOptions(opts *LVReduceOptions)
func (*FQLogicalVolumeName) ApplyToLVRemoveOptions ¶
func (opt *FQLogicalVolumeName) ApplyToLVRemoveOptions(opts *LVRemoveOptions)
func (*FQLogicalVolumeName) ApplyToLVRenameOptions ¶
func (opt *FQLogicalVolumeName) ApplyToLVRenameOptions(opts *LVRenameOptions)
func (*FQLogicalVolumeName) ApplyToLVResizeOptions ¶
func (opt *FQLogicalVolumeName) ApplyToLVResizeOptions(opts *LVResizeOptions)
func (*FQLogicalVolumeName) ApplyToLVsOptions ¶
func (opt *FQLogicalVolumeName) ApplyToLVsOptions(opts *LVsOptions)
func (*FQLogicalVolumeName) Split ¶
func (opt *FQLogicalVolumeName) Split() (VolumeGroupName, LogicalVolumeName)
func (*FQLogicalVolumeName) String ¶
func (opt *FQLogicalVolumeName) String() string
func (*FQLogicalVolumeName) Validate ¶
func (opt *FQLogicalVolumeName) Validate() error
type Force ¶
type Force bool
func (Force) ApplyToArgs ¶
func (Force) ApplyToLVRemoveOptions ¶
func (opt Force) ApplyToLVRemoveOptions(opts *LVRemoveOptions)
func (Force) ApplyToPVCreateOptions ¶
func (opt Force) ApplyToPVCreateOptions(opts *PVCreateOptions)
func (Force) ApplyToPVRemoveOptions ¶
func (opt Force) ApplyToPVRemoveOptions(opts *PVRemoveOptions)
func (Force) ApplyToVGReduceOptions ¶
func (opt Force) ApplyToVGReduceOptions(opts *VGReduceOptions)
func (Force) ApplyToVGRemoveOptions ¶
func (opt Force) ApplyToVGRemoveOptions(opts *VGRemoveOptions)
type LVAllocationPolicyAttr ¶
type LVAllocationPolicyAttr rune
const ( LVAllocationPolicyAttrAnywhere LVAllocationPolicyAttr = 'a' LVAllocationPolicyAttrAnywhereLocked LVAllocationPolicyAttr = 'A' LVAllocationPolicyAttrContiguous LVAllocationPolicyAttr = 'c' LVAllocationPolicyAttrContiguousLocked LVAllocationPolicyAttr = 'C' LVAllocationPolicyAttrInherited LVAllocationPolicyAttr = 'i' LVAllocationPolicyAttrInheritedLocked LVAllocationPolicyAttr = 'I' LVAllocationPolicyAttrCling LVAllocationPolicyAttr = 'l' LVAllocationPolicyAttrClingLocked LVAllocationPolicyAttr = 'L' LVAllocationPolicyAttrNormal LVAllocationPolicyAttr = 'n' LVAllocationPolicyAttrNormalLocked LVAllocationPolicyAttr = 'N' LVAllocationPolicyAttrNone = '-' )
type LVAttributes ¶
type LVAttributes struct { VolumeType LVPermissions LVAllocationPolicyAttr Minor State Open OpenTarget ZeroAttr VolumeHealth SkipActivation }
LVAttributes has mapped lv_attr information, see https://linux.die.net/man/8/lvs It is a complete parsing of the entire attribute byte flags that is attached to each LV. This is useful when attaching logic to the state of an LV as the state of an LV can be determined from the Attributes, e.g. for determining whether an LV is considered a Thin-Pool or not.
func ParseLVAttributes ¶
func ParseLVAttributes(raw string) (LVAttributes, error)
func (LVAttributes) MarshalText ¶
func (attr LVAttributes) MarshalText() ([]byte, error)
func (LVAttributes) String ¶
func (attr LVAttributes) String() string
func (LVAttributes) VerifyHealth ¶
func (attr LVAttributes) VerifyHealth() error
VerifyHealth checks the health of the logical volume based on the attributes, mainly bit 9 (volume health indicator) based on bit 1 (volume type indicator) All failed known states are reported with an error message.
type LVChangeOption ¶
type LVChangeOption interface {
ApplyToLVChangeOptions(opts *LVChangeOptions)
}
type LVChangeOptions ¶
type LVChangeOptions struct { VolumeGroupName LogicalVolumeName Permission Tags DelTags Zero RequestConfirm ActivationState ActivationMode AllocationPolicy *ErrorWhenFull Partial SyncAction Rebuild Resync Discards *Deduplication *Compression AutoActivation CommonOptions }
func (*LVChangeOptions) ApplyToArgs ¶
func (opts *LVChangeOptions) ApplyToArgs(args Arguments) error
func (*LVChangeOptions) ApplyToLVChangeOptions ¶
func (opts *LVChangeOptions) ApplyToLVChangeOptions(new *LVChangeOptions)
type LVChangeOptionsList ¶
type LVChangeOptionsList []LVChangeOption
func (LVChangeOptionsList) AsArgs ¶
func (list LVChangeOptionsList) AsArgs() (Arguments, error)
type LVCreateOption ¶
type LVCreateOption interface {
ApplyToLVCreateOptions(opts *LVCreateOptions)
}
type LVCreateOptionList ¶
type LVCreateOptionList []LVCreateOption
func (LVCreateOptionList) ApplyToLVCreateOptions ¶
func (list LVCreateOptionList) ApplyToLVCreateOptions(opts *LVCreateOptions)
func (LVCreateOptionList) AsArgs ¶
func (list LVCreateOptionList) AsArgs() (Arguments, error)
type LVCreateOptions ¶
type LVCreateOptions struct { VolumeGroupName LogicalVolumeName Tags Size Extents VirtualSize AllocationPolicy ActivationState Zero ChunkSize Type Thin *ThinPool Stripes Mirrors StripeSize CommonOptions }
func (*LVCreateOptions) ApplyToArgs ¶
func (opts *LVCreateOptions) ApplyToArgs(args Arguments) error
func (*LVCreateOptions) ApplyToLVCreateOptions ¶
func (opts *LVCreateOptions) ApplyToLVCreateOptions(new *LVCreateOptions)
type LVExtendOption ¶
type LVExtendOption interface {
ApplyToLVExtendOptions(opts *LVExtendOptions)
}
type LVExtendOptions ¶
type LVExtendOptions struct { VolumeGroupName LogicalVolumeName PoolMetadataPrefixedSize PrefixedSize PrefixedExtents CommonOptions }
func (*LVExtendOptions) ApplyToArgs ¶
func (opts *LVExtendOptions) ApplyToArgs(args Arguments) error
func (*LVExtendOptions) ApplyToLVExtendOptions ¶
func (opts *LVExtendOptions) ApplyToLVExtendOptions(new *LVExtendOptions)
type LVExtendOptionsList ¶
type LVExtendOptionsList []LVExtendOption
func (LVExtendOptionsList) AsArgs ¶
func (list LVExtendOptionsList) AsArgs() (Arguments, error)
type LVMStdErr ¶
type LVMStdErr interface { error Bytes() []byte Lines(trimPrefix bool) [][]byte Warnings() []Warning }
func AsLVMStdErr ¶
AsLVMStdErr returns the LVMStdErr from the error if it exists and a bool indicating if LVMStdErr is present or not.
func NewLVMStdErr ¶
type LVPermissions ¶
type LVPermissions rune
const ( LVPermissionsWriteable LVPermissions = 'w' LVPermissionsReadOnly LVPermissions = 'r' LVPermissionsReadOnlyActivationOfNonReadOnlyVolume LVPermissions = 'R' LVPermissionsNone LVPermissions = '-' )
type LVReduceOption ¶
type LVReduceOption interface {
ApplyToLVReduceOptions(opts *LVReduceOptions)
}
type LVReduceOptions ¶
type LVReduceOptions struct { VolumeGroupName LogicalVolumeName CommonOptions }
func (*LVReduceOptions) ApplyToArgs ¶
func (opts *LVReduceOptions) ApplyToArgs(_ Arguments) error
type LVReduceOptionsList ¶
type LVReduceOptionsList []LVReduceOption
func (LVReduceOptionsList) AsArgs ¶
func (list LVReduceOptionsList) AsArgs() (Arguments, error)
type LVRemoveOption ¶
type LVRemoveOption interface {
ApplyToLVRemoveOptions(opts *LVRemoveOptions)
}
type LVRemoveOptions ¶
type LVRemoveOptions struct { LogicalVolumeName VolumeGroupName Force Tags Select CommonOptions }
func (*LVRemoveOptions) ApplyToArgs ¶
func (opts *LVRemoveOptions) ApplyToArgs(args Arguments) error
func (*LVRemoveOptions) ApplyToLVRemoveOptions ¶
func (opts *LVRemoveOptions) ApplyToLVRemoveOptions(new *LVRemoveOptions)
type LVRemoveOptionsList ¶
type LVRemoveOptionsList []LVRemoveOption
func (LVRemoveOptionsList) AsArgs ¶
func (list LVRemoveOptionsList) AsArgs() (Arguments, error)
type LVRenameOption ¶
type LVRenameOption interface {
ApplyToLVRenameOptions(opts *LVRenameOptions)
}
type LVRenameOptions ¶
type LVRenameOptions struct { VolumeGroupName Old LogicalVolumeName New LogicalVolumeName CommonOptions }
func (*LVRenameOptions) ApplyToArgs ¶
func (opts *LVRenameOptions) ApplyToArgs(args Arguments) error
func (*LVRenameOptions) ApplyToLVRenameOptions ¶
func (opts *LVRenameOptions) ApplyToLVRenameOptions(other *LVRenameOptions)
func (*LVRenameOptions) SetOldOrNew ¶
func (opts *LVRenameOptions) SetOldOrNew(name LogicalVolumeName)
type LVRenameOptionsList ¶
type LVRenameOptionsList []LVRenameOption
func (LVRenameOptionsList) AsArgs ¶
func (list LVRenameOptionsList) AsArgs() (Arguments, error)
type LVResizeOption ¶
type LVResizeOption interface {
ApplyToLVResizeOptions(opts *LVResizeOptions)
}
type LVResizeOptions ¶
type LVResizeOptions struct { LogicalVolumeName VolumeGroupName PrefixedSize CommonOptions }
func (*LVResizeOptions) ApplyToArgs ¶
func (opts *LVResizeOptions) ApplyToArgs(args Arguments) error
func (*LVResizeOptions) ApplyToLVResizeOptions ¶
func (opts *LVResizeOptions) ApplyToLVResizeOptions(new *LVResizeOptions)
type LVResizeOptionsList ¶
type LVResizeOptionsList []LVResizeOption
func (LVResizeOptionsList) AsArgs ¶
func (list LVResizeOptionsList) AsArgs() (Arguments, error)
type LVsOption ¶
type LVsOption interface {
ApplyToLVsOptions(opts *LVsOptions)
}
type LVsOptions ¶
type LVsOptions struct { VolumeGroupName LogicalVolumeName Tags Unit Select ColumnOptions CommonOptions }
func (*LVsOptions) ApplyToArgs ¶
func (opts *LVsOptions) ApplyToArgs(args Arguments) error
func (*LVsOptions) ApplyToLVsOptions ¶
func (opts *LVsOptions) ApplyToLVsOptions(new *LVsOptions)
type LVsOptionsList ¶
type LVsOptionsList []LVsOption
func (LVsOptionsList) AsArgs ¶
func (list LVsOptionsList) AsArgs() (Arguments, error)
type LogicalAndGroupingOperator ¶
type LogicalAndGroupingOperator SelectionOperator
const ( AllFieldsMatch LogicalAndGroupingOperator = "&&" AllFieldsMatchAlt LogicalAndGroupingOperator = "," AtLeastOneFieldMatches LogicalAndGroupingOperator = "||" AtLeastOneFieldMatchesAlt LogicalAndGroupingOperator = "#" LogicalNegation LogicalAndGroupingOperator = "!" RightParenthesis LogicalAndGroupingOperator = ")" LeftParenthesis LogicalAndGroupingOperator = "(" ListStart LogicalAndGroupingOperator = "[" ListEnd LogicalAndGroupingOperator = "]" ListSubsetStart LogicalAndGroupingOperator = "{" ListSubsetEnd LogicalAndGroupingOperator = "}" )
type LogicalVolume ¶
type LogicalVolume struct { UUID string `json:"lv_uuid"` Name LogicalVolumeName `json:"lv_name"` FullName string `json:"lv_full_name"` Path string `json:"lv_path"` Major int64 `json:"lv_kernel_major"` Minor int64 `json:"lv_kernel_minor"` Tags Tags `json:"lv_tags"` Attr LVAttributes `json:"lv_attr"` Size Size `json:"lv_size"` Origin string `json:"origin"` OriginSize Size `json:"origin_size"` PoolLogicalVolume string `json:"pool_lv"` VolumeGroupName VolumeGroupName `json:"vg_name"` DataPercent float64 `json:"data_percent"` MetadataPercent float64 `json:"metadata_percent"` }
func (*LogicalVolume) GetFQLogicalVolumeName ¶
func (lv *LogicalVolume) GetFQLogicalVolumeName() (*FQLogicalVolumeName, error)
func (*LogicalVolume) UnmarshalJSON ¶
func (lv *LogicalVolume) UnmarshalJSON(data []byte) error
type LogicalVolumeClient ¶
type LogicalVolumeClient interface { // LV returns a logical volume that matches the given options. // // If no LogicalVolumeName is defined, ErrLogicalVolumeNameRequired is returned. // If no VolumeGroupName is defined, ErrVolumeGroupNameRequired is returned. // If no logical volume is found in the volume group, ErrLogicalVolumeNotFound is returned. // // It is equivalent to calling LVs with the same options and returning the first logical volume in the list. // see LVs for more information. LV(ctx context.Context, opts ...LVsOption) (*LogicalVolume, error) // LVs return a list of logical volumes that match the given options. // // If no logical volumes are found, an empty slice is returned. // If options limit the number of volume groups returned, // the slice may be shorter than the total number of logical volumes. // // See man lvm lvs for more information. LVs(ctx context.Context, opts ...LVsOption) ([]*LogicalVolume, error) // LVCreate creates a new logical volume with the given options. // // See man lvm lvcreate for more information. LVCreate(ctx context.Context, opts ...LVCreateOption) error // LVRemove removes a logical volume with the given options. // // See man lvm lvremove for more information. LVRemove(ctx context.Context, opts ...LVRemoveOption) error // LVResize resizes a logical volume with the given options. // // See man lvm lvresize for more information. LVResize(ctx context.Context, opts ...LVResizeOption) error // LVExtend extends a logical volume with the given options. // // See man lvm lvextend for more information. LVExtend(ctx context.Context, opts ...LVExtendOption) error // LVReduce reduces a logical volume with the given options. // // See man lvm lvreduce for more information. LVReduce(ctx context.Context, opts ...LVReduceOption) error // LVRename renames a logical volume with the given options. // // See man lvm lvrename for more information. LVRename(ctx context.Context, opts ...LVRenameOption) error // LVChange changes a logical volume with the given options. // // See man lvm lvchange for more information. LVChange(ctx context.Context, opts ...LVChangeOption) error }
LogicalVolumeClient is a client that provides operations on lvm2 logical volumes.
type LogicalVolumeName ¶
type LogicalVolumeName string
func (LogicalVolumeName) ApplyToArgs ¶
func (opt LogicalVolumeName) ApplyToArgs(args Arguments) error
func (LogicalVolumeName) ApplyToLVChangeOptions ¶
func (opt LogicalVolumeName) ApplyToLVChangeOptions(opts *LVChangeOptions)
func (LogicalVolumeName) ApplyToLVCreateOptions ¶
func (opt LogicalVolumeName) ApplyToLVCreateOptions(opts *LVCreateOptions)
func (LogicalVolumeName) ApplyToLVExtendOptions ¶
func (opt LogicalVolumeName) ApplyToLVExtendOptions(opts *LVExtendOptions)
func (LogicalVolumeName) ApplyToLVReduceOptions ¶
func (opt LogicalVolumeName) ApplyToLVReduceOptions(opts *LVReduceOptions)
func (LogicalVolumeName) ApplyToLVRemoveOptions ¶
func (opt LogicalVolumeName) ApplyToLVRemoveOptions(opts *LVRemoveOptions)
func (LogicalVolumeName) ApplyToLVRenameOptions ¶
func (opt LogicalVolumeName) ApplyToLVRenameOptions(opts *LVRenameOptions)
func (LogicalVolumeName) ApplyToLVResizeOptions ¶
func (opt LogicalVolumeName) ApplyToLVResizeOptions(opts *LVResizeOptions)
func (LogicalVolumeName) ApplyToLVsOptions ¶
func (opt LogicalVolumeName) ApplyToLVsOptions(opts *LVsOptions)
func (LogicalVolumeName) ApplyToPVMoveOptions ¶
func (opt LogicalVolumeName) ApplyToPVMoveOptions(opts *PVMoveOptions)
type LoopbackDevice ¶
type LoopbackDevice interface { Open() error Close() error FindFree() error SetBackingFile(file string) error Device() string Size() Size File() string IsOpen() bool IsClosed() bool }
LoopbackDevice is an interface that represents a loopback device created with losetup. It can be used to create a loopback device with a backing file, find a free loopback device, open (set it up) and close (detach) the loopback device. for more information see man losetup.
func CreateLoopbackDevice ¶
func CreateLoopbackDevice(size Size) (LoopbackDevice, error)
CreateLoopbackDevice creates a loopback device with the specified size that has no backing file or device. Example:
dev, err := CreateLoopbackDevice("4G") if err != nil { panic(err) } fmt.Println(dev.IsOpen()) <-- false fmt.Println(dev.Device()) <-- "" fmt.Println(dev.File()) <-- "" if err := dev.SetBackingFile(""); err != nil { panic(err) } fmt.Println(dev.File()) <-- "/tmp/loopback-538104538104538104538104538104538104.img" if err := dev.FindFree(); err != nil { panic(err) } fmt.Println(dev.Device()) <-- "/dev/loop0" if err := dev.Open(); err != nil { panic(err) } defer dev.Close() fmt.Println(dev.IsOpen()) <-- true
func NewLoopbackDevice ¶
func NewLoopbackDevice(size Size) (LoopbackDevice, error)
NewLoopbackDevice creates a loopback device with the specified size and returns the loopback device name Example:
dev, err := NewLoopbackDevice("4G") if err != nil { panic(err) } defer dev.Close() fmt.Println(dev.IsOpen()) <-- true fmt.Println(dev.Device()) <-- /dev/loop0
type MaximumLogicalVolumes ¶
type MaximumLogicalVolumes int
func (MaximumLogicalVolumes) ApplyToArgs ¶
func (opt MaximumLogicalVolumes) ApplyToArgs(args Arguments) error
func (MaximumLogicalVolumes) ApplyToVGChangeOptions ¶
func (opt MaximumLogicalVolumes) ApplyToVGChangeOptions(opts *VGChangeOptions)
func (MaximumLogicalVolumes) ApplyToVGCreateOptions ¶
func (opt MaximumLogicalVolumes) ApplyToVGCreateOptions(opts *VGCreateOptions)
type MaximumPhysicalVolumes ¶
type MaximumPhysicalVolumes int
func (MaximumPhysicalVolumes) ApplyToArgs ¶
func (opt MaximumPhysicalVolumes) ApplyToArgs(args Arguments) error
func (MaximumPhysicalVolumes) ApplyToVGChangeOptions ¶
func (opt MaximumPhysicalVolumes) ApplyToVGChangeOptions(opts *VGChangeOptions)
func (MaximumPhysicalVolumes) ApplyToVGCreateOptions ¶
func (opt MaximumPhysicalVolumes) ApplyToVGCreateOptions(opts *VGCreateOptions)
type MetaClient ¶
type MetaClient interface { // Version returns the version of the LVM2 library. // If the version cannot be determined, an error is returned. // // See man lvm version for more information. Version(ctx context.Context, opts ...VersionOption) (Version, error) // RawConfig returns the raw configuration of the LVM2 library. // If the configuration cannot be determined, an error is returned. // The configuration is returned as an unstructured map. // // See man lvm config for more information. RawConfig(ctx context.Context, opts ...ConfigOption) (RawConfig, error) // ReadAndDecodeConfig requests and decodes configuration values from lvm2 formatted files. // The configuration values are decoded into the given value v. // If the configuration cannot be determined, an error is returned. // The configuration v has to be formatted in a very specific way. // // An inner struct field represents each Config Block in an lvm configuration file. // The inner struct field must be tagged with the tag of key LVMConfigStructTag set to the value // corresponding to the config block. // The config block struct field must be exported. // // A field represents each Value in a Config Block in the inner struct. // The field must be tagged with the LVMConfigStructTag and its value set to the key of the value in the lvm config. // The field must be exported. // // Example: // type LVMConfig struct { // Devices struct { // Dir string `lvm:"dir"` // } `lvm:"devices"` // } // // The above struct will result in the following query: // "lvm config devices/dir" // // Note that the query can be extended and changed similarly to RawConfig. // E.g., to query the full merged configuration, use ConfigTypeFull. // Otherwise, the default configuration is queried, which might not result in a key being found. // // Possible value types for configuration keys are: // - string // - int(8,16,32,64) ReadAndDecodeConfig(ctx context.Context, v any, opts ...ConfigOption) error // WriteAndEncodeConfig writes configuration values to the given writer. // The configuration values are encoded from the given value v. // If the configuration cannot be written, an error is returned. // The configuration v has to be formatted in a very specific way that is equivalent to the format of ReadAndDecodeConfig. // // Example: // type LVMConfig struct { // Devices struct { // Dir string `lvm:"dir"` // } `lvm:"devices"` // } // // The above struct will result in the following write // devices { // dir="/dev" // } // // Possible value types for configuration keys are: // - string // - int64 // // Note that in lvm2, int64 is used for all integer values as well as for boolean values (0 = false, 1 = true). WriteAndEncodeConfig(ctx context.Context, v any, writer io.Writer) error // UpdateGlobalConfig updates the global configuration with the given values from v. // If the configuration cannot be updated, an error is returned. // For more information on the written config file, see LVMGlobalConfiguration // For more information on v and its structure, see WriteAndEncodeConfig. UpdateGlobalConfig(ctx context.Context, v any) error // UpdateLocalConfig updates the local configuration with the given values from v. // If the configuration cannot be updated, an error is returned. // For more information on the written config file, see LVMLocalConfiguration // For more information on v and its structure, see WriteAndEncodeConfig. UpdateLocalConfig(ctx context.Context, v any) error // UpdateProfileConfig updates the profile configuration with the given values from v. // The profile is expected to be resolvable to a valid path (for more information see GetProfilePath). // If the configuration cannot be updated, an error is returned. // For more information on v and its structure, see WriteAndEncodeConfig. UpdateProfileConfig(ctx context.Context, v any, profile Profile) error // CreateProfile creates a profile with the given profileName and value. // The Profile is encoded from the given value v. // The Profile is expected to be resolvable to a valid path (for more information see GetProfilePath). // // Note that although all keys can be used in the profile, lvm2 might error on unknown keys or fail // on unsupported keys. // To avoid this, make sure the keys in v are one of the keys reported by lvm2 // when running "lvmconfig --typeconfig profilable" (or use ConfigTypeProfilable with RawConfig). CreateProfile(ctx context.Context, v any, profile Profile) (string, error) // RemoveProfile removes a profile with the given profileName. // The Profile is expected to be resolvable to a valid path (for more information see GetProfilePath). RemoveProfile(ctx context.Context, profile Profile) error // GetProfilePath returns the path to the profile within the profile directory as configured on the host. // // Example: // for a configured profile directory /etc/lvm/profile on the host, the following result will be returned: // - GetProfilePath(ctx, "test") -> "/etc/lvm/profile/test.profile", nil // - GetProfilePath(ctx, "test.profile") -> "/etc/lvm/profile/test.profile", nil // - GetProfilePath(ctx, "/etc/lvm/profile/test") -> "/etc/lvm/profile/test.profile", nil // - GetProfilePath(ctx, "/etc/lvm/profile/test.profile") -> "/etc/lvm/profile/test.profile", nil // - GetProfilePath(ctx, "/var/test") -> "", error // - GetProfilePath(ctx, "/var/") -> "", error // - GetProfilePath(ctx, "test.something") -> "", error // // For more information on the profile directory, check the lvm2 configuration. // Usually, the directory is set to /etc/lvm/profile as per config key config/profile_dir, // but it can be changed to any other directory based on the host. // For getting the current profile directory, see GetProfileDirectory. GetProfilePath(ctx context.Context, profile Profile) (string, error) // GetProfileDirectory returns the profile directory as configured on the host. // If the profile directory cannot be determined, an error is returned. // The profile directory is the directory where lvm2 profiles are stored. // The directory is expected to be resolvable to a valid path. // // See man lvm and man lvmconfig for more information. GetProfileDirectory(ctx context.Context) (string, error) }
MetaClient is a client that provides metadata information about the LVM2 library. This includes the version of the library and the raw configuration on the host system.
type MetadataSize ¶
type MetadataSize Size
func (MetadataSize) ApplyToArgs ¶
func (opt MetadataSize) ApplyToArgs(args Arguments) error
func (MetadataSize) ApplyToPVCreateOptions ¶
func (opt MetadataSize) ApplyToPVCreateOptions(opts *PVCreateOptions)
func (MetadataSize) ApplyToVGCreateOptions ¶
func (opt MetadataSize) ApplyToVGCreateOptions(opts *VGCreateOptions)
type Mirrors ¶
type Mirrors int
func (Mirrors) ApplyToArgs ¶
func (Mirrors) ApplyToLVCreateOptions ¶
func (opt Mirrors) ApplyToLVCreateOptions(opts *LVCreateOptions)
type ModifyDevice ¶
type ModifyDevice struct { Device string ModifyDeviceType }
func AddDevice ¶
func AddDevice(device string) ModifyDevice
func AddDeviceByPVID ¶
func AddDeviceByPVID(pvid string) ModifyDevice
func DelDevice ¶
func DelDevice(device string) ModifyDevice
func DelDeviceByPVID ¶
func DelDeviceByPVID(pvid string) ModifyDevice
func (ModifyDevice) ApplyToArgs ¶
func (opt ModifyDevice) ApplyToArgs(args Arguments) error
func (ModifyDevice) ApplyToDevModifyOptions ¶
func (opt ModifyDevice) ApplyToDevModifyOptions(opts *DevModifyOptions)
type ModifyDeviceType ¶
type ModifyDeviceType string
const ( DelDev ModifyDeviceType = "deldev" DelDevByPVID ModifyDeviceType = "delpvid" AddDev ModifyDeviceType = "adddev" AddDevByPVID ModifyDeviceType = "addpvid" )
type OpenTarget ¶
type OpenTarget rune
type PVAttributes ¶
type PVAttributes struct { DuplicateAllocatableUsed Exported Missing }
func ParsePVAttributes ¶
func ParsePVAttributes(raw string) (PVAttributes, error)
func (PVAttributes) MarshalText ¶
func (attr PVAttributes) MarshalText() ([]byte, error)
func (PVAttributes) String ¶
func (attr PVAttributes) String() string
type PVChangeOption ¶
type PVChangeOption interface {
ApplyToPVChangeOptions(opts *PVChangeOptions)
}
type PVChangeOptions ¶
type PVChangeOptions struct { PhysicalVolumeName Tags DelTags CommonOptions }
func (*PVChangeOptions) ApplyToArgs ¶
func (opts *PVChangeOptions) ApplyToArgs(args Arguments) error
func (*PVChangeOptions) ApplyToPVChangeOptions ¶
func (opts *PVChangeOptions) ApplyToPVChangeOptions(new *PVChangeOptions)
type PVChangeOptionsList ¶
type PVChangeOptionsList []PVChangeOption
func (PVChangeOptionsList) AsArgs ¶
func (list PVChangeOptionsList) AsArgs() (Arguments, error)
type PVCreateOption ¶
type PVCreateOption interface {
ApplyToPVCreateOptions(opts *PVCreateOptions)
}
type PVCreateOptions ¶
type PVCreateOptions struct { PhysicalVolumeName Force Zero DataAlignment DataAlignmentOffset MetadataSize CommonOptions }
func (*PVCreateOptions) ApplyToArgs ¶
func (opts *PVCreateOptions) ApplyToArgs(args Arguments) error
func (*PVCreateOptions) ApplyToPVCreateOptions ¶
func (opts *PVCreateOptions) ApplyToPVCreateOptions(new *PVCreateOptions)
type PVCreateOptionsList ¶
type PVCreateOptionsList []PVCreateOption
func (PVCreateOptionsList) AsArgs ¶
func (list PVCreateOptionsList) AsArgs() (Arguments, error)
type PVMoveOption ¶
type PVMoveOption interface {
ApplyToPVMoveOptions(opts *PVMoveOptions)
}
type PVMoveOptions ¶
type PVMoveOptions struct { From PhysicalVolumeName To PhysicalVolumeNames LogicalVolumeName AllocationPolicy CommonOptions }
func (*PVMoveOptions) ApplyToArgs ¶
func (opts *PVMoveOptions) ApplyToArgs(args Arguments) error
func (*PVMoveOptions) ApplyToPVMoveOptions ¶
func (opts *PVMoveOptions) ApplyToPVMoveOptions(new *PVMoveOptions)
func (*PVMoveOptions) SetOldOrNew ¶
func (opts *PVMoveOptions) SetOldOrNew(name PhysicalVolumeName)
type PVMoveOptionsList ¶
type PVMoveOptionsList []PVMoveOption
func (PVMoveOptionsList) AsArgs ¶
func (list PVMoveOptionsList) AsArgs() (Arguments, error)
type PVRemoveOption ¶
type PVRemoveOption interface {
ApplyToPVRemoveOptions(opts *PVRemoveOptions)
}
type PVRemoveOptions ¶
type PVRemoveOptions struct { PhysicalVolumeName Force CommonOptions }
func (*PVRemoveOptions) ApplyToArgs ¶
func (opts *PVRemoveOptions) ApplyToArgs(args Arguments) error
func (*PVRemoveOptions) ApplyToPVRemoveOptions ¶
func (opts *PVRemoveOptions) ApplyToPVRemoveOptions(new *PVRemoveOptions)
type PVRemoveOptionsList ¶
type PVRemoveOptionsList []PVRemoveOption
func (PVRemoveOptionsList) AsArgs ¶
func (list PVRemoveOptionsList) AsArgs() (Arguments, error)
type PVResizeOption ¶
type PVResizeOption interface {
ApplyToPVResizeOptions(opts *PVResizeOptions)
}
type PVResizeOptions ¶
type PVResizeOptions struct { PhysicalVolumeName CommonOptions }
func (*PVResizeOptions) ApplyToArgs ¶
func (opts *PVResizeOptions) ApplyToArgs(args Arguments) error
func (*PVResizeOptions) ApplyToPVResizeOptions ¶
func (opts *PVResizeOptions) ApplyToPVResizeOptions(new *PVResizeOptions)
type PVResizeOptionsList ¶
type PVResizeOptionsList []PVResizeOption
func (PVResizeOptionsList) AsArgs ¶
func (list PVResizeOptionsList) AsArgs() (Arguments, error)
type PVsOption ¶
type PVsOption interface {
ApplyToPVsOptions(opts *PVsOptions)
}
type PVsOptions ¶
type PVsOptions struct { Unit Tags Select ColumnOptions CommonOptions }
func (*PVsOptions) ApplyToArgs ¶
func (opts *PVsOptions) ApplyToArgs(args Arguments) error
func (*PVsOptions) ApplyToPVsOptions ¶
func (opts *PVsOptions) ApplyToPVsOptions(new *PVsOptions)
type PVsOptionsList ¶
type PVsOptionsList []PVsOption
func (PVsOptionsList) AsArgs ¶
func (list PVsOptionsList) AsArgs() (Arguments, error)
type Partial ¶
type Partial bool
func (Partial) ApplyToArgs ¶
func (Partial) ApplyToLVChangeOptions ¶
func (opt Partial) ApplyToLVChangeOptions(opts *LVChangeOptions)
type PartialAttr ¶
type PartialAttr rune
const ( PartialAttrTrue PartialAttr = 'p' PartialAttrFalse PartialAttr = '-' )
type Permission ¶
type Permission string
const ( PermissionReadOnly Permission = "r" PermissionReadWrite Permission = "rw" )
func (Permission) ApplyToArgs ¶
func (opt Permission) ApplyToArgs(args Arguments) error
func (Permission) ApplyToLVChangeOptions ¶
func (opt Permission) ApplyToLVChangeOptions(opts *LVChangeOptions)
type PhysicalExtentSize ¶
type PhysicalExtentSize Size
func (PhysicalExtentSize) ApplyToArgs ¶
func (opt PhysicalExtentSize) ApplyToArgs(args Arguments) error
func (PhysicalExtentSize) ApplyToVGCreateOptions ¶
func (opt PhysicalExtentSize) ApplyToVGCreateOptions(opts *VGCreateOptions)
type PhysicalVolume ¶
type PhysicalVolume struct { UUID string `json:"pv_uuid"` Name PhysicalVolumeName `json:"pv_name"` DevSize Size `json:"dev_size"` Attr PVAttributes `json:"pv_attr"` Major int64 `json:"pv_major"` Minor int64 `json:"pv_minor"` MdaFree Size `json:"pv_mda_free"` MdaSize Size `json:"pv_mda_size"` PeStart Size `json:"pe_start"` Size Size `json:"pv_size"` Free Size `json:"pv_free"` Used Size `json:"pv_used"` MdaCount int64 `json:"pv_mda_count"` MdaUsedCount int64 `json:"pv_mda_used_count"` Tags Tags `json:"pv_tags"` VGName VolumeGroupName `json:"vg_name"` DeviceID string `json:"pv_device_id"` DeviceIDType string `json:"pv_device_id_type"` }
func (*PhysicalVolume) UnmarshalJSON ¶
func (pv *PhysicalVolume) UnmarshalJSON(data []byte) error
type PhysicalVolumeClient ¶
type PhysicalVolumeClient interface { // PVs return a list of physical volumes that match the given options. // // If no physical volumes are found, an empty slice is returned. // If options limit the number of physical volumes returned, // the slice may be shorter than the total number of physical volumes. // // See man lvm pvs for more information. PVs(ctx context.Context, opts ...PVsOption) ([]*PhysicalVolume, error) // PVCreate creates a new physical volume with the given options. // // See man lvm pvcreate for more information. PVCreate(ctx context.Context, opts ...PVCreateOption) error // PVRemove removes a physical volume with the given options. // // See man lvm pvremove for more information. PVRemove(ctx context.Context, opts ...PVRemoveOption) error // PVResize removes a physical volume with the given options. // // See man lvm pvresize for more information. PVResize(ctx context.Context, opts ...PVResizeOption) error // PVChange changes a physical volume with the given options. // // See man lvm pvchange for more information. PVChange(ctx context.Context, opts ...PVChangeOption) error // PVMove moves extents between physical volumes with the given options. // // see man lvm pvmove for more information. PVMove(ctx context.Context, opts ...PVMoveOption) error }
PhysicalVolumeClient is a client that provides operations on lvm2 physical volumes.
type PhysicalVolumeName ¶
type PhysicalVolumeName string
func (PhysicalVolumeName) ApplyToArgs ¶
func (opt PhysicalVolumeName) ApplyToArgs(args Arguments) error
func (PhysicalVolumeName) ApplyToPVChangeOptions ¶
func (opt PhysicalVolumeName) ApplyToPVChangeOptions(opts *PVChangeOptions)
func (PhysicalVolumeName) ApplyToPVMoveOptions ¶
func (opt PhysicalVolumeName) ApplyToPVMoveOptions(opts *PVMoveOptions)
func (PhysicalVolumeName) ApplyToPVRemoveOptions ¶
func (opt PhysicalVolumeName) ApplyToPVRemoveOptions(opts *PVRemoveOptions)
func (PhysicalVolumeName) ApplyToVGCreateOptions ¶
func (opt PhysicalVolumeName) ApplyToVGCreateOptions(opts *VGCreateOptions)
func (PhysicalVolumeName) ApplyToVGExtendOptions ¶
func (opt PhysicalVolumeName) ApplyToVGExtendOptions(opts *VGExtendOptions)
func (PhysicalVolumeName) ApplyToVGReduceOptions ¶
func (opt PhysicalVolumeName) ApplyToVGReduceOptions(opts *VGReduceOptions)
type PhysicalVolumeNames ¶
type PhysicalVolumeNames []PhysicalVolumeName
func PhysicalVolumesFrom ¶
func PhysicalVolumesFrom(names ...string) PhysicalVolumeNames
func (PhysicalVolumeNames) ApplyToArgs ¶
func (opt PhysicalVolumeNames) ApplyToArgs(args Arguments) error
func (PhysicalVolumeNames) ApplyToPVMoveOptions ¶
func (opt PhysicalVolumeNames) ApplyToPVMoveOptions(opts *PVMoveOptions)
func (PhysicalVolumeNames) ApplyToVGCreateOptions ¶
func (opt PhysicalVolumeNames) ApplyToVGCreateOptions(opts *VGCreateOptions)
func (PhysicalVolumeNames) ApplyToVGExtendOptions ¶
func (opt PhysicalVolumeNames) ApplyToVGExtendOptions(opts *VGExtendOptions)
func (PhysicalVolumeNames) ApplyToVGReduceOptions ¶
func (opt PhysicalVolumeNames) ApplyToVGReduceOptions(opts *VGReduceOptions)
type PoolMetadataPrefixedSize ¶
type PoolMetadataPrefixedSize PrefixedSize
func (PoolMetadataPrefixedSize) ApplyToArgs ¶
func (opt PoolMetadataPrefixedSize) ApplyToArgs(args Arguments) error
type PoolMetadataSize ¶
type PoolMetadataSize Size
func (PoolMetadataSize) ApplyToArgs ¶
func (opt PoolMetadataSize) ApplyToArgs(args Arguments) error
type PrefixedExtents ¶
type PrefixedExtents struct { SizePrefix Extents }
func MustParsePrefixedExtents ¶
func MustParsePrefixedExtents(str string) PrefixedExtents
func NewPrefixedExtents ¶
func NewPrefixedExtents(prefix SizePrefix, extents Extents) PrefixedExtents
func ParsePrefixedExtents ¶
func ParsePrefixedExtents(str string) (PrefixedExtents, error)
func (PrefixedExtents) ApplyToArgs ¶
func (opt PrefixedExtents) ApplyToArgs(args Arguments) error
func (PrefixedExtents) ApplyToLVExtendOptions ¶
func (opt PrefixedExtents) ApplyToLVExtendOptions(opts *LVExtendOptions)
func (PrefixedExtents) Validate ¶
func (opt PrefixedExtents) Validate() error
type PrefixedSize ¶
type PrefixedSize struct { SizePrefix Size }
func MustParsePrefixedSize ¶
func MustParsePrefixedSize(str string) PrefixedSize
func NewPrefixedSize ¶
func NewPrefixedSize(prefix SizePrefix, size Size) PrefixedSize
func ParsePrefixedSize ¶
func ParsePrefixedSize(str string) (PrefixedSize, error)
func (PrefixedSize) ApplyToArgs ¶
func (opt PrefixedSize) ApplyToArgs(args Arguments) error
func (PrefixedSize) ApplyToLVExtendOptions ¶
func (opt PrefixedSize) ApplyToLVExtendOptions(opts *LVExtendOptions)
func (PrefixedSize) ApplyToLVResizeOptions ¶
func (opt PrefixedSize) ApplyToLVResizeOptions(opts *LVResizeOptions)
func (PrefixedSize) Validate ¶
func (opt PrefixedSize) Validate() error
type Profile ¶
type Profile string
func (Profile) ApplyToArgs ¶
func (Profile) ApplyToConfigOptions ¶
func (opt Profile) ApplyToConfigOptions(opts *ConfigOptions)
func (Profile) ApplyToLVChangeOptions ¶
func (opt Profile) ApplyToLVChangeOptions(opts *LVChangeOptions)
func (Profile) ApplyToLVCreateOptions ¶
func (opt Profile) ApplyToLVCreateOptions(opts *LVCreateOptions)
func (Profile) ApplyToLVExtendOptions ¶
func (opt Profile) ApplyToLVExtendOptions(opts *LVExtendOptions)
func (Profile) ApplyToLVReduceOptions ¶
func (opt Profile) ApplyToLVReduceOptions(opts *LVReduceOptions)
func (Profile) ApplyToLVRemoveOptions ¶
func (opt Profile) ApplyToLVRemoveOptions(opts *LVRemoveOptions)
func (Profile) ApplyToLVRenameOptions ¶
func (opt Profile) ApplyToLVRenameOptions(opts *LVRenameOptions)
func (Profile) ApplyToLVResizeOptions ¶
func (opt Profile) ApplyToLVResizeOptions(opts *LVResizeOptions)
func (Profile) ApplyToLVsOptions ¶
func (opt Profile) ApplyToLVsOptions(opts *LVsOptions)
func (Profile) ApplyToPVChangeOptions ¶
func (opt Profile) ApplyToPVChangeOptions(opts *PVChangeOptions)
func (Profile) ApplyToPVCreateOptions ¶
func (opt Profile) ApplyToPVCreateOptions(opts *PVCreateOptions)
func (Profile) ApplyToPVMoveOptions ¶
func (opt Profile) ApplyToPVMoveOptions(opts *PVMoveOptions)
func (Profile) ApplyToPVRemoveOptions ¶
func (opt Profile) ApplyToPVRemoveOptions(opts *PVRemoveOptions)
func (Profile) ApplyToPVResizeOptions ¶
func (opt Profile) ApplyToPVResizeOptions(opts *PVResizeOptions)
func (Profile) ApplyToPVsOptions ¶
func (opt Profile) ApplyToPVsOptions(opts *PVsOptions)
func (Profile) ApplyToVGChangeOptions ¶
func (opt Profile) ApplyToVGChangeOptions(opts *VGChangeOptions)
func (Profile) ApplyToVGCreateOptions ¶
func (opt Profile) ApplyToVGCreateOptions(opts *VGCreateOptions)
func (Profile) ApplyToVGExtendOptions ¶
func (opt Profile) ApplyToVGExtendOptions(opts *VGExtendOptions)
func (Profile) ApplyToVGReduceOptions ¶
func (opt Profile) ApplyToVGReduceOptions(opts *VGReduceOptions)
func (Profile) ApplyToVGRemoveOptions ¶
func (opt Profile) ApplyToVGRemoveOptions(opts *VGRemoveOptions)
func (Profile) ApplyToVGRenameOptions ¶
func (opt Profile) ApplyToVGRenameOptions(opts *VGRenameOptions)
func (Profile) ApplyToVGsOptions ¶
func (opt Profile) ApplyToVGsOptions(opts *VGsOptions)
type RawOutputProcessor ¶
func NoOpRawOutputProcessor ¶
func NoOpRawOutputProcessor() RawOutputProcessor
type Rebuild ¶
type Rebuild bool
func (Rebuild) ApplyToArgs ¶
func (Rebuild) ApplyToLVChangeOptions ¶
func (opt Rebuild) ApplyToLVChangeOptions(opts *LVChangeOptions)
type RefreshDevices ¶
type RefreshDevices bool
func (RefreshDevices) ApplyToArgs ¶
func (opt RefreshDevices) ApplyToArgs(args Arguments) error
func (RefreshDevices) ApplyToDevUpdateOptions ¶
func (opt RefreshDevices) ApplyToDevUpdateOptions(opts *DevUpdateOptions)
type RemoveMissing ¶
type RemoveMissing bool
func (RemoveMissing) ApplyToArgs ¶
func (opt RemoveMissing) ApplyToArgs(args Arguments) error
func (RemoveMissing) ApplyToVGReduceOptions ¶
func (opt RemoveMissing) ApplyToVGReduceOptions(opts *VGReduceOptions)
type RequestConfirm ¶
type RequestConfirm bool
func (RequestConfirm) ApplyToArgs ¶
func (opt RequestConfirm) ApplyToArgs(args Arguments) error
type Resizeable ¶
type Resizeable rune
const ( ResizeableTrue Resizeable = 'z' ResizeableFalse Resizeable = '-' )
type Resync ¶
type Resync bool
func (Resync) ApplyToArgs ¶
func (Resync) ApplyToLVChangeOptions ¶
func (opt Resync) ApplyToLVChangeOptions(opts *LVChangeOptions)
type Select ¶
type Select string
func NewCombinedSelect ¶
func NewCombinedSelect(operator LogicalAndGroupingOperator, selects ...Select) Select
func NewMatchesAllSelect ¶
func NewMatchesAllSelector ¶
func NewMatchesAnySelect ¶
func NewMatchesAnySelector ¶
func NewSelector ¶
func NewSelector( lo LogicalAndGroupingOperator, co SelectionComparisonOperator, fields map[string]string, ) Select
func (Select) ApplyToArgs ¶
func (Select) ApplyToLVRemoveOptions ¶
func (opt Select) ApplyToLVRemoveOptions(opts *LVRemoveOptions)
func (Select) ApplyToLVsOptions ¶
func (opt Select) ApplyToLVsOptions(opts *LVsOptions)
func (Select) ApplyToPVsOptions ¶
func (opt Select) ApplyToPVsOptions(opts *PVsOptions)
func (Select) ApplyToVGRemoveOptions ¶
func (opt Select) ApplyToVGRemoveOptions(opts *VGRemoveOptions)
func (Select) ApplyToVGsOptions ¶
func (opt Select) ApplyToVGsOptions(opts *VGsOptions)
type SelectionComparisonOperator ¶
type SelectionComparisonOperator SelectionOperator
const ( MatchRegex SelectionComparisonOperator = "=~" NotMatchRegex SelectionComparisonOperator = "!~" Match SelectionComparisonOperator = "=" NotMatch SelectionComparisonOperator = "!=" GreaterOrEq SelectionComparisonOperator = ">=" Greater SelectionComparisonOperator = ">" LessOrEq SelectionComparisonOperator = "<=" Less SelectionComparisonOperator = "<" Since SelectionComparisonOperator = "since" After SelectionComparisonOperator = "after" Until SelectionComparisonOperator = "until" Before SelectionComparisonOperator = "before" )
type SelectionOperator ¶
type SelectionOperator string
type Shared ¶
type Shared bool
func (Shared) ApplyToArgs ¶
func (Shared) ApplyToVGCreateOptions ¶
func (opt Shared) ApplyToVGCreateOptions(opts *VGCreateOptions)
type Size ¶
Size is an InputToParse number that accepts an optional unit. InputToParse units are always treated as base two values, regardless of capitalization, e.g. 'k' and 'K' both refer to 1024. The default InputToParse unit is specified by letter, followed by |UNIT. UNIT represents other possible InputToParse units: b is bytes, s is sectors of 512 bytes, k is KiB, m is MiB, g is GiB, t is TiB, p is PiB, e is EiB.
func MustParseSize ¶
func ParseSizeLenient ¶
func (Size) ApplyToArgs ¶
func (Size) ApplyToLVCreateOptions ¶
func (opt Size) ApplyToLVCreateOptions(opts *LVCreateOptions)
func (Size) ApplyToLVResizeOptions ¶
func (opt Size) ApplyToLVResizeOptions(opts *LVResizeOptions)
func (Size) MarshalText ¶
func (Size) ToExtents ¶
func (opt Size) ToExtents(extentSize uint64, percent ExtentPercent) (Extents, error)
func (Size) ToPoolMetadata ¶
func (opt Size) ToPoolMetadata() PoolMetadataSize
func (Size) Virtual ¶
func (opt Size) Virtual() VirtualSize
type SizePrefix ¶
type SizePrefix rune
const ( SizePrefixNone SizePrefix = 0 SizePrefixMinus SizePrefix = '-' SizePrefixPlus SizePrefix = '+' )
type SkipActivation ¶
type SkipActivation rune
const ( SkipActivationTrue SkipActivation = 'k' SkipActivationFalse SkipActivation = '-' )
type State ¶
type State rune
const ( StateActive State = 'a' StateSuspended State = 's' StateInvalidSnapshot State = 'I' StateSuspendedSnapshot State = 'S' StateSnapshotMergeFailed State = 'm' StateSuspendedSnapshotMergeFailed State = 'M' StateMappedDevicePresentWithoutTables State = 'd' StateMappedDevicePresentWithInactiveTables State = 'i' StateNone State = '-' StateHistorical State = 'h' StateThinPoolCheckNeeded State = 'c' StateSuspendedThinPoolCheckNeeded State = 'C' StateUnknown State = 'X' )
type StripeSize ¶
type StripeSize Size
func (StripeSize) ApplyToArgs ¶
func (opt StripeSize) ApplyToArgs(args Arguments) error
func (StripeSize) ApplyToLVCreateOptions ¶
func (opt StripeSize) ApplyToLVCreateOptions(opts *LVCreateOptions)
type Stripes ¶
type Stripes int
func (Stripes) ApplyToArgs ¶
func (Stripes) ApplyToLVCreateOptions ¶
func (opt Stripes) ApplyToLVCreateOptions(opts *LVCreateOptions)
type SyncAction ¶
type SyncAction string
const ( SyncActionCheck SyncAction = "check" SyncActionRepair SyncAction = "repair" )
func (SyncAction) ApplyToArgs ¶
func (opt SyncAction) ApplyToArgs(args Arguments) error
func (SyncAction) ApplyToLVChangeOptions ¶
func (opt SyncAction) ApplyToLVChangeOptions(opts *LVChangeOptions)
type Tags ¶
type Tags []string
func (Tags) ApplyToArgs ¶
func (Tags) ApplyToLVChangeOptions ¶
func (opt Tags) ApplyToLVChangeOptions(opts *LVChangeOptions)
func (Tags) ApplyToLVCreateOptions ¶
func (opt Tags) ApplyToLVCreateOptions(opts *LVCreateOptions)
func (Tags) ApplyToLVRemoveOptions ¶
func (opt Tags) ApplyToLVRemoveOptions(opts *LVRemoveOptions)
func (Tags) ApplyToLVsOptions ¶
func (opt Tags) ApplyToLVsOptions(opts *LVsOptions)
func (Tags) ApplyToPVChangeOptions ¶
func (opt Tags) ApplyToPVChangeOptions(opts *PVChangeOptions)
func (Tags) ApplyToVGChangeOptions ¶
func (opt Tags) ApplyToVGChangeOptions(opts *VGChangeOptions)
func (Tags) ApplyToVGCreateOptions ¶
func (opt Tags) ApplyToVGCreateOptions(opts *VGCreateOptions)
func (Tags) ApplyToVGRemoveOptions ¶
func (opt Tags) ApplyToVGRemoveOptions(opts *VGRemoveOptions)
func (Tags) ApplyToVGsOptions ¶
func (opt Tags) ApplyToVGsOptions(opts *VGsOptions)
type TestingHandler ¶
type TestingHandler struct {
// contains filtered or unexported fields
}
type Thin ¶
type Thin bool
func (Thin) ApplyToArgs ¶
func (Thin) ApplyToLVCreateOptions ¶
func (opt Thin) ApplyToLVCreateOptions(opts *LVCreateOptions)
type ThinPool ¶
type ThinPool FQLogicalVolumeName
func MustNewThinPool ¶
func MustNewThinPool(vg VolumeGroupName, lv LogicalVolumeName) *ThinPool
func NewThinPool ¶
func NewThinPool(vg VolumeGroupName, lv LogicalVolumeName) (*ThinPool, error)
func (*ThinPool) ApplyToArgs ¶
func (*ThinPool) ApplyToLVCreateOptions ¶
func (opt *ThinPool) ApplyToLVCreateOptions(opts *LVCreateOptions)
func (*ThinPool) ApplyToLVRemoveOptions ¶
func (opt *ThinPool) ApplyToLVRemoveOptions(opts *LVRemoveOptions)
type Type ¶
type Type string
const ( TypeLinear Type = "linear" TypeStriped Type = "striped" TypeMirrored Type = "mirrored" TypeRAID0 Type = "raid0" TypeRAID1 Type = "raid1" TypeRAID4 Type = "raid4" TypeRAID5 Type = "raid5" TypeRAID6 Type = "raid6" TypeRAID10 Type = "raid10" TypeThin Type = "thin" TypeCache Type = "cache" TypeWriteCache Type = "writecache" TypePool Type = "cache-pool" TypeThinPool Type = "thin-pool" TypeVDO Type = "vdo" TypeVDOPool Type = "vdo-pool" )
func (Type) ApplyToArgs ¶
func (Type) ApplyToLVCreateOptions ¶
func (opt Type) ApplyToLVCreateOptions(opts *LVCreateOptions)
type Unit ¶
type Unit rune
const ( UnitBytes Unit = 'b' UnitKiB Unit = 'k' UnitMiB Unit = 'm' UnitGiB Unit = 'g' UnitTiB Unit = 't' UnitPiB Unit = 'p' UnitEiB Unit = 'e' UnitSector Unit = 's' // UnitUnknown is used to represent the output unit when // LVs or VGs are queried without specifying a unit. (--nosuffix) UnitUnknown Unit = 0 )
func (Unit) ApplyToArgs ¶
func (Unit) ApplyToLVsOptions ¶
func (unit Unit) ApplyToLVsOptions(opts *LVsOptions)
func (Unit) ApplyToPVsOptions ¶
func (unit Unit) ApplyToPVsOptions(opts *PVsOptions)
func (Unit) ApplyToVGsOptions ¶
func (unit Unit) ApplyToVGsOptions(opts *VGsOptions)
func (Unit) MarshalText ¶
type VGAllocationPolicyAttr ¶
type VGAllocationPolicyAttr rune
const ( VGAllocationPolicyAttrAnywhere VGAllocationPolicyAttr = 'a' VGAllocationPolicyAttrContiguous VGAllocationPolicyAttr = 'c' VGAllocationPolicyAttrCling VGAllocationPolicyAttr = 'l' VGAllocationPolicyAttrNormal VGAllocationPolicyAttr = 'n' VGAllocationPolicyAttrNone VGAllocationPolicyAttr = '-' )
type VGAttributes ¶
type VGAttributes struct { VGPermissions Resizeable Exported PartialAttr VGAllocationPolicyAttr }
func ParseVGAttributes ¶
func ParseVGAttributes(raw string) (VGAttributes, error)
func (VGAttributes) MarshalText ¶
func (attr VGAttributes) MarshalText() ([]byte, error)
func (VGAttributes) String ¶
func (attr VGAttributes) String() string
type VGChangeOption ¶
type VGChangeOption interface {
ApplyToVGChangeOptions(opts *VGChangeOptions)
}
type VGChangeOptions ¶
type VGChangeOptions struct { VolumeGroupName MaximumLogicalVolumes MaximumPhysicalVolumes AllocationPolicy AutoActivation Tags DelTags CommonOptions }
func (*VGChangeOptions) ApplyToArgs ¶
func (opts *VGChangeOptions) ApplyToArgs(args Arguments) error
func (*VGChangeOptions) ApplyToVGChangeOptions ¶
func (opts *VGChangeOptions) ApplyToVGChangeOptions(new *VGChangeOptions)
type VGChangeOptionsList ¶
type VGChangeOptionsList []VGChangeOption
func (VGChangeOptionsList) AsArgs ¶
func (list VGChangeOptionsList) AsArgs() (Arguments, error)
type VGCreateOption ¶
type VGCreateOption interface {
ApplyToVGCreateOptions(opts *VGCreateOptions)
}
type VGCreateOptionList ¶
type VGCreateOptionList []VGCreateOption
func (VGCreateOptionList) AsArgs ¶
func (list VGCreateOptionList) AsArgs() (Arguments, error)
type VGCreateOptions ¶
type VGCreateOptions struct { VolumeGroupName Tags PhysicalVolumeNames MaximumLogicalVolumes MaximumPhysicalVolumes AutoActivation Force Zero PhysicalExtentSize DataAlignment DataAlignmentOffset MetadataSize AllocationPolicy CommonOptions }
func (*VGCreateOptions) ApplyToArgs ¶
func (opts *VGCreateOptions) ApplyToArgs(args Arguments) error
func (*VGCreateOptions) ApplyToVGCreateOptions ¶
func (opts *VGCreateOptions) ApplyToVGCreateOptions(new *VGCreateOptions)
type VGExtendOption ¶
type VGExtendOption interface {
ApplyToVGExtendOptions(opts *VGExtendOptions)
}
type VGExtendOptions ¶
type VGExtendOptions struct { VolumeGroupName PhysicalVolumeNames Force Zero CommonOptions }
func (*VGExtendOptions) ApplyToArgs ¶
func (opts *VGExtendOptions) ApplyToArgs(args Arguments) error
func (*VGExtendOptions) ApplyToVGExtendOptions ¶
func (opts *VGExtendOptions) ApplyToVGExtendOptions(new *VGExtendOptions)
type VGExtendOptionsList ¶
type VGExtendOptionsList []VGExtendOption
func (VGExtendOptionsList) AsArgs ¶
func (list VGExtendOptionsList) AsArgs() (Arguments, error)
type VGPermissions ¶
type VGPermissions rune
const ( VGPermissionsWriteable VGPermissions = 'w' VGPermissionsReadOnly VGPermissions = 'r' VGPermissionsNone VGPermissions = '-' )
type VGReduceOption ¶
type VGReduceOption interface {
ApplyToVGReduceOptions(opts *VGReduceOptions)
}
type VGReduceOptions ¶
type VGReduceOptions struct { VolumeGroupName PhysicalVolumeNames RemoveMissing Force CommonOptions }
func (*VGReduceOptions) ApplyToArgs ¶
func (opts *VGReduceOptions) ApplyToArgs(args Arguments) error
func (*VGReduceOptions) ApplyToVGReduceOptions ¶
func (opts *VGReduceOptions) ApplyToVGReduceOptions(new *VGReduceOptions)
type VGReduceOptionsList ¶
type VGReduceOptionsList []VGReduceOption
func (VGReduceOptionsList) AsArgs ¶
func (list VGReduceOptionsList) AsArgs() (Arguments, error)
type VGRemoveOption ¶
type VGRemoveOption interface {
ApplyToVGRemoveOptions(opts *VGRemoveOptions)
}
type VGRemoveOptions ¶
type VGRemoveOptions struct { VolumeGroupName Tags Select Force CommonOptions }
func (*VGRemoveOptions) ApplyToArgs ¶
func (opts *VGRemoveOptions) ApplyToArgs(args Arguments) error
func (*VGRemoveOptions) ApplyToVGRemoveOptions ¶
func (opts *VGRemoveOptions) ApplyToVGRemoveOptions(new *VGRemoveOptions)
type VGRemoveOptionsList ¶
type VGRemoveOptionsList []VGRemoveOption
func (VGRemoveOptionsList) AsArgs ¶
func (list VGRemoveOptionsList) AsArgs() (Arguments, error)
type VGRenameOption ¶
type VGRenameOption interface {
ApplyToVGRenameOptions(opts *VGRenameOptions)
}
type VGRenameOptions ¶
type VGRenameOptions struct { Old VolumeGroupName New VolumeGroupName Force CommonOptions }
func (*VGRenameOptions) ApplyToArgs ¶
func (opts *VGRenameOptions) ApplyToArgs(args Arguments) error
func (*VGRenameOptions) ApplyToVGRenameOptions ¶
func (opts *VGRenameOptions) ApplyToVGRenameOptions(new *VGRenameOptions)
func (*VGRenameOptions) SetOldOrNew ¶
func (opts *VGRenameOptions) SetOldOrNew(name VolumeGroupName)
type VGRenameOptionsList ¶
type VGRenameOptionsList []VGRenameOption
func (VGRenameOptionsList) AsArgs ¶
func (list VGRenameOptionsList) AsArgs() (Arguments, error)
type VGsOption ¶
type VGsOption interface {
ApplyToVGsOptions(opts *VGsOptions)
}
type VGsOptions ¶
type VGsOptions struct { VolumeGroupName Tags Unit Select ColumnOptions CommonOptions }
func (*VGsOptions) ApplyToArgs ¶
func (opts *VGsOptions) ApplyToArgs(args Arguments) error
func (*VGsOptions) ApplyToVGsOptions ¶
func (opts *VGsOptions) ApplyToVGsOptions(new *VGsOptions)
type VGsOptionsList ¶
type VGsOptionsList []VGsOption
func (VGsOptionsList) AsArgs ¶
func (list VGsOptionsList) AsArgs() (Arguments, error)
type VersionOption ¶
type VersionOption interface {
ApplyToVersionOptions(opts *VersionOptions)
}
type VersionOptions ¶
type VersionOptions struct{}
func (*VersionOptions) ApplyToArgs ¶
func (opts *VersionOptions) ApplyToArgs(Arguments) error
func (*VersionOptions) ApplyToVersionOptions ¶
func (opts *VersionOptions) ApplyToVersionOptions(new *VersionOptions)
type VersionOptionsList ¶
type VersionOptionsList []VersionOption
func (VersionOptionsList) AsArgs ¶
func (list VersionOptionsList) AsArgs() (Arguments, error)
type VirtualPrefixedSize ¶
type VirtualPrefixedSize PrefixedSize
func (VirtualPrefixedSize) ApplyToArgs ¶
func (opt VirtualPrefixedSize) ApplyToArgs(args Arguments) error
type VirtualSize ¶
type VirtualSize Size
func (VirtualSize) ApplyToArgs ¶
func (opt VirtualSize) ApplyToArgs(args Arguments) error
func (VirtualSize) ApplyToLVCreateOptions ¶
func (opt VirtualSize) ApplyToLVCreateOptions(opts *LVCreateOptions)
type VolumeGroup ¶
type VolumeGroup struct { UUID string `json:"vg_uuid"` Name VolumeGroupName `json:"vg_name"` SysID string `json:"vg_sysid"` LockType string `json:"vg_lock_type"` LockArgs string `json:"vg_lock_args"` Attr VGAttributes `json:"vg_attr"` Tags Tags `json:"vg_tags"` AutoActivation AutoActivationFromReport `json:"vg_autoactivation"` Extendable Extendable `json:"vg_extendable"` Permissions string `json:"vg_permissions"` AllocationPolicy AllocationPolicy `json:"vg_allocation_policy"` ExtentSize Size `json:"vg_extent_size"` ExtentCount int64 `json:"vg_extent_count"` SeqNo int64 `json:"vg_seqno"` Size Size `json:"vg_size"` Free Size `json:"vg_free"` FreeCount int64 `json:"vg_free_count"` PvCount int64 `json:"pv_count"` MissingPVCount int64 `json:"vg_missing_pv_count"` MaxPv int64 `json:"max_pv"` LvCount int64 `json:"lv_count"` MaxLv int64 `json:"max_lv"` SnapCount int64 `json:"snap_count"` MDACount int64 `json:"vg_mda_count"` MDAUsedCount int64 `json:"vg_mda_used_count"` MDAFree Size `json:"vg_mda_free"` MDASize Size `json:"vg_mda_size"` }
func (*VolumeGroup) UnmarshalJSON ¶
func (vg *VolumeGroup) UnmarshalJSON(data []byte) error
type VolumeGroupClient ¶
type VolumeGroupClient interface { // VG returns a volume group that matches the given options. // // If no VolumeGroupName is defined, ErrVolumeGroupNameRequired is returned. // If no volume group is found, ErrVolumeGroupNotFound is returned. // // It is equivalent to calling VGs with the same options and returning the first volume group in the list. // see VGs for more information. VG(ctx context.Context, opts ...VGsOption) (*VolumeGroup, error) // VGs return a list of volume groups that match the given options. // // If no volume groups are found, an empty slice is returned. // If options limit the number of volume groups returned, // the slice may be shorter than the total number of volume groups. // // See man lvm vgs for more information. VGs(ctx context.Context, opts ...VGsOption) ([]*VolumeGroup, error) // VGCreate creates a new volume group with the given options. // // See man lvm vgcreate for more information. VGCreate(ctx context.Context, opts ...VGCreateOption) error // VGRemove removes a volume group with the given options. // // See man lvm vgremove for more information. VGRemove(ctx context.Context, opts ...VGRemoveOption) error // VGExtend extends a volume group with the given options. // // See man lvm vgextend for more information. VGExtend(ctx context.Context, opts ...VGExtendOption) error // VGReduce reduces a volume group with the given options. // // See man lvm vgreduce for more information. VGReduce(ctx context.Context, opts ...VGReduceOption) error // VGRename renames a volume group with the given options. // // See man lvm vgrename for more information. VGRename(ctx context.Context, opts ...VGRenameOption) error // VGChange changes a volume group with the given options. // // See man lvm vgchange for more information. VGChange(ctx context.Context, opts ...VGChangeOption) error }
VolumeGroupClient is a client that provides operations on lvm2 volume groups.
type VolumeGroupName ¶
type VolumeGroupName string
func (VolumeGroupName) ApplyToArgs ¶
func (opt VolumeGroupName) ApplyToArgs(args Arguments) error
func (VolumeGroupName) ApplyToLVChangeOptions ¶
func (opt VolumeGroupName) ApplyToLVChangeOptions(opts *LVChangeOptions)
func (VolumeGroupName) ApplyToLVCreateOptions ¶
func (opt VolumeGroupName) ApplyToLVCreateOptions(opts *LVCreateOptions)
func (VolumeGroupName) ApplyToLVExtendOptions ¶
func (opt VolumeGroupName) ApplyToLVExtendOptions(opts *LVExtendOptions)
func (VolumeGroupName) ApplyToLVReduceOptions ¶
func (opt VolumeGroupName) ApplyToLVReduceOptions(opts *LVReduceOptions)
func (VolumeGroupName) ApplyToLVRemoveOptions ¶
func (opt VolumeGroupName) ApplyToLVRemoveOptions(opts *LVRemoveOptions)
func (VolumeGroupName) ApplyToLVRenameOptions ¶
func (opt VolumeGroupName) ApplyToLVRenameOptions(opts *LVRenameOptions)
func (VolumeGroupName) ApplyToLVResizeOptions ¶
func (opt VolumeGroupName) ApplyToLVResizeOptions(opts *LVResizeOptions)
func (VolumeGroupName) ApplyToLVsOptions ¶
func (opt VolumeGroupName) ApplyToLVsOptions(opts *LVsOptions)
func (VolumeGroupName) ApplyToPVsOptions ¶
func (opt VolumeGroupName) ApplyToPVsOptions(opts *PVsOptions)
func (VolumeGroupName) ApplyToVGChangeOptions ¶
func (opt VolumeGroupName) ApplyToVGChangeOptions(opts *VGChangeOptions)
func (VolumeGroupName) ApplyToVGCreateOptions ¶
func (opt VolumeGroupName) ApplyToVGCreateOptions(opts *VGCreateOptions)
func (VolumeGroupName) ApplyToVGExtendOptions ¶
func (opt VolumeGroupName) ApplyToVGExtendOptions(opts *VGExtendOptions)
func (VolumeGroupName) ApplyToVGReduceOptions ¶
func (opt VolumeGroupName) ApplyToVGReduceOptions(opts *VGReduceOptions)
func (VolumeGroupName) ApplyToVGRemoveOptions ¶
func (opt VolumeGroupName) ApplyToVGRemoveOptions(opts *VGRemoveOptions)
func (VolumeGroupName) ApplyToVGRenameOptions ¶
func (opt VolumeGroupName) ApplyToVGRenameOptions(opts *VGRenameOptions)
func (VolumeGroupName) ApplyToVGsOptions ¶
func (opt VolumeGroupName) ApplyToVGsOptions(opts *VGsOptions)
type VolumeHealth ¶
type VolumeHealth rune
type VolumeType ¶
type VolumeType rune
const ( VolumeTypeMirrored VolumeType = 'm' VolumeTypeMirroredNoInitialSync VolumeType = 'M' VolumeTypeOrigin VolumeType = 'o' VolumeTypeOriginWithMergingSnapshot VolumeType = 'O' VolumeTypeRAID VolumeType = 'r' VolumeTypeRAIDNoInitialSync VolumeType = 'R' VolumeTypeSnapshot VolumeType = 's' VolumeTypeMergingSnapshot VolumeType = 'S' VolumeTypePVMove VolumeType = 'p' VolumeTypeVirtual VolumeType = 'v' VolumeTypeMirrorOrRAIDImage VolumeType = 'i' VolumeTypeMirrorOrRAIDImageOutOfSync VolumeType = 'I' VolumeTypeMirrorLogDevice VolumeType = 'l' VolumeTypeUnderConversion VolumeType = 'c' VolumeTypeThinVolume VolumeType = 'V' VolumeTypeThinPool VolumeType = 't' VolumeTypeThinPoolData VolumeType = 'T' VolumeTypeThinPoolMetadata VolumeType = 'e' VolumeTypeNone VolumeType = '-' )
type WipeSignatures ¶
type WipeSignatures bool
func (WipeSignatures) ApplyToArgs ¶
func (opt WipeSignatures) ApplyToArgs(args Arguments) error
type Zero ¶
type Zero string
func (Zero) ApplyToArgs ¶
func (Zero) ApplyToLVCreateOptions ¶
func (opt Zero) ApplyToLVCreateOptions(opts *LVCreateOptions)
Source Files ¶
- activate.go
- activation_mode.go
- allocation_policy.go
- args.go
- auto_activation.go
- autoactivation.go
- build_id.go
- client.go
- column_options.go
- command.go
- common_options.go
- compression.go
- config.go
- config_type.go
- deduplication.go
- devices.go
- discards.go
- doc.go
- error_when_full.go
- exit_code_error.go
- extendable.go
- extents.go
- force.go
- json_convert_helper.go
- locking_client.go
- logical_volume.go
- losetup.go
- lv_attr.go
- lvchange.go
- lvcreate.go
- lvextend.go
- lvm_error.go
- lvmdevices.go
- lvmdevices_check.go
- lvmdevices_modify.go
- lvmdevices_refresh.go
- lvmdevices_update.go
- lvreduce.go
- lvremove.go
- lvrename.go
- lvresize.go
- lvs.go
- maximum_logical_volumes.go
- maximum_physical_volumes.go
- mirrors.go
- partial.go
- path.go
- permission.go
- physical_extent_size.go
- physical_volume.go
- profile.go
- pv_attr.go
- pvchange.go
- pvcreate.go
- pvmove.go
- pvremove.go
- pvresize.go
- pvs.go
- rebuild.go
- reflect.go
- remove_missing.go
- resync.go
- run_lvm.go
- select.go
- shared.go
- size.go
- slog_handler.go
- stderr.go
- streamed_command.go
- stripe_size.go
- stripes.go
- sync_action.go
- system_dir.go
- tags.go
- thin.go
- version.go
- vg_attr.go
- vgchange.go
- vgcreate.go
- vgextend.go
- vgreduce.go
- vgremove.go
- vgrename.go
- vgs.go
- volume_group.go
- volume_type.go
- wipe_signatures.go
- zero.go