Documentation ¶
Index ¶
- Constants
- type Disk
- type DiskManager
- type DiskStatus
- type LocalDiskNodesManager
- func (ldn *LocalDiskNodesManager) ClaimDisk(name string) error
- func (ldn *LocalDiskNodesManager) FilterFreeDisks(reqDisks []Disk) (bool, error)
- func (ldn *LocalDiskNodesManager) GetClusterDisks() (map[string][]*Disk, error)
- func (ldn *LocalDiskNodesManager) GetNodeDisks(node string) ([]*Disk, error)
- func (ldn *LocalDiskNodesManager) GetReservedDiskByPVC(pvc string) (*Disk, error)
- func (ldn *LocalDiskNodesManager) ReleaseDisk(disk string) error
- func (ldn *LocalDiskNodesManager) ReserveDiskForVolume(reqDisk Disk, volume string) error
- func (ldn *LocalDiskNodesManager) UnReserveDiskForPVC(pvc string) error
Constants ¶
View Source
const (
ReservedPVCKey = "disk.hwameistor.io/pvc"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Disk ¶
type Disk struct { // AttachNode represent where disk is attached AttachNode string `json:"attachNode,omitempty"` // Name unique identification for a disk Name string `json:"name,omitempty"` // DevPath DevPath string `json:"devPath,omitempty"` // Capacity Capacity int64 `json:"capacity,omitempty"` // DiskType SSD/HDD/NVME... DiskType string `json:"diskType,omitempty"` // Status Status DiskStatus `json:"status,omitempty"` }
Disk all disk info about a disk
type DiskManager ¶
type DiskManager interface { // GetClusterDisks list all disks by node GetClusterDisks() (map[string][]*Disk, error) // GetNodeDisks list all disk located on the node GetNodeDisks(node string) ([]*Disk, error) // ClaimDisk UpdateDiskStatus mark disk to TobeMount/Free/InUse... status ClaimDisk(name string) error // FilterFreeDisks filter matchable free disks FilterFreeDisks([]Disk) (bool, error) // ReserveDiskForVolume reserve a disk for the volume ReserveDiskForVolume(disk Disk, volume string) error // UnReserveDiskForPVC update related disk to release status UnReserveDiskForPVC(pvc string) error // ReleaseDisk setup disk to release status ReleaseDisk(disk string) error // GetReservedDiskByPVC get disk reserved by the volume GetReservedDiskByPVC(pvc string) (*Disk, error) }
DiskManager manage all disks in cluster The operation here needs to ensure thread safety
type DiskStatus ¶
type DiskStatus = string
const ( DiskStatusInUse DiskStatus = "InUse" DiskStatusFree DiskStatus = "Free" DiskStatusReserved DiskStatus = "Reserved" DiskStatusUnclaimed DiskStatus = "Unclaimed" DiskStatusReleased DiskStatus = "Released" )
type LocalDiskNodesManager ¶
type LocalDiskNodesManager struct { // GetClient for query LocalDiskNode resources from k8s GetClient func() (*localdisknode.Kubeclient, error) // DiskHandler manage LD resources in cluster DiskHandler *localdisk2.LocalDiskHandler // contains filtered or unexported fields }
LocalDiskNodesManager manage all disks in the cluster by interacting with LocalDisk resources
func NewLocalDiskManager ¶
func NewLocalDiskManager() *LocalDiskNodesManager
func (*LocalDiskNodesManager) ClaimDisk ¶
func (ldn *LocalDiskNodesManager) ClaimDisk(name string) error
ClaimDisk claim a LocalDisk by update LocalDisk status to InUse
func (*LocalDiskNodesManager) FilterFreeDisks ¶ added in v0.1.6
func (ldn *LocalDiskNodesManager) FilterFreeDisks(reqDisks []Disk) (bool, error)
func (*LocalDiskNodesManager) GetClusterDisks ¶
func (ldn *LocalDiskNodesManager) GetClusterDisks() (map[string][]*Disk, error)
GetClusterDisks Here is just a simple implementation
func (*LocalDiskNodesManager) GetNodeDisks ¶
func (ldn *LocalDiskNodesManager) GetNodeDisks(node string) ([]*Disk, error)
GetNodeDisks get disks which attached on the node
func (*LocalDiskNodesManager) GetReservedDiskByPVC ¶ added in v0.1.6
func (ldn *LocalDiskNodesManager) GetReservedDiskByPVC(pvc string) (*Disk, error)
func (*LocalDiskNodesManager) ReleaseDisk ¶
func (ldn *LocalDiskNodesManager) ReleaseDisk(disk string) error
func (*LocalDiskNodesManager) ReserveDiskForVolume ¶ added in v0.1.6
func (ldn *LocalDiskNodesManager) ReserveDiskForVolume(reqDisk Disk, volume string) error
ReserveDiskForVolume reserve a LocalDisk by update LocalDisk status to Reserved and label this disk for the volume
func (*LocalDiskNodesManager) UnReserveDiskForPVC ¶ added in v0.1.6
func (ldn *LocalDiskNodesManager) UnReserveDiskForPVC(pvc string) error
Click to show internal directories.
Click to hide internal directories.