manager

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LOCAL_SPARSE_TEMPLATE_NAME = "ext4.img"
	LOCAL_SPARSE_DEFAULT_SIZE  = 10
)
View Source
const (
	// PmemVolumeGroupNameRegion0 tag
	PmemVolumeGroupNameRegion0 = "pmemvgregion0"
	// PmemVolumeGroupNameRegion1 tag
	PmemVolumeGroupNameRegion1 = "pmemvgregion1"
	// PmemVolumeGroupNamePrefix ...
	PmemVolumeGroupNamePrefix = "pmemvg"
	// PmemRegionNameDefault tag
	PmemRegionNameDefault = "region0"
)
View Source
const (
	// NsenterCmd is the nsenter command
	NsenterCmd = "/nsenter --mount=/proc/1/ns/mnt --ipc=/proc/1/ns/ipc --net=/proc/1/ns/net --uts=/proc/1/ns/uts "
)

Variables

View Source
var ErrParse = errors.New("Cannot parse output of blkid")

ErrParse is an error that is returned when parse operation fails

Functions

func EnsureFolder

func EnsureFolder(target string) error

EnsureFolder ...

func GetNameSpaceCapacity

func GetNameSpaceCapacity(ns *PmemNameSpace) int64

GetNameSpaceCapacity get namespace size

func MaintainDirect

func MaintainDirect(regions *PmemRegions) error

MaintainDirect direct pmem

func MaintainKMEM

func MaintainKMEM(regions *PmemRegions) error

MaintainKMEM create kmem type namespace

func MaintainLVM

func MaintainLVM(regions *PmemRegions) error

MaintainLVM lvm pmem

func MaintainPMEM

func MaintainPMEM(pmemType string, mounter k8smount.Interface) error

MaintainPMEM build pmem device

func MaintainQuotaPath

func MaintainQuotaPath(regions *PmemRegions, mounter k8smount.Interface) error

MaintainQuotaPath maintain project quota file system

func MaintainSparseTemplateFile added in v1.1.7

func MaintainSparseTemplateFile(dir string, size string) error

MaintainSparseTemplateFile create template dir for loopdeivce

Types

type DaxctrlMem

type DaxctrlMem struct {
	Chardev    string `json:"chardev"`
	Size       int64  `json:"size"`
	TargetNode int    `json:"target_node"`
	Mode       string `json:"mode"`
	Movable    bool   `json:"movable"`
}

DaxctrlMem list all mems

type LoopDevice added in v1.1.7

type LoopDevice interface {
	CreateSparseFile(sparseFile string, sizebit string) error
	FormatFile(fullName string) error
	CustomFormatFile(fullName, fsType string, options []string) error
	CopySparseFile(sourceFile, targetFile string) error
	CreateLoopDevice(sparseFile string) (string, error)
	DeleteLoopDevice(sparseFile string) (string, error)
	SafeDeleteLoopDevice(sparseFile string) (string, error)
	ResizeLoopDevice(sparseFile string) error
	FindLoopDeviceBySparseFile(sparseFile string) (string, error)
	GetTemplateInfo() (string, int)
	FileExists(filepath string) error
	GetUsedByteSize() (int64, error)
	GetTempDirTotalCapacity() (int64, error)
}

func NewLoopDevice added in v1.1.7

func NewLoopDevice(templateDir, templateSize string) LoopDevice

type MockLoopDevice added in v1.1.7

type MockLoopDevice struct {
	// contains filtered or unexported fields
}

MockLoopDevice defines the mocker of loopdevice

func NewMockLoopDevice added in v1.1.7

func NewMockLoopDevice(ctrl *gomock.Controller) *MockLoopDevice

func (*MockLoopDevice) EXPECT added in v1.1.7

type MockLoopDeviceMockRecorder added in v1.1.7

type MockLoopDeviceMockRecorder struct {
	// contains filtered or unexported fields
}

MockLoopDeviceMockRecorder ...

type NodeLoopDevice added in v1.1.7

type NodeLoopDevice struct {
	// contains filtered or unexported fields
}

