Documentation
¶
Index ¶
- Constants
- Variables
- func NewEmbeddedServiceClients(ctx context.Context, dcmapper *DeviceClassManager, ...) (proto.LVServiceClient, proto.VGServiceClient)
- func NewHealthService() grpc_health_v1.HealthServer
- func NewLVService(dcmapper *DeviceClassManager, ocmapper *LvcreateOptionClassManager, ...) proto.LVServiceServer
- func NewVGService(manager *DeviceClassManager) (proto.VGServiceServer, func())
- func ValidateDeviceClasses(deviceClasses []*DeviceClass) error
- type DeviceClass
- type DeviceClassManager
- type DeviceType
- type LvcreateOptionClass
- type LvcreateOptionClassManager
- type ThinPoolConfig
Constants ¶
const ( TypeThin = DeviceType("thin") TypeThick = DeviceType("thick") )
Variables ¶
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 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