volumemanager

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VolumeParameterDiskTypeKey     = "diskType"
	VolumeParameterMinCapacityKey  = "minCap"
	VolumeParameterPVCNameKey      = "csi.storage.k8s.io/pvc/name"
	VolumeParameterPVCNameSpaceKey = "csi.storage.k8s.io/pvc/namespace"
	VolumeSelectedNodeKey          = "volume.kubernetes.io/selected-node"
)

consts

View Source
const (
	TopologyNodeKey = "topology.disk.hwameistor.io/node"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DiskType

type DiskType = string
const (
	HDD  DiskType = "HDD"
	SSD  DiskType = "SSD"
	NVMe DiskType = "NVME"
)

type LocalDiskVolumeManager

type LocalDiskVolumeManager struct {
	// SupportVolumeCapacities
	SupportVolumeCapacities []*csi.VolumeCapability

	// GetClient for query LocalDiskVolume resources from k8s
	GetClient func() (*localdiskvolume.Kubeclient, error)

	// volume
	// The handler cannot be placed here directly as an object because thread safety cannot be guaranteed
	GetVolumeHandler func() (*volumectr.DiskVolumeHandler, error)
	// contains filtered or unexported fields
}

LocalDiskVolumeManager manage the allocation, deletion and query of local disk data volumes. Internally, the reasonable allocation of data volumes will be realized by tuning the LocalDiskNode resources

func NewLocalDiskVolumeManager

func NewLocalDiskVolumeManager() *LocalDiskVolumeManager

NewLocalDiskVolumeManager

func (*LocalDiskVolumeManager) CreateVolume

func (vm *LocalDiskVolumeManager) CreateVolume(name string, parameters interface{}) (*Volume, error)

func (*LocalDiskVolumeManager) DeleteVolume

func (vm *LocalDiskVolumeManager) DeleteVolume(ctx context.Context, name string) error

func (*LocalDiskVolumeManager) GetVolumeCapacities

func (vm *LocalDiskVolumeManager) GetVolumeCapacities() interface{}

func (*LocalDiskVolumeManager) GetVolumeInfo

func (vm *LocalDiskVolumeManager) GetVolumeInfo(name string) (*Volume, error)

func (*LocalDiskVolumeManager) NodePublishVolume

func (vm *LocalDiskVolumeManager) NodePublishVolume(ctx context.Context, volumeReq interface{}) error

func (*LocalDiskVolumeManager) NodeUnpublishVolume

func (vm *LocalDiskVolumeManager) NodeUnpublishVolume(ctx context.Context,
	name, targetPath string) error

func (*LocalDiskVolumeManager) ParseVolumeRequest

func (vm *LocalDiskVolumeManager) ParseVolumeRequest(parameters interface{}) (*VolumeRequest, error)

ParseVolumeRequest ParseParams

func (*LocalDiskVolumeManager) UpdateVolume

func (vm *LocalDiskVolumeManager) UpdateVolume(name string, parameters interface{}) (*Volume, error)

func (*LocalDiskVolumeManager) VolumeIsExist

func (vm *LocalDiskVolumeManager) VolumeIsExist(name string) (bool, error)

func (*LocalDiskVolumeManager) VolumeIsReady

func (vm *LocalDiskVolumeManager) VolumeIsReady(name string) (bool, error)

type Volume

type Volume struct {
	// Name
	Name string `json:"name"`

	// Ready
	Ready bool `json:"ready"`

	// Exist
	Exist bool `json:"exist"`

	// Capacity
	Capacity int64 `json:"capacity"`

	// VolumeContext
	VolumeContext map[string]string

	// AttachNode
	AttachNode string `json:"attachNode"`
}

Volume

type VolumeManager

type VolumeManager interface {
	// CreateVolume when volume is not exist
	CreateVolume(name string, volumeRequest interface{}) (*Volume, error)

	// UpdateVolume
	UpdateVolume(name string, volumeRequest interface{}) (*Volume, error)

	// NodePublishVolume
	NodePublishVolume(ctx context.Context, volumeRequest interface{}) error

	// NodeUnpublishVolume
	NodeUnpublishVolume(ctx context.Context, name, targetPath string) error

	// DeleteVolume
	DeleteVolume(ctx context.Context, name string) error

	// GetVolumeInfo
	GetVolumeInfo(name string) (*Volume, error)

	// GetVolumeCapacities
	GetVolumeCapacities() interface{}

	// VolumeIsReady
	VolumeIsReady(name string) (bool, error)

	// VolumeIsExist
	VolumeIsExist(name string) (bool, error)
}

type VolumeRequest

type VolumeRequest struct {
	// RequireCapacity
	RequireCapacity int64 `json:"capacity"`

	// VolumeContext
	VolumeContext map[string]string `json:"volumeContext"`

	// DiskType represents which disk type is this volume provisioned from
	DiskType DiskType `json:"diskType"`

	// DevPath
	DevPath string `json:"devPath"`

	// PVCName
	PVCName string `json:"pvcName"`

	// PVCNameSpace
	PVCNameSpace string `json:"pvcNameSpace"`

	// OwnerNodeName represents where this disk volume located
	OwnerNodeName string `json:"ownerNodeName"`

	// VolumeCap
	VolumeCap *csi.VolumeCapability

	// VolumeContentSource
	// this field may be needed for volume clone from another disk volume
	// for now, we don't support this
	VolumeContentSource *csi.VolumeContentSource `json:"volumeContentSource"`
}

VolumeRequest

func NewVolumeRequest

func NewVolumeRequest() *VolumeRequest

func (*VolumeRequest) SetDiskType

func (r *VolumeRequest) SetDiskType(diskType string)

func (*VolumeRequest) SetNodeName

func (r *VolumeRequest) SetNodeName(nodeName string)

func (*VolumeRequest) SetPVCName

func (r *VolumeRequest) SetPVCName(pvc string)

func (*VolumeRequest) SetPVCNameSpace

func (r *VolumeRequest) SetPVCNameSpace(ns string)

func (*VolumeRequest) SetRequireCapacity

func (r *VolumeRequest) SetRequireCapacity(cap int64)

func (*VolumeRequest) Valid

func (r *VolumeRequest) Valid() error

Jump to

Keyboard shortcuts

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