func (*NodeLoopDevice) CopySparseFile added in v1.1.7

func (ld *NodeLoopDevice) CopySparseFile(sourceFile, targetFile string) error

func (*NodeLoopDevice) CreateLoopDevice added in v1.1.7

func (ld *NodeLoopDevice) CreateLoopDevice(sparseFile string) (string, error)

func (*NodeLoopDevice) CreateSparseFile added in v1.1.7

func (ld *NodeLoopDevice) CreateSparseFile(sparseFile string, sizebit string) error

func (*NodeLoopDevice) CustomFormatFile added in v1.1.7

func (ld *NodeLoopDevice) CustomFormatFile(fullName, fsType string, options []string) error

func (*NodeLoopDevice) DeleteLoopDevice added in v1.1.7

func (ld *NodeLoopDevice) DeleteLoopDevice(sparseFile string) (string, error)

func (*NodeLoopDevice) FileExists added in v1.1.7

func (ld *NodeLoopDevice) FileExists(filepath string) error

func (*NodeLoopDevice) FindLoopDeviceBySparseFile added in v1.1.7

func (ld *NodeLoopDevice) FindLoopDeviceBySparseFile(sparseFile string) (string, error)

func (*NodeLoopDevice) FormatFile added in v1.1.7

func (ld *NodeLoopDevice) FormatFile(fullName string) error

func (*NodeLoopDevice) GetTempDirTotalCapacity added in v1.2.0

func (ld *NodeLoopDevice) GetTempDirTotalCapacity() (int64, error)

func (*NodeLoopDevice) GetTemplateInfo added in v1.1.7

func (ld *NodeLoopDevice) GetTemplateInfo() (string, int)

func (*NodeLoopDevice) GetUsedByteSize added in v1.1.7

func (ld *NodeLoopDevice) GetUsedByteSize() (int64, error)

func (*NodeLoopDevice) ResizeLoopDevice added in v1.1.7

func (ld *NodeLoopDevice) ResizeLoopDevice(sparseFile string) error

func (*NodeLoopDevice) SafeDeleteLoopDevice added in v1.2.0

func (ld *NodeLoopDevice) SafeDeleteLoopDevice(sparseFile string) (string, error)

SafeDeleteLoopDevice checks if loopdevice mounted before deleting it. An error will be promoted if loopdevice currently mounted.

type PmemNameSpace

type PmemNameSpace struct {
	Dev        string `json:"dev,omitempty"`
	Mode       string `json:"mode,omitempty"`
	MapType    string `json:"map,omitempty"`
	Size       int64  `json:"size,omitempty"`
	UUID       string `json:"uuid,omitempty"`
	SectorSize int64  `json:"sectorsize,omitempty"`
	Align      int64  `json:"align,omitempty"`
	BlockDev   string `json:"blockdev,omitempty"`
	CharDev    string `json:"chardev,omitempty"`
	Name       string `json:"name,omitempty"`
}

PmemNameSpace define one pmem namespaces

func GetNameSpace

func GetNameSpace(namespaceName string) (*PmemNameSpace, error)

GetNameSpace get namespace info

func (*PmemNameSpace) ToProto

func (pns *PmemNameSpace) ToProto() *lib.NameSpace

ToProto build NameSpace object

type PmemRegion

type PmemRegion struct {
	Dev               string          `json:"dev"`
	Size              int64           `json:"size,omitempty"`
	AvailableSize     int64           `json:"available_size,omitempty"`
	MaxAvailableExent int64           `json:"max_available_extent,omitempty"`
	RegionType        string          `json:"type,omitempty"`
	IsetID            int64           `json:"iset_id,omitempty"`
	PersistenceDomain string          `json:"persistence_domain,omitempty"`
	Namespaces        []PmemNameSpace `json:"namespaces,omitempty"`
}

PmemRegion define on pmem region

type PmemRegions

type PmemRegions struct {
	Regions []PmemRegion `json:"regions"`
}

PmemRegions list all regions

func GetRegions

func GetRegions() (*PmemRegions, error)

GetRegions get regions info

Jump to

Keyboard shortcuts

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