server

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProjQuotaPrefix is the template of quota fullpath
	ProjQuotaPrefix = "/mnt/quotapath.%s/%s"
	// ProjQuotaNamespacePrefix ...
	ProjQuotaNamespacePrefix = "/mnt/quotapath.%s"
)
View Source
const ProtectedTagName = "protected"

ProtectedTagName is a tag that prevents RemoveLV & RemoveVG from removing a volume

Variables

This section is empty.

Functions

func ConvertString2int

func ConvertString2int(origin string) string

ConvertString2int convert pvName to int data

func GetLvmdPort

func GetLvmdPort() string

GetLvmdPort get lvmd port

func ListPV added in v0.2.2

func ListPV(vgName string) ([]*lib.PV, error)

ListPV get pv info in vg

func MustRunThisWhenTest added in v0.6.0

func MustRunThisWhenTest()

func NewGRPCServer added in v0.6.0

func NewGRPCServer() (*grpc.Server, *client.CredstoreClient, error)

NewServer creates a new GRPC server stub with credstore auth (if requested).

func Start

func Start(port string)

Start start lvmd

func StartFake added in v0.6.0

func StartFake()

Types

type FakeCommands added in v0.6.0

type FakeCommands struct{}

func (*FakeCommands) AddTagLV added in v0.6.0

func (fake *FakeCommands) AddTagLV(ctx context.Context, vg string, name string, tags []string) (string, error)

func (*FakeCommands) CleanDevice added in v0.6.0

func (fake *FakeCommands) CleanDevice(ctx context.Context, device string) (string, error)

func (*FakeCommands) CleanPath added in v0.6.0

func (fake *FakeCommands) CleanPath(ctx context.Context, path string) error

func (*FakeCommands) CloneLV added in v0.6.0

func (fake *FakeCommands) CloneLV(ctx context.Context, src, dest string) (string, error)

func (*FakeCommands) CreateLV added in v0.6.0

func (fake *FakeCommands) CreateLV(ctx context.Context, vg string, name string, size uint64, mirrors uint32, tags []string, striping bool) (string, error)

func (*FakeCommands) CreateSnapshot added in v0.6.0

func (fake *FakeCommands) CreateSnapshot(ctx context.Context, vgName string, snapshotName string, srcVolumeName string, readonly bool, roInitSize int64, secrets map[string]string) (int64, error)

func (*FakeCommands) CreateVG added in v0.6.0

func (fake *FakeCommands) CreateVG(ctx context.Context, name string, physicalVolume string, tags []string) (string, error)

func (*FakeCommands) ExpandLV added in v0.6.0

func (fake *FakeCommands) ExpandLV(ctx context.Context, vgName string, volumeId string, expectSize uint64) (string, error)

func (*FakeCommands) ListLV added in v0.6.0

func (fake *FakeCommands) ListLV(listspec string) ([]*lib.LV, error)

ListLV lists lvm volumes

func (*FakeCommands) ListVG added in v0.6.0

func (fake *FakeCommands) ListVG() ([]*lib.VG, error)

func (*FakeCommands) RemoveLV added in v0.6.0

func (fake *FakeCommands) RemoveLV(ctx context.Context, vg string, name string) (string, error)

func (*FakeCommands) RemoveSnapshot added in v0.6.0

func (fake *FakeCommands) RemoveSnapshot(ctx context.Context, vg string, name string, readonly bool) (string, error)

func (*FakeCommands) RemoveTagLV added in v0.6.0

func (fake *FakeCommands) RemoveTagLV(ctx context.Context, vg string, name string, tags []string) (string, error)

func (*FakeCommands) RemoveVG added in v0.6.0

func (fake *FakeCommands) RemoveVG(ctx context.Context, name string) (string, error)

type LvmCmd added in v0.6.0

type LvmCmd interface {
	ListLV(listspec string) ([]*lib.LV, error)
	CreateLV(ctx context.Context, vg string, name string, size uint64, mirrors uint32, tags []string, striping bool) (string, error)
	RemoveLV(ctx context.Context, vg string, name string) (string, error)
	CloneLV(ctx context.Context, src, dest string) (string, error)
	ExpandLV(ctx context.Context, vgName string, volumeId string, expectSize uint64) (string, error)
	CreateSnapshot(ctx context.Context, vgName string, snapshotName string, srcVolumeName string, readonly bool, roInitSize int64, secrets map[string]string) (int64, error)
	RemoveSnapshot(ctx context.Context, vg string, name string, readonly bool) (string, error)
	AddTagLV(ctx context.Context, vg string, name string, tags []string) (string, error)
	RemoveTagLV(ctx context.Context, vg string, name string, tags []string) (string, error)
	ListVG() ([]*lib.VG, error)
	CreateVG(ctx context.Context, name string, physicalVolume string, tags []string) (string, error)
	RemoveVG(ctx context.Context, name string) (string, error)
	CleanPath(ctx context.Context, path string) error
	CleanDevice(ctx context.Context, device string) (string, error)
}

type LvmCommads added in v0.6.0

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

func (*LvmCommads) AddTagLV added in v0.6.0

