refract

package
v0.0.0-...-428b52b Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: Apache-2.0 Imports: 38 Imported by: 0

README

CSI Hostpath driver

Usage:

Build hostpathplugin
$ make
Start Hostpath driver
$ sudo ./bin/hostpathplugin --endpoint tcp://127.0.0.1:10000 --nodeid CSINode -v=5
Test using csc

Get csc tool from https://github.com/rexray/gocsi/tree/master/csc

Get plugin info
$ csc identity plugin-info --endpoint tcp://127.0.0.1:10000
"csi-hostpath"  "0.1.0"
Create a volume
$ csc controller new --endpoint tcp://127.0.0.1:10000 --cap 1,block CSIVolumeName
CSIVolumeID
Delete a volume
$ csc controller del --endpoint tcp://127.0.0.1:10000 CSIVolumeID
CSIVolumeID
Validate volume capabilities
$ csc controller validate-volume-capabilities --endpoint tcp://127.0.0.1:10000 --cap 1,block CSIVolumeID
CSIVolumeID  true
NodePublish a volume
$ csc node publish --endpoint tcp://127.0.0.1:10000 --cap 1,block --target-path /mnt/hostpath CSIVolumeID
CSIVolumeID
NodeUnpublish a volume
$ csc node unpublish --endpoint tcp://127.0.0.1:10000 --target-path /mnt/hostpath CSIVolumeID
CSIVolumeID
Get NodeInfo
$ csc node get-info --endpoint tcp://127.0.0.1:10000
CSINode

Documentation

Index

Constants

View Source
const (
	TopologyKeyNode = "topology.hostpath.csi/node"
)

Variables

This section is empty.

Functions

func NewNonBlockingGRPCServer

func NewNonBlockingGRPCServer() *nonBlockingGRPCServer

func NewRefractDriver

func NewRefractDriver(cfg Config) (*refract, error)

func NewRefractRoot

func NewRefractRoot(rootPath string) (fs.InodeEmbedder, error)

NewRefractRoot returns a root node for a refract file system whose root is at the given root. This node implements all NodeXxxxer operations available.

Types

type Capacity

type Capacity map[string]resource.Quantity

Capacity simulates linear storage of certain types ("fast", "slow"). To calculate the amount of allocated space, the size of all currently existing volumes of the same kind is summed up.

Available capacity is configurable with a command line flag -capacity <type>=<size> where <type> is a string and <size> is a quantity (1T, 1Gi). More than one of those flags can be used.

The underlying map will be initialized if needed by Set, which makes it possible to define and use a Capacity instance without explicit initialization (`var capacity Capacity` or as member in a struct).

func (*Capacity) Enabled

func (c *Capacity) Enabled() bool

Enabled returns true if capacities are configured.

func (*Capacity) Set

func (c *Capacity) Set(arg string) error

Set is an implementation of flag.Value.Set.

func (*Capacity) String

func (c *Capacity) String() string

type Config

type Config struct {
	DriverName                    string
	Endpoint                      string
	ProxyEndpoint                 string
	NodeID                        string
	VendorVersion                 string
	StateDir                      string
	RootDir                       string
	MaxVolumesPerNode             int64
	MaxVolumeSize                 int64
	AttachLimit                   int64
	Capacity                      Capacity
	Ephemeral                     bool
	ShowVersion                   bool
	EnableAttach                  bool
	EnableTopology                bool
	EnableVolumeExpansion         bool
	EnableControllerModifyVolume  bool
	AcceptedMutableParameterNames StringArray
	DisableControllerExpansion    bool
	DisableNodeExpansion          bool
	MaxVolumeExpansionSizeNode    int64
	CheckVolumeLifecycle          bool
}

type ContainerFileSystem

type ContainerFileSystem struct {
	Children []MountPointInfo `json:"children"`
}

type FileSystems

type FileSystems struct {
	Filsystem []ContainerFileSystem `json:"filesystems"`
}

type MountPointInfo

type MountPointInfo struct {
	Target              string           `json:"target"`
	Source              string           `json:"source"`
	FsType              string           `json:"fstype"`
	Options             string           `json:"options"`
	ContainerFileSystem []MountPointInfo `json:"children,omitempty"`
}

type RefractNode

type RefractNode struct {
	*fs.LoopbackNode
}

func (*RefractNode) Create

func (n *RefractNode) Create(ctx context.Context, name string, flags uint32, mode uint32, out *fuse.EntryOut) (inode *fs.Inode, fh fs.FileHandle, fuseFlags uint32, errno syscall.Errno)

func (*RefractNode) Getattr

func (n *RefractNode) Getattr(ctx context.Context, f fs.FileHandle, out *fuse.AttrOut) syscall.Errno
func (n *RefractNode) Link(ctx context.Context, target fs.InodeEmbedder, name string, out *fuse.EntryOut) (*fs.Inode, syscall.Errno)

func (*RefractNode) Lookup

func (n *RefractNode) Lookup(ctx context.Context, name string, out *fuse.EntryOut) (*fs.Inode, syscall.Errno)

func (*RefractNode) Mkdir

func (n *RefractNode) Mkdir(ctx context.Context, name string, mode uint32, out *fuse.EntryOut) (*fs.Inode, syscall.Errno)

func (*RefractNode) Mknod

func (n *RefractNode) Mknod(ctx context.Context, name string, mode, rdev uint32, out *fuse.EntryOut) (*fs.Inode, syscall.Errno)

func (*RefractNode) Open

func (n *RefractNode) Open(ctx context.Context, flags uint32) (fh fs.FileHandle, fuseFlags uint32, errno syscall.Errno)

func (*RefractNode) Opendir

func (n *RefractNode) Opendir(ctx context.Context) syscall.Errno

func (*RefractNode) Readdir

func (n *RefractNode) Readdir(ctx context.Context) (fs.DirStream, syscall.Errno)
func (n *RefractNode) Readlink(ctx context.Context) ([]byte, syscall.Errno)

func (*RefractNode) Rename

func (n *RefractNode) Rename(ctx context.Context, name string, newParent fs.InodeEmbedder, newName string, flags uint32) syscall.Errno

func (*RefractNode) Rmdir

func (n *RefractNode) Rmdir(ctx context.Context, name string) syscall.Errno

func (*RefractNode) Setattr

func (n *RefractNode) Setattr(ctx context.Context, f fs.FileHandle, in *fuse.SetAttrIn, out *fuse.AttrOut) syscall.Errno

func (*RefractNode) Statfs

func (n *RefractNode) Statfs(ctx context.Context, out *fuse.StatfsOut) syscall.Errno
func (n *RefractNode) Symlink(ctx context.Context, target, name string, out *fuse.EntryOut) (*fs.Inode, syscall.Errno)
func (n *RefractNode) Unlink(ctx context.Context, name string) syscall.Errno

type RefractRoot

type RefractRoot struct {
	*fs.LoopbackRoot
	NewNode func(rootData *RefractRoot, parent *fs.Inode, name string, st *syscall.Stat_t) fs.InodeEmbedder
}

type StringArray

type StringArray []string

StringArray is a flag.Value implementation that allows to specify a comma-separated list of strings on the command line.

func (*StringArray) Set

func (s *StringArray) Set(value string) error

Set is an implementation of flag.Value.Set.

func (*StringArray) String

func (s *StringArray) String() string

String is an implementation of flag.Value.String.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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