lvmd

package
v0.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeThin  = DeviceType("thin")
	TypeThick = DeviceType("thick")
)

Variables

View Source
var ErrNotFound = errors.New("device-class not found")

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

Functions

func NewEmbeddedServiceClients added in v0.23.0

func NewEmbeddedServiceClients(ctx context.Context, dcmapper *DeviceClassManager, ocmapper *LvcreateOptionClassManager) (
	proto.LVServiceClient,
	proto.VGServiceClient,
)

NewEmbeddedServiceClients creates clients locally calling instead of using gRPC.

func NewHealthService added in v0.16.0

func NewHealthService() grpc_health_v1.HealthServer

func NewLVService

func NewLVService(dcmapper *DeviceClassManager, ocmapper *LvcreateOptionClassManager, notifyFunc func()) proto.LVServiceServer

NewLVService creates a new LVServiceServer

func NewVGService

func NewVGService(manager *DeviceClassManager) (proto.VGServiceServer, func())

NewVGService creates a VGServiceServer

func ValidateDeviceClasses

func ValidateDeviceClasses(deviceClasses []*DeviceClass) error

ValidateDeviceClasses validates device-classes

Types

type DeviceClass

type DeviceClass struct {
	// Name for the device-class name
	Name string `json:"name"`
	// Volume group name for the device-class
	VolumeGroup string `json:"volume-group"`
	// Default is a flag to indicate whether the device-class is the default
	Default bool `json:"default"`
	// SpareGB is storage capacity in GiB to be spared
	SpareGB *uint64 `json:"spare-gb"`
	// Stripe is the number of stripes in the logical volume
	Stripe *uint `json:"stripe"`
	// StripeSize is the amount of data that is written to one device before moving to the next device
	StripeSize string `json:"stripe-size"`
	// LVCreateOptions are extra arguments to pass to lvcreate
	LVCreateOptions []string `json:"lvcreate-options"`
	// Type is the name of logical volume target, supports 'thick' (default) or 'thin' currently
	Type DeviceType `json:"type"`
	// ThinPoolConfig holds the configuration for thinpool in this volume group corresponding to the device-class
	ThinPoolConfig *ThinPoolConfig `json:"thin-pool"`
}

DeviceClass maps between device-classes and target for logical volume creation current targets are VolumeGroup for thick-lv and ThinPool for thin-lv

func (DeviceClass) GetSpare

func (c DeviceClass) GetSpare() uint64

GetSpare returns spare in bytes for the device-class

type DeviceClassManager

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

DeviceClassManager maps between device-classes and volume groups.

func NewDeviceClassManager

func NewDeviceClassManager(deviceClasses []*DeviceClass) *DeviceClassManager

NewDeviceClassManager creates a new DeviceClassManager

func (DeviceClassManager) DeviceClass

func (m DeviceClassManager) DeviceClass(dcName string) (*DeviceClass, error)

DeviceClass returns the device-class by its name

func (DeviceClassManager) FindDeviceClassByThinPoolName added in v0.11.1

func (m DeviceClassManager) FindDeviceClassByThinPoolName(vgName string, poolName string) (*DeviceClass, error)

FindDeviceClassByThinPoolName returns the device-class with volume group and pool combination

func (DeviceClassManager) FindDeviceClassByVGName

func (m DeviceClassManager) FindDeviceClassByVGName(vgName string) (*DeviceClass, error)

FindDeviceClassByVGName returns the device-class with the volume group name

type DeviceType added in v0.11.0

type DeviceType string

type LvcreateOptionClass added in v0.18.0

type LvcreateOptionClass struct {
	// Name for the lvcreate-option-class name
	Name string `json:"name"`
	// Options are extra arguments to pass to lvcreate
	Options []string `json:"options"`
}

type LvcreateOptionClassManager added in v0.18.0

type LvcreateOptionClassManager struct {
	LvcreateOptionClassByName map[string]*LvcreateOptionClass
}

func NewLvcreateOptionClassManager added in v0.18.0

func NewLvcreateOptionClassManager(LvcreateOptionClasses []*LvcreateOptionClass) *LvcreateOptionClassManager

NewLvcreateOptionClassManager creates a new LvcreateOptionClassManager

func (LvcreateOptionClassManager) LvcreateOptionClass added in v0.18.0

func (m LvcreateOptionClassManager) LvcreateOptionClass(name string) *LvcreateOptionClass

LvcreateOptionClassClass returns the lvcreate-option-class by its name

type ThinPoolConfig added in v0.11.0

type ThinPoolConfig struct {
	// Name of thinpool
	Name string `json:"name"`
	// OverprovisionRatio signifies the upper bound multiplier for allowing logical volume creation in this pool
	OverprovisionRatio float64 `json:"overprovision-ratio"`
}

ThinPoolConfig holds the configuration of thin pool in a volume group

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL