lib

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultEtcdPrefix = "vda"

	PortalSucceedCode          = 0
	PortalSucceedMsg           = "succeed"
	PortalInternalErrCode      = 1
	PortalDupResErrCode        = 2
	PortalUnknownResErrCode    = 3
	PortalInvalidParamCode     = 4
	PortalResBusyErrCode       = 5
	PortalResRevErrCode        = 6
	PortalUnknownKeyTypeCode   = 7
	PortalJsonToMessageErrCode = 8
	PortalMessageToByteErrCode = 9

	DnSucceedCode      = 1
	DnSucceedMsg       = "succeed"
	DnOldRevErrCode    = 2
	DnOutOfSyncErrCode = 3

	CnSucceedCode      = 1
	CnSucceedMsg       = "succeed"
	CnOldRevErrCode    = 2
	CnOutOfSyncErrCode = 3

	ResUninitMsg = "uninit"
	ResNoInfoMsg = "no info"

	DefaultVdaPrefix = "vda"
	DefaultNqnPrefix = "nqn.2016-06.io.vda"

	MaxHashCode = 0xffff

	AllocLockTTL  = 2
	AllocMaxRetry = 10

	DefaultSanpName        = "%default%"
	DefaultSanpDescription = "default snap"

	PortalDefaultListLimit = int64(100)
	PortalMaxListLimit     = int64(1000)

	MonitorLeaseTimeout = 10

	GrpcCacheTTL      = 600
	GrpcCacheStep     = 10
	GrpcCacheInterval = 10
)
View Source
const (
	SPDK_PAGE_SIZE     = uint64(4096)
	CLUSTER_SIZE_MB    = uint64(4)
	CLUSTER_SIZE       = 1024 * 1024 * CLUSTER_SIZE_MB
	NVMF_MODULE_NUMBER = "VDA_CONTROLLER"
)
View Source
const (
	MaxReqId = 65536
)

Variables

This section is empty.

Functions

func DivCeil

func DivCeil(x, y uint64) uint64

func GetReqId

func GetReqId(ctx context.Context) string

func NewHexStrUuid

func NewHexStrUuid() string

func NvmfSerialNumber

func NvmfSerialNumber(nqn string) string

func NvmfUuid

func NvmfUuid(nqn string) (string, error)

func ResTimestamp

func ResTimestamp() string

func RoundUp

func RoundUp(x, y uint64) uint64

func SetReqId

func SetReqId(ctx context.Context) context.Context

Types

type Allocator

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

func NewAllocator

func NewAllocator(etcdCli *clientv3.Client, kf *KeyFmt, boundList []uint64) *Allocator

func (*Allocator) AllocCn

func (alloc *Allocator) AllocCn(ctx context.Context, cnCnt uint32) (
	[]*CnCand, error)

func (*Allocator) AllocDnPd

func (alloc *Allocator) AllocDnPd(ctx context.Context, vdCnt uint32,
	vdSize uint64, qos *BdevQos) ([]*DnPdCand, error)

type BdevQos

type BdevQos struct {
	RwIosPerSec    uint64
	RwMbytesPerSec uint64
	RMbytesPerSec  uint64
	WMbytesPerSec  uint64
}

type CnCand

type CnCand struct {
	SockAddr string
}

type DnPdCand

type DnPdCand struct {
	SockAddr string
	PdName   string
}

type GrpcCache

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

func NewGrpcCache

func NewGrpcCache(ttl int64, step int, interval int) *GrpcCache

func (*GrpcCache) Close

func (gc *GrpcCache) Close()

func (*GrpcCache) Get

func (gc *GrpcCache) Get(sockAddr string) (*grpc.ClientConn, error)

type Histogram added in v0.1.1

type Histogram struct {
	Histogram   string
	TscRate     uint64
	BucketShift uint32
}

type InvalidKeyError

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

func (*InvalidKeyError) Error

func (e *InvalidKeyError) Error() string

type Iostat

type Iostat struct {
	TickRate                uint64
	BytesRead               uint64
	NumReadOps              uint64
	BytesWritten            uint64
	NumWriteOps             uint64
	BytesUnmapped           uint64
	NumUnmapOps             uint64
	ReadLatencyTicks        uint64
	WriteLatencyTicks       uint64
	UnmapLatencyTicks       uint64
	QueueDepthPollingPeriod uint64
	QueueDepth              uint64
	IoTime                  uint64
	WeightedIoTime          uint64
}

type KeyFmt

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

func NewKeyFmt

func NewKeyFmt(prefix string) *KeyFmt

func (*KeyFmt) AllocLockPath

func (kf *KeyFmt) AllocLockPath() string

func (*KeyFmt) CnCapCntPrefix

func (kf *KeyFmt) CnCapCntPrefix(cntlrCnt uint32) string

func (*KeyFmt) CnCapKey

func (kf *KeyFmt) CnCapKey(cntlrCnt uint32, sockAddr string) string

func (*KeyFmt) CnCapPrefix

func (kf *KeyFmt) CnCapPrefix() string

func (*KeyFmt) CnEntityKey

func (kf *KeyFmt) CnEntityKey(sockAddr string) string

func (*KeyFmt) CnEntityPrefix

func (kf *KeyFmt) CnEntityPrefix() string

func (*KeyFmt) CnErrKey

func (kf *KeyFmt) CnErrKey(hashCode uint32, sockAddr string) string

func (*KeyFmt) CnErrPrefix

func (kf *KeyFmt) CnErrPrefix() string

func (*KeyFmt) CnErrWithHash

func (kf *KeyFmt) CnErrWithHash(hashCode uint32) string

func (*KeyFmt) CnListKey

func (kf *KeyFmt) CnListKey(hashCode uint32, sockAddr string) string

func (*KeyFmt) CnListPrefix

func (kf *KeyFmt) CnListPrefix() string

func (*KeyFmt) CnListWithHash

func (kf *KeyFmt) CnListWithHash(hashCode uint32) string

func (*KeyFmt) DaEntityKey

func (kf *KeyFmt) DaEntityKey(daName string) string

func (*KeyFmt) DaEntityPrefix

func (kf *KeyFmt) DaEntityPrefix() string

func (*KeyFmt) DaListKey

func (kf *KeyFmt) DaListKey(daName string) string

func (*KeyFmt) DaListPrefix

func (kf *KeyFmt) DaListPrefix() string

func (*KeyFmt) DecodeCnCapKey

func (kf *KeyFmt) DecodeCnCapKey(key string) (
	uint32, string, error)

func (*KeyFmt) DecodeCnErrKey

func (kf *KeyFmt) DecodeCnErrKey(key string) (uint32, string, error)

func (*KeyFmt) DecodeCnListKey

func (kf *KeyFmt) DecodeCnListKey(key string) (uint32, string, error)

func (*KeyFmt) DecodeDaListKey

func (kf *KeyFmt) DecodeDaListKey(key string) (string, error)

func (*KeyFmt) DecodeDnCapKey

func (kf *KeyFmt) DecodeDnCapKey(key string) (
	uint64, string, string, error)

func (*KeyFmt) DecodeDnErrKey

func (kf *KeyFmt) DecodeDnErrKey(key string) (uint32, string, error)

func (*KeyFmt) DecodeDnListKey

func (kf *KeyFmt) DecodeDnListKey(key string) (uint32, string, error)

func (*KeyFmt) DnCapKey

func (kf *KeyFmt) DnCapKey(freeSize uint64, sockAddr string, pdName string) string

func (*KeyFmt) DnCapPrefix

func (kf *KeyFmt) DnCapPrefix() string

func (*KeyFmt) DnCapSizePrefix

func (kf *KeyFmt) DnCapSizePrefix(freeSize uint64) string

func (*KeyFmt) DnEntityKey

func (kf *KeyFmt) DnEntityKey(sockAddr string) string

func (*KeyFmt) DnEntityPrefix

func (kf *KeyFmt) DnEntityPrefix() string

func (*KeyFmt) DnErrKey

func (kf *KeyFmt) DnErrKey(hashCode uint32, sockAddr string) string

func (*KeyFmt) DnErrPrefix

func (kf *KeyFmt) DnErrPrefix() string

func (*KeyFmt) DnErrWithHash

func (kf *KeyFmt) DnErrWithHash(hashCode uint32) string

