server

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

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 "
	// ProjQuotaPrefix is the template of quota fullpath
	ProjQuotaPrefix = "/mnt/quotapath.%s/%s"
	// ProjQuotaNamespacePrefix ...
	ProjQuotaNamespacePrefix = "/mnt/quotapath.%s"
)
View Source
const (
	// LvmdPort is lvm daemon tcp port
	LvmdPort = "1736"
)
View Source
const ProtectedTagName = "protected"

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

Variables

View Source
var KubeClient = &kubernetes.Clientset{}

KubeClient for resource access

Functions

func AddTagLV added in v1.1.0

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

AddTagLV add tag

func CleanPath added in v1.1.0

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

CleanPath deletes all the contents under the given directory

func CloneLV added in v1.1.0

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

CloneLV clones a volume via dd

func ConvertString2int added in v1.1.1

func ConvertString2int(origin string) string

ConvertString2int convert pvName to int data

func CreateLV added in v1.1.0

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

CreateLV creates a new volume

func CreateLoopDevice added in v1.1.7

func CreateLoopDevice(templateFile, pvName, quotaSize string, lp manager.LoopDevice) (string, error)

func CreateNameSpace added in v1.1.0

func 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 CreateProjQuotaSubpath added in v1.1.1

func CreateProjQuotaSubpath(ctx context.Context, subPath, quotaSize, rootPath string) (string, string, string, error)

CreateProjQuotaSubpath ...

func CreateVG added in v1.1.0

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

CreateVG create volume group

func DeleteLoopDevice added in v1.1.7

func DeleteLoopDevice(pvName string) error

func GetLvmdPort

func GetLvmdPort() string

GetLvmdPort get lvmd port

func GetNameSpace added in v1.1.0

func GetNameSpace(namespaceName string) (*lib.NameSpace, error)

GetNameSpace get pmem namespace

func GetNamespaceAssignedQuota added in v1.1.1

func GetNamespaceAssignedQuota(namespace string) (int, error)

GetNamespaceAssignedQuota ...

func ListLV added in v1.1.0

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

ListLV lists lvm volumes

func ListNameSpace added in v1.1.0

func ListNameSpace() ([]*lib.NameSpace, error)

ListNameSpace list pmem namespace

func ListVG added in v1.1.0

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

ListVG get vg info

func RemoveLV added in v1.1.0

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

RemoveLV removes a volume

func RemoveNameSpace added in v1.1.0

func RemoveNameSpace(ctx context.Context, namespaceName string) (string, error)

RemoveNameSpace removes a namespace

func RemoveProjQuotaSubpath added in v1.1.1

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

RemoveProjQuotaSubpath ...

func RemoveTagLV added in v1.1.0

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

RemoveTagLV remove tag

func RemoveVG added in v1.1.0

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

RemoveVG remove volume group

func SafeRemoveLV added in v1.2.0

func SafeRemoveLV(ctx context.Context, vg, name string) (string, error)

SafeRemoveLV removes an LV without utilizing the "-f" option. As a result, if the LV is currently mounted, an error will be prompted.

func SelectNamespace added in v1.1.1

func SelectNamespace(ctx context.Context, quotaSize string) (string, error)

SelectNamespace ...

func SetProjectID2PVSubpath added in v1.1.1

func SetProjectID2PVSubpath(subPath, fullPath, rootPath, filesystem string, run utils.CommandRunFunc) (string, error)

SetProjectID2PVSubpath ...

func SetSubpathProjQuota added in v1.1.1

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

SetSubpathProjQuota ...

func Start

func Start(kubeClient *kubernetes.Clientset, ch chan bool, templateFile string)

Start start lvmd

Types

type LoopDeviceServer added in v1.1.7

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

func NewLoopDeviceServer added in v1.1.7

func NewLoopDeviceServer(tf string) LoopDeviceServer

NewLoopDeviceServer create new loop device server

func (LoopDeviceServer) CreateLoopDevice added in v1.1.7

CreateLoopDevice defines how to create loopdevice by pv

func (LoopDeviceServer) DeleteLoopDevice added in v1.1.7

type ProjQuotaServer added in v1.1.1

type ProjQuotaServer struct{}

ProjQuotaServer proj quota grpc server

func NewProjQuotaServer added in v1.1.1

func NewProjQuotaServer() ProjQuotaServer

NewProjQuotaServer new proj quota grpc server

func (ProjQuotaServer) CreateProjQuotaSubpath added in v1.1.1

CreateProjQuotaSubpath ...

func (ProjQuotaServer) RemoveProjQuotaSubpath added in v1.1.1

RemoveProjQuotaSubpath ...

func (ProjQuotaServer) SetSubpathProjQuota added in v1.1.1

SetSubpathProjQuota ...

type Server

type Server struct{}

Server lvm grpc server

func NewServer

func NewServer() 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) 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) CreateNamespace added in v1.1.1

CreateNamespace create pmem namespace

func (Server) CreateVG

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

CreateVG create volume group

func (Server) ListLV

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

ListLV list lvm volume

func (Server) ListNamespace added in v1.1.1

func (s Server) ListNamespace(ctx context.Context, in *lib.ListNamespaceRequest) (*lib.ListNamespaceReply, error)

ListNamespace list pmem namespace

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) RemoveNamespace added in v1.1.1

RemoveNamespace remove pmem namespace

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

Jump to

Keyboard shortcuts

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