func (lvm *LvmCommads) AddTagLV(ctx context.Context, vg string, name string, tags []string) (string, error)

AddTagLV add tag

func (*LvmCommads) CleanDevice added in v0.6.0

func (lvm *LvmCommads) CleanDevice(ctx context.Context, device string) (string, error)

func (*LvmCommads) CleanPath added in v0.6.0

func (lvm *LvmCommads) CleanPath(ctx context.Context, path string) error

CleanPath deletes all the contents under the given directory

func (*LvmCommads) CloneLV added in v0.6.0

func (lvm *LvmCommads) CloneLV(ctx context.Context, src, dest string) (string, error)

CloneLV clones a volume via dd

func (*LvmCommads) CreateLV added in v0.6.0

func (lvm *LvmCommads) CreateLV(ctx context.Context, vg string, name string, size uint64, mirrors uint32, tags []string, striping bool) (string, error)

CreateLV creates a new volume

func (*LvmCommads) CreateNameSpace added in v0.6.0

func (lvm *LvmCommads) CreateNameSpace(ctx context.Context, region string, name string, size uint64) (string, error)

CreateNameSpace creates a new namespace ndctl create-namespace -r region0 --size=6G -n webpmem1

func (*LvmCommads) CreateSnapshot added in v0.6.0

func (lvm *LvmCommads) CreateSnapshot(ctx context.Context, vgName string, snapshotName string, srcVolumeName string, readonly bool, roInitSize int64, secrets map[string]string) (int64, error)

CreateSnapshot creates a new volume snapshot

func (*LvmCommads) CreateVG added in v0.6.0

func (lvm *LvmCommads) CreateVG(ctx context.Context, name string, physicalVolume string, tags []string) (string, error)

CreateVG create volume group

func (*LvmCommads) ExpandLV added in v0.6.0

func (lvm *LvmCommads) ExpandLV(ctx context.Context, vgName string, volumeId string, expectSize uint64) (string, error)

ExpandLV expand a volume

func (*LvmCommads) GetNamespaceAssignedQuota added in v0.6.0

func (lvm *LvmCommads) GetNamespaceAssignedQuota(namespace string) (int, error)

GetNamespaceAssignedQuota ...

func (*LvmCommads) ListLV added in v0.6.0

func (lvm *LvmCommads) ListLV(listspec string) ([]*lib.LV, error)

ListLV lists lvm volumes

func (*LvmCommads) ListVG added in v0.6.0

func (lvm *LvmCommads) ListVG() ([]*lib.VG, error)

ListVG get vg info

func (*LvmCommads) RemoveLV added in v0.6.0

func (lvm *LvmCommads) RemoveLV(ctx context.Context, vg string, name string) (string, error)

RemoveLV removes a volume

func (*LvmCommads) RemoveProjQuotaSubpath added in v0.6.0

func (lvm *LvmCommads) RemoveProjQuotaSubpath(ctx context.Context, quotaSubpath string) (string, error)

RemoveProjQuotaSubpath ...

func (*LvmCommads) RemoveSnapshot added in v0.6.0

func (lvm *LvmCommads) RemoveSnapshot(ctx context.Context, vg string, name string, readonly bool) (string, error)

RemoveSnapshot removes a volume snapshot

func (*LvmCommads) RemoveTagLV added in v0.6.0

func (lvm *LvmCommads) RemoveTagLV(ctx context.Context, vg string, name string, tags []string) (string, error)

RemoveTagLV remove tag

func (*LvmCommads) RemoveVG added in v0.6.0

func (lvm *LvmCommads) RemoveVG(ctx context.Context, name string) (string, error)

RemoveVG remove volume group

func (*LvmCommads) SetProjectID2PVSubpath added in v0.6.0

func (lvm *LvmCommads) SetProjectID2PVSubpath(subPath, fullPath string, run utils.CommandRunFunc) (string, error)

SetProjectID2PVSubpath ...

func (*LvmCommads) SetSubpathProjQuota added in v0.6.0

func (lvm *LvmCommads) SetSubpathProjQuota(ctx context.Context, projQuotaSubpath, blockHardlimit, blockSoftlimit string) (string, error)

SetSubpathProjQuota ...

type Server

type Server struct {
	lib.UnimplementedLVMServer
	// contains filtered or unexported fields
}

Server lvm grpc server

func NewServer

func NewServer(cmd LvmCmd) Server

NewServer new server

func (Server) AddTagLV

func (s Server) AddTagLV(ctx context.Context, in *lib.AddTagLVRequest) (*lib.AddTagLVReply, error)

AddTagLV add tag

func (Server) CleanDevice added in v0.3.1

func (s Server) CleanDevice(ctx context.Context, in *lib.CleanDeviceRequest) (*lib.CleanDeviceReply, error)

CleanDevice wipefs

func (Server) CleanPath

func (s Server) CleanPath(ctx context.Context, in *lib.CleanPathRequest) (*lib.CleanPathReply, error)

CleanPath remove file under path

func (Server) CloneLV

func (s Server) CloneLV(ctx context.Context, in *lib.CloneLVRequest) (*lib.CloneLVReply, error)

CloneLV clone lvm volume

func (Server) CreateLV

func (s Server) CreateLV(ctx context.Context, in *lib.CreateLVRequest) (*lib.CreateLVReply, error)

CreateLV create lvm volume

func (Server) CreateSnapshot

CreateSnapshot create lvm snapshot

func (Server) CreateVG

func (s Server) CreateVG(ctx context.Context, in *lib.CreateVGRequest) (*lib.CreateVGReply, error)

CreateVG create volume group

func (Server) ExpandLV

func (s Server) ExpandLV(ctx context.Context, in *lib.ExpandLVRequest) (*lib.ExpandLVReply, error)

ExpandLV expand lvm volume

func (Server) ListLV

func (s Server) ListLV(ctx context.Context, in *lib.ListLVRequest) (*lib.ListLVReply, error)

ListLV list lvm volume

func (Server) ListVG

func (s Server) ListVG(ctx context.Context, in *lib.ListVGRequest) (*lib.ListVGReply, error)

ListVG list volume group

func (Server) RemoveLV

func (s Server) RemoveLV(ctx context.Context, in *lib.RemoveLVRequest) (*lib.RemoveLVReply, error)

RemoveLV remove lvm volume

func (Server) RemoveSnapshot

RemoveSnapshot remove lvm snapshot

func (Server) RemoveTagLV

func (s Server) RemoveTagLV(ctx context.Context, in *lib.RemoveTagLVRequest) (*lib.RemoveTagLVReply, error)

RemoveTagLV remove tag

func (Server) RemoveVG

func (s Server) RemoveVG(ctx context.Context, in *lib.CreateVGRequest) (*lib.RemoveVGReply, error)

RemoveVG remove volume group

type SpdkCommands added in v0.6.0

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

func NewSpdkCommands added in v0.6.0

func NewSpdkCommands(rpcSocket string) *SpdkCommands

func (*SpdkCommands) AddTagLV added in v0.6.0

func (cmd *SpdkCommands) AddTagLV(ctx context.Context, vg string, name string, tags []string) (string, error)

AddTagLV add tag

func (*SpdkCommands) CleanDevice added in v0.6.0

func (cmd *SpdkCommands) CleanDevice(ctx context.Context, device string) (string, error)

func (*SpdkCommands) CleanPath added in v0.6.0

func (cmd *SpdkCommands) CleanPath(ctx context.Context, path string) error

CleanPath deletes all the contents under the given directory

func (*SpdkCommands) CloneLV added in v0.6.0

func (cmd *SpdkCommands) CloneLV(ctx context.Context, src, dest string) (string, error)

CloneLV clones a logical volume

func (*SpdkCommands) CreateLV added in v0.6.0

func (cmd *SpdkCommands) CreateLV(ctx context.Context, vg string, name string, size uint64, mirrors uint32, tags []string, striping bool) (string, error)

CreateLV creates a new logical volume and relevant vhost device

func (*SpdkCommands) CreateSnapshot added in v0.6.0

func (cmd *SpdkCommands) CreateSnapshot(ctx context.Context, vgName string, snapshotName string, srcVolumeName string, readonly bool, roInitSize int64, secrets map[string]string) (int64, error)

CreateSnapshot creates a new volume snapshot

func (*SpdkCommands) CreateVG added in v0.6.0

func (cmd *SpdkCommands) CreateVG(ctx context.Context, name string, physicalVolume string, tags []string) (string, error)

CreateVG create volume group (lvstore)

func (*SpdkCommands) ExpandLV added in v0.6.0

func (cmd *SpdkCommands) ExpandLV(ctx context.Context, vgName string, volumeId string, expectSize uint64) (string, error)

ExpandLV expand a logical volume

func (*SpdkCommands) ListLV added in v0.6.0

func (cmd *SpdkCommands) ListLV(listspec string) ([]*lib.LV, error)

ListLV lists logical volumes listspec: vg/volumeID

func (*SpdkCommands) ListVG added in v0.6.0

func (cmd *SpdkCommands) ListVG() ([]*lib.VG, error)

ListVG get volume group (lvstore) info

func (*SpdkCommands) RemoveLV added in v0.6.0

func (cmd *SpdkCommands) RemoveLV(ctx context.Context, vg string, name string) (string, error)

RemoveLV removes a logical volume

func (*SpdkCommands) RemoveSnapshot added in v0.6.0

func (cmd *SpdkCommands) RemoveSnapshot(ctx context.Context, vg string, name string, readonly bool) (string, error)

RemoveSnapshot removes a volume snapshot

func (*SpdkCommands) RemoveTagLV added in v0.6.0

func (cmd *SpdkCommands) RemoveTagLV(ctx context.Context, vg string, name string, tags []string) (string, error)

RemoveTagLV remove tag

func (*SpdkCommands) RemoveVG added in v0.6.0

func (cmd *SpdkCommands) RemoveVG(ctx context.Context, name string) (string, error)

RemoveVG remove volume group (lvstore)

Jump to

Keyboard shortcuts

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