func (*KeyFmt) DnListKey

func (kf *KeyFmt) DnListKey(hashCode uint32, sockAddr string) string

func (*KeyFmt) DnListPrefix

func (kf *KeyFmt) DnListPrefix() string

func (*KeyFmt) DnListWithHash

func (kf *KeyFmt) DnListWithHash(hashCode uint32) string

func (*KeyFmt) MonitorPrefix

func (kf *KeyFmt) MonitorPrefix() string

type LisConf

type LisConf struct {
	TrType  string `json:"trtype"`
	TrAddr  string `json:"traddr"`
	AdrFam  string `json:"adrfam"`
	TrSvcId string `json:"trsvcid"`
}

type LvsInfo

type LvsInfo struct {
	FreeClusters      uint64
	ClusterSize       uint64
	TotalDataClusters uint64
	BlockSize         uint64
}

type NameFmt

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

func NewNameFmt

func NewNameFmt(vdaPrefix, nqnPrefix string) *NameFmt

func (*NameFmt) AggBdevName

func (nf *NameFmt) AggBdevName(daId string) string

func (*NameFmt) AggBdevPrefix

func (nf *NameFmt) AggBdevPrefix() string

func (*NameFmt) BeLvolFullName

func (nf *NameFmt) BeLvolFullName(pdId, vdId string) string

func (*NameFmt) BeLvolName

func (nf *NameFmt) BeLvolName(vdId string) string

func (*NameFmt) BeLvolPrefix

func (nf *NameFmt) BeLvolPrefix() string

func (*NameFmt) BeNqnName

func (nf *NameFmt) BeNqnName(vdId string) string

func (*NameFmt) BeNqnPrefix

func (nf *NameFmt) BeNqnPrefix() string

func (*NameFmt) DaLvsName

func (nf *NameFmt) DaLvsName(daId string) string

func (*NameFmt) DaLvsPrefix

func (nf *NameFmt) DaLvsPrefix() string

func (*NameFmt) ExpId added in v0.1.1

func (nf *NameFmt) ExpId(secNvmeName string) string

func (*NameFmt) ExpNqnName

func (nf *NameFmt) ExpNqnName(daName, expName string) string

func (*NameFmt) ExpNqnPrefix

func (nf *NameFmt) ExpNqnPrefix() string

func (*NameFmt) FeBdevName

func (nf *NameFmt) FeBdevName(vdId string) string

func (*NameFmt) FeNqnName

func (nf *NameFmt) FeNqnName(cntlrId string) string

func (*NameFmt) FeNqnPrefix

func (nf *NameFmt) FeNqnPrefix() string

func (*NameFmt) FeNvmeName

func (nf *NameFmt) FeNvmeName(vdId string) string

func (*NameFmt) FeNvmePrefix

func (nf *NameFmt) FeNvmePrefix() string

func (*NameFmt) GrpBdevName

func (nf *NameFmt) GrpBdevName(grpId string) string

func (*NameFmt) GrpBdevPrefix

func (nf *NameFmt) GrpBdevPrefix() string

func (*NameFmt) PdBdevName

func (nf *NameFmt) PdBdevName(pdId string) string

func (*NameFmt) PdBdevPrefix

func (nf *NameFmt) PdBdevPrefix() string

func (*NameFmt) PdId added in v0.1.1

func (nf *NameFmt) PdId(pdBdevName string) string

func (*NameFmt) PdLvsName

func (nf *NameFmt) PdLvsName(pdId string) string

func (*NameFmt) PdLvsPrefix

func (nf *NameFmt) PdLvsPrefix() string

func (*NameFmt) Raid0BdevName

func (nf *NameFmt) Raid0BdevName(grpId string) string

func (*NameFmt) Raid0BdevPrefix

func (nf *NameFmt) Raid0BdevPrefix() string

func (*NameFmt) SecBdevName

func (nf *NameFmt) SecBdevName(expId string) string

func (*NameFmt) SecNqnName

func (nf *NameFmt) SecNqnName(cntlrId string) string

func (*NameFmt) SecNqnPrefix

func (nf *NameFmt) SecNqnPrefix() string

func (*NameFmt) SecNvmeName

