pmdmanager

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2021 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const (
	FakeDevicePathPrefix = "/dev/pmem-csi-fake"
)
View Source
const (
	GB uint64 = 1024 * 1024 * 1024
)
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

This section is empty.

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() (Capacity, error)

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() (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
	// Possible errors: ErrNotEnoughSpace, ErrDeviceExists
	CreateDevice(name string, size uint64) error

	// GetDevice returns the block device information for given name
	// Possible errors: ErrDeviceNotFound
	GetDevice(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(name string, flush bool) error

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

PmemDeviceManager interface to manage the PMEM block devices

func New added in v0.9.0

func New(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