linstor

package module
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2018 License: GPL-2.0 Imports: 12 Imported by: 28

README

golinstor

This library aims to be a simple go interface for Linstor

This library is in an early stage and does not yet have a stable API: vendor this package, should you use it.

Documentation

godocs

License

GPL2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnoughFreeSpace

func EnoughFreeSpace(requestedKiB, replicas string) error

EnoughFreeSpace checks to see if there's enough free space to create a new resource.

func GetDevPath added in v0.7.0

func GetDevPath(r ResourceDeployment, stat bool) (string, error)

func WaitForDevPath

func WaitForDevPath(r ResourceDeployment, maxRetries int) (string, error)

WaitForDevPath polls until the resourse path appears on the system.

Types

type FSUtil

type FSUtil struct {
	*ResourceDeployment
	BlockSize        int64
	FSType           string
	Force            bool
	XFSDiscardBlocks bool
	XFSDataSU        string
	XFSDataSW        int
	XFSLogDev        string
	FSOpts           string
	MountOpts        string
	// contains filtered or unexported fields
}

FSUtil handles creating a filesystem and mounting resources.

func (FSUtil) Mount

func (f FSUtil) Mount(path string) error

Mount the FSUtil's resource on the path.

func (FSUtil) UnMount

func (f FSUtil) UnMount(path string) error

UnMount the FSUtil's resource from the path.

type ResourceDeployment added in v0.8.2

type ResourceDeployment struct {
	ResourceDeploymentConfig
	// contains filtered or unexported fields
}

ResourceDeployment contains all the information needed to query and assign/deploy a resource.

func NewResourceDeployment added in v0.8.2

func NewResourceDeployment(c ResourceDeploymentConfig) ResourceDeployment

NewResourceDeployment creates a new ResourceDeployment object. This tolerates some pretty janky ResourceDeploymentConfigs here is the breakdown of how that is handled: If no Name is given, a UUID is generated and used. If no NodeList is given, assignment will be automatically placed. If no ClientList is given, no client assignments will be made. If there are duplicates within ClientList or NodeList, they will be removed. If there are duplicates between ClientList and NodeList, duplicates in the ClientList will be removed. If no AutoPlace Value is given AND there is no NodeList and no ClientList, it will default to 1. If no DoNotPlaceWithRegex is provided resource assignment will occur without it. If no SizeKiB is provided, it will be given a size of 4096kb. If no StoragePool is provided, the default storage pool will be used. If no DisklessStoragePool is provided, the default diskless storage pool will be used. If no Encryption is specified, none will be used. If no Controllers are specified, none will be used. If no LogOut is specified, ioutil.Discard will be used.

func (ResourceDeployment) Assign added in v0.8.2

func (r ResourceDeployment) Assign() error

Assign assigns a resource with diskfull storage to all nodes in its NodeList, then attaches the resource disklessly to all nodes in its ClientList.

func (ResourceDeployment) Create added in v0.8.2

func (r ResourceDeployment) Create() error

Create reserves the resource name in Linstor.

func (ResourceDeployment) CreateAndAssign added in v0.8.2

func (r ResourceDeployment) CreateAndAssign() error

CreateAndAssign deploys the resource, created a new one if it doesn't exist.

func (ResourceDeployment) Delete added in v0.8.2

func (r ResourceDeployment) Delete() error

Delete removes a resource entirely from all nodes.

func (ResourceDeployment) Exists added in v0.8.2

func (r ResourceDeployment) Exists() (bool, error)

Exists checks to see if a resource is defined in DRBD Manage.

func (ResourceDeployment) IsClient added in v0.8.2

func (r ResourceDeployment) IsClient(nodeName string) bool

IsClient determines if resource is running as a client on nodeName.

func (ResourceDeployment) OnNode added in v0.8.2

func (r ResourceDeployment) OnNode(nodeName string) (bool, error)

OnNode determines if a resource is present on a particular node.

func (ResourceDeployment) Unassign added in v0.8.2

func (r ResourceDeployment) Unassign(nodeName string) error

Unassign unassigns a resource from a particular node.

type ResourceDeploymentConfig added in v0.8.2

type ResourceDeploymentConfig struct {
	Name                string
	NodeList            []string
	ClientList          []string
	AutoPlace           uint64
	DoNotPlaceWithRegex string
	SizeKiB             uint64
	StoragePool         string
	DisklessStoragePool string
	Encryption          bool
	Controllers         string
	LogOut              io.Writer
}

ResourceDeploymentConfig is a configuration object for ResourceDeployment. If you're deploying a resource, AutoPlace is required. If you're assigning a resource to particular nodes, NodeList is required.

Jump to

Keyboard shortcuts

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