func (nf *NameFmt) SecNvmeName(expId string) string

func (*NameFmt) SecNvmeNameToBdevName added in v0.1.1

func (nf *NameFmt) SecNvmeNameToBdevName(secNvmeName string) string

func (*NameFmt) SecNvmePrefix

func (nf *NameFmt) SecNvmePrefix() string

func (*NameFmt) SnapFullName

func (nf *NameFmt) SnapFullName(daId, snapId string) string

func (*NameFmt) SnapFullNamePrefix

func (nf *NameFmt) SnapFullNamePrefix() string

func (*NameFmt) SnapName

func (nf *NameFmt) SnapName(snapId string) string

type OperationClient

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

func NewOperationClient

func NewOperationClient(sc *SpdkClient) *OperationClient

func (*OperationClient) BdevGetHistogram added in v0.1.1

func (oc *OperationClient) BdevGetHistogram(bdevName string) (*Histogram, error)

func (*OperationClient) BdevGetIostat added in v0.1.1

func (oc *OperationClient) BdevGetIostat(bdevName string) (*Iostat, error)

func (*OperationClient) CreateAggBdev

func (oc *OperationClient) CreateAggBdev(aggBdevName string, grpBdevList []string) error

func (*OperationClient) CreateBeLvol

func (oc *OperationClient) CreateBeLvol(lvsName, lvolName string, size uint64,
	rwIosPerSec, rwMbytesPerSec, rMbytesPerSec, wMbytesPerSec uint64) error

func (*OperationClient) CreateBeNvmf

func (oc *OperationClient) CreateBeNvmf(beNqnName, beLvolFullName, feNqnName string,
	lisConf *LisConf) error

func (*OperationClient) CreateDaLvs

func (oc *OperationClient) CreateDaLvs(daLvsName, aggBdevName string) error

func (*OperationClient) CreateExpPrimaryNvmf

func (oc *OperationClient) CreateExpPrimaryNvmf(expNqnName, snapFullName, initiatorNqn string,
	secNqnList []string, lisConf *LisConf) error

func (*OperationClient) CreateExpSecNvmf

func (oc *OperationClient) CreateExpSecNvmf(expNqnName, secBdevName, initiatorNqn string,
	lisConf *LisConf) error

func (*OperationClient) CreateFeNvme

func (oc *OperationClient) CreateFeNvme(feNvmeName, beNqnName, feNqnName string,
	lisConf *LisConf) error

func (*OperationClient) CreateGrpBdev

func (oc *OperationClient) CreateGrpBdev(grpBdevName, raid0BdevName string) error

func (*OperationClient) CreatePdAio

func (oc *OperationClient) CreatePdAio(name string, fileName string) error

func (*OperationClient) CreatePdLvs

func (oc *OperationClient) CreatePdLvs(pdLvsName, bdevName string) error

func (*OperationClient) CreatePdMalloc

func (oc *OperationClient) CreatePdMalloc(name string, size uint64) error

func (*OperationClient) CreatePdNvme

func (oc *OperationClient) CreatePdNvme(name, realName, trAddr string) error

func (*OperationClient) CreateRaid0Bdev

func (oc *OperationClient) CreateRaid0Bdev(raid0BdevName string,
	stripSizeKb uint32, feBdevList []string) error

func (*OperationClient) CreateSecNvme

func (oc *OperationClient) CreateSecNvme(secNvmeName, expNqnName, secNqnName string,
	lisConf *LisConf) error

func (*OperationClient) CreateSnap

func (oc *OperationClient) CreateSnap(daLvsName, snapName, oriName string,
	isClone bool, snapSize uint64) error

func (*OperationClient) DeleteAggBdev

func (oc *OperationClient) DeleteAggBdev(name string) error

func (*OperationClient) DeleteBeLvol

func (oc *OperationClient) DeleteBeLvol(name string) error

func (*OperationClient) DeleteBeNvmf

func (oc *OperationClient) DeleteBeNvmf(nqn string) error

func (*OperationClient) DeleteDaLvs

func (oc *OperationClient) DeleteDaLvs(daLvsName string) error

func (*OperationClient) DeleteExpNvmf

func (oc *OperationClient) DeleteExpNvmf(nqn string) error

