pmdmanager

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2022 License: Apache-2.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ConvertRawNamespacesLabel = "convert-raw-namespaces"
	ConvertRawNamespacesValye = "force"
)
View Source
const (
	FakeDevicePathPrefix = "/dev/pmem-csi-fake"
)
View Source
const NodeLabel = "node"

NodeLabel is a label used for Prometheus which identifies the node that the controller talks to.

Variables

This section is empty.

Functions

func ForceConvertRawNamespaces added in v1.0.0

func ForceConvertRawNamespaces(ctx context.Context, client kubernetes.Interface, driverName string, nodeSelector types.NodeSelector, nodeName string) (finalErr error)

ForceConvertRawNamespaces iterates over all raw namespaces, force-converts them to fsdax + LVM volume group, then modifies the node labels such that the normal driver runs instead of this special one-time operation.

Types

type Capacity added in v0.8.0

type Capacity struct {
	// MaxVolumeSize is the size of the largest volume that
	// currently can be created, considering alignment and
	// fragmentation.
	MaxVolumeSize uint64
	// Available is the sum of all PMEM that could be used for
	// volumes.
	Available uint64
	// Managed is all PMEM that is managed by the driver.
	Managed uint64
	// Total is all PMEM found by the driver.
	Total uint64
}

Capacity contains information about PMEM. All sizes count bytes.

func (Capacity) GetCapacity added in v0.9.0

func (c Capacity) GetCapacity(ctx context.Context) (Capacity, error)

func (Capacity) String added in v1.0.0

func (c Capacity) String() string

type CapacityCollector added in v0.9.0

type CapacityCollector struct {
	PmemDeviceCapacity
}

CapacityCollector is a wrapper around a PMEM device manager which takes GetCapacity values and turns them into metrics data.

func (CapacityCollector) Collect added in v0.9.0

func (cc CapacityCollector) Collect(ch chan<- prometheus.Metric)

Collect implements prometheus.Collector.Collect.

func (CapacityCollector) Describe added in v0.9.0

func (cc CapacityCollector) Describe(ch chan<- *prometheus.Desc)

Describe implements prometheus.Collector.Describe.

func (CapacityCollector) MustRegister added in v0.9.0

func (cc CapacityCollector) MustRegister(reg prometheus.Registerer, nodeName, driverName string)

MustRegister adds the collector to the registry, using labels to tag each sample with node and driver name.

type PmemDeviceCapacity added in v0.9.0

type PmemDeviceCapacity interface {
	// GetCapacity returns information about local capacity.
	GetCapacity(ctx context.Context) (Capacity, error)
}

PmemDeviceCapacity interface just returns capacity information.

type PmemDeviceInfo

type PmemDeviceInfo struct {
	// VolumeId is a unique identifier created by PMEM-CSI for the volume.
	// It is returned by CreateDevice and passed into NodeStageVolume
	// and NodePublishVolume.
	VolumeId string

	// Path is the actual device path (for example, /dev/pmem0.1).
	// As a special case, if the path starts with FakeDevicePathPrefix,
	// then the volume doesn't have a backing store.
	Path string

	// Size allocated for block device in bytes.
	Size uint64
}

PmemDeviceInfo represents a volume created by PMEM-CSI.

type PmemDeviceManager

type PmemDeviceManager interface {
	PmemDeviceCapacity

	// GetName returns current device manager's operation mode
	GetMode() api.DeviceMode

	// CreateDevice creates a new block device with give name, size and namespace mode.
	// It returns the actual volume size which will always be at least as large as requested.
	// Possible errors: ErrNotEnoughSpace, ErrDeviceExists
	CreateDevice(ctx context.Context, name string, size uint64, usage parameters.Usage) (uint64, error)

	// GetDevice returns the block device information for given name
	// Possible errors: ErrDeviceNotFound
	GetDevice(ctx context.Context, name string) (*PmemDeviceInfo, error)

	// DeleteDevice deletes an existing block device with give name.
	// If 'flush' is 'true', then the device data is zeroed before deleting the device
	// Possible errors: ErrDeviceInUse
	DeleteDevice(ctx context.Context, name string, flush bool) error

	// ListDevices returns all the block devices information that was created by this device manager
	ListDevices(ctx context.Context) ([]*PmemDeviceInfo, error)
}

PmemDeviceManager interface to manage the PMEM block devices

func New added in v0.9.0

func New(ctx context.Context, mode api.DeviceMode, pmemPercentage uint) (PmemDeviceManager, error)

New creates a new device manager for the given mode and percentage.

Jump to

Keyboard shortcuts

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