func (*OperationClient) DeleteFeNvme

func (oc *OperationClient) DeleteFeNvme(feNvmeName string) error

func (*OperationClient) DeleteGrpBdev

func (oc *OperationClient) DeleteGrpBdev(name string) error

func (*OperationClient) DeletePdBdev

func (oc *OperationClient) DeletePdBdev(bdevName string) error

func (*OperationClient) DeletePdLvs

func (oc *OperationClient) DeletePdLvs(lvsName string) error

func (*OperationClient) DeleteRaid0Bdev

func (oc *OperationClient) DeleteRaid0Bdev(name string) error

func (*OperationClient) DeleteSecNvme

func (oc *OperationClient) DeleteSecNvme(secNvmeName string) error

func (*OperationClient) DeleteSnap

func (oc *OperationClient) DeleteSnap(name string) error

func (*OperationClient) EnableHistogram

func (oc *OperationClient) EnableHistogram(bdevName string) error

func (*OperationClient) ExamineBdev

func (oc *OperationClient) ExamineBdev(bdevName string) error

func (*OperationClient) GetAggBdevList

func (oc *OperationClient) GetAggBdevList(prefix string) ([]string, error)

func (*OperationClient) GetBeLvolList

func (oc *OperationClient) GetBeLvolList(prefix string) ([]string, error)

func (*OperationClient) GetBeNqnList

func (oc *OperationClient) GetBeNqnList(prefix string) ([]string, error)

func (*OperationClient) GetDaLvsList

func (oc *OperationClient) GetDaLvsList(prefix string) ([]string, error)

func (*OperationClient) GetExpNqnList

func (oc *OperationClient) GetExpNqnList(prefix string) ([]string, error)

func (*OperationClient) GetFeNvmeList

func (oc *OperationClient) GetFeNvmeList(prefix string) ([]string, error)

func (*OperationClient) GetGrpBdevList

func (oc *OperationClient) GetGrpBdevList(prefix string) ([]string, error)

func (*OperationClient) GetLvsInfo

func (oc *OperationClient) GetLvsInfo(lvsName string) (*LvsInfo, error)

func (*OperationClient) GetPdBdevList

func (oc *OperationClient) GetPdBdevList(prefix string) ([]string, error)

func (*OperationClient) GetPdLvsList

func (oc *OperationClient) GetPdLvsList(prefix string) ([]string, error)

func (*OperationClient) GetRaid0BdevList

func (oc *OperationClient) GetRaid0BdevList(prefix string) ([]string, error)

func (*OperationClient) GetSecNvmeList

func (oc *OperationClient) GetSecNvmeList(prefix string) ([]string, error)

func (*OperationClient) GetSnapList

func (oc *OperationClient) GetSnapList(prefix string) ([]string, error)

func (*OperationClient) LoadBdevs

func (oc *OperationClient) LoadBdevs() error

func (*OperationClient) LoadNvmfs

func (oc *OperationClient) LoadNvmfs() error

func (*OperationClient) WaitForLvs

func (oc *OperationClient) WaitForLvs(daLvsName string) error

type SpdkClient

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

func NewSpdkClient

func NewSpdkClient(network, address string, timeout time.Duration) *SpdkClient

func (*SpdkClient) Invoke

func (sc *SpdkClient) Invoke(method string, params interface{},
	rsp interface{}) error

func (*SpdkClient) Stop

func (sc *SpdkClient) Stop()

type StmWrapper

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

func NewStmWrapper

func NewStmWrapper(etcdCli *clientv3.Client) *StmWrapper

func (*StmWrapper) RunStm

func (sw *StmWrapper) RunStm(apply func(stm concurrency.STM) error,
	ctx context.Context, name string) error

type SyncupManager

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

func NewSyncupManager

func NewSyncupManager(kf *KeyFmt, sw *StmWrapper, gc *GrpcCache) *SyncupManager

func (*SyncupManager) SyncupCn

func (sm *SyncupManager) SyncupCn(sockAddr string, ctx context.Context)

func (*SyncupManager) SyncupDn

func (sm *SyncupManager) SyncupDn(sockAddr string, ctx context.Context)

Jump to

Keyboard shortcuts

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