storage

package
v18.10.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BackendRename = iota
	VolumeAccessInfoChange
	InvalidUpdate
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	Driver  Driver
	Name    string
	Online  bool
	Storage map[string]*Pool
	Volumes map[string]*Volume
}

func NewStorageBackend

func NewStorageBackend(driver Driver) (*Backend, error)

func (*Backend) AddStoragePool

func (b *Backend) AddStoragePool(pool *Pool)

func (*Backend) AddVolume

func (b *Backend) AddVolume(
	volConfig *VolumeConfig,
	storagePool *Pool,
	volumeAttributes map[string]storageattribute.Request,
) (*Volume, error)

func (*Backend) CloneVolume

func (b *Backend) CloneVolume(volConfig *VolumeConfig) (*Volume, error)

func (*Backend) ConstructExternal

func (b *Backend) ConstructExternal() *BackendExternal

func (*Backend) ConstructPersistent

func (b *Backend) ConstructPersistent() *BackendPersistent

func (*Backend) GetDriverName

func (b *Backend) GetDriverName() string

func (*Backend) GetProtocol

func (b *Backend) GetProtocol() tridentconfig.Protocol

func (*Backend) GetUpdateType

func (b *Backend) GetUpdateType(origBackend *Backend) *roaring.Bitmap

func (*Backend) HasVolumes

func (b *Backend) HasVolumes() bool

HasVolumes returns true if the Backend has one or more volumes provisioned on it.

func (*Backend) RemoveVolume

func (b *Backend) RemoveVolume(vol *Volume) error

func (*Backend) ResizeVolume

func (b *Backend) ResizeVolume(volName, newSize string) error

func (*Backend) Terminate

func (b *Backend) Terminate()

Terminate informs the backend that it is being deleted from the core and will not be called again. This may be a signal to the storage driver to clean up and stop any ongoing operations.

type BackendExternal

type BackendExternal struct {
	Name     string                   `json:"name"`
	Protocol tridentconfig.Protocol   `json:"protocol"`
	Config   interface{}              `json:"config"`
	Storage  map[string]*PoolExternal `json:"storage"`
	Online   bool                     `json:"online"`
	Volumes  []string                 `json:"volumes"`
}

type BackendPersistent

type BackendPersistent struct {
	Version string                         `json:"version"`
	Config  PersistentStorageBackendConfig `json:"config"`
	Name    string                         `json:"name"`
	Online  bool                           `json:"online"`
}

func (*BackendPersistent) MarshalConfig

func (p *BackendPersistent) MarshalConfig() (string, error)

Unfortunately, this method appears to be necessary to avoid arbitrary values ending up in the json.RawMessage fields of CommonStorageDriverConfig. Ideally, BackendPersistent would just store a serialized config, but doing so appears to cause problems with the json.RawMessage fields.

type Driver

type Driver interface {
	Name() string
	Initialize(tridentconfig.DriverContext, string, *drivers.CommonStorageDriverConfig) error
	Initialized() bool
	// Terminate tells the driver to clean up, as it won't be called again.
	Terminate()
	Create(name string, sizeBytes uint64, opts map[string]string) error
	CreateClone(name, source, snapshot string, opts map[string]string) error
	Destroy(name string) error
	Publish(name string, publishInfo *utils.VolumePublishInfo) error
	SnapshotList(name string) ([]Snapshot, error)
	Get(name string) error
	Resize(name string, sizeBytes uint64) error
	CreatePrepare(volConfig *VolumeConfig) bool
	// CreateFollowup adds necessary information for accessing the volume to VolumeConfig.
	CreateFollowup(volConfig *VolumeConfig) error
	// GetInternalVolumeName will return a name that satisfies any character
	// constraints present on the backend and that will be unique to Trident.
	// The latter requirement should generally be done by prepending the
	// value of CommonStorageDriver.SnapshotPrefix to the name.
	GetInternalVolumeName(name string) string
	GetStorageBackendSpecs(backend *Backend) error
	GetVolumeOpts(
		volConfig *VolumeConfig,
		pool *Pool,
		requests map[string]storageattribute.Request,
	) (map[string]string, error)
	GetProtocol() tridentconfig.Protocol
	StoreConfig(b *PersistentStorageBackendConfig)
	// GetExternalConfig returns a version of the driver configuration that
	// lacks confidential information, such as usernames and passwords.
	GetExternalConfig() interface{}
	GetVolumeExternal(name string) (*VolumeExternal, error)
	GetVolumeExternalWrappers(chan *VolumeExternalWrapper)
	GetUpdateType(driver Driver) *roaring.Bitmap
}

Driver provides a common interface for storage related operations

type PersistentStorageBackendConfig

type PersistentStorageBackendConfig struct {
	OntapConfig             *drivers.OntapStorageDriverConfig     `json:"ontap_config,omitempty"`
	SolidfireConfig         *drivers.SolidfireStorageDriverConfig `json:"solidfire_config,omitempty"`
	EseriesConfig           *drivers.ESeriesStorageDriverConfig   `json:"eseries_config,omitempty"`
	FakeStorageDriverConfig *drivers.FakeStorageDriverConfig      `json:"fake_config,omitempty"`
}

type Pool

type Pool struct {
	Name string
	// A Trident storage pool can potentially satisfy more than one storage
	// class.
	StorageClasses []string
	Backend        *Backend
	Attributes     map[string]sa.Offer
}

func NewStoragePool

func NewStoragePool(backend *Backend, name string) *Pool

func (*Pool) AddStorageClass

func (pool *Pool) AddStorageClass(class string)

func (*Pool) ConstructExternal

func (pool *Pool) ConstructExternal() *PoolExternal

func (*Pool) RemoveStorageClass

func (pool *Pool) RemoveStorageClass(class string) bool

type PoolExternal

type PoolExternal struct {
	Name           string   `json:"name"`
	StorageClasses []string `json:"storageClasses"`
	//TODO: can't have an interface here for unmarshalling
	Attributes map[string]sa.Offer `json:"storageAttributes"`
}

type Snapshot

type Snapshot struct {
	Name    string // The snapshot name or other identifier you would use to reference it
	Created string // The UTC time that the snapshot was created, in RFC3339 format
}

Snapshot contains the normalized volume snapshot format we report to Docker

func (*Snapshot) ConstructExternal

func (s *Snapshot) ConstructExternal() *SnapshotExternal

type SnapshotExternal

type SnapshotExternal struct {
	Snapshot
}

type Volume

type Volume struct {
	Config   *VolumeConfig
	Backend  string // Name of the storage backend
	Pool     string // Name of the pool on which this volume was first provisioned
	Orphaned bool   // An Orphaned volume isn't currently tracked by the storage backend
}

func NewVolume

func NewVolume(conf *VolumeConfig, backend string, pool string, orphaned bool) *Volume

func (*Volume) ConstructExternal

func (v *Volume) ConstructExternal() *VolumeExternal

type VolumeConfig

type VolumeConfig struct {
	Version                   string                 `json:"version"`
	Name                      string                 `json:"name"`
	InternalName              string                 `json:"internalName"`
	Size                      string                 `json:"size"`
	Protocol                  config.Protocol        `json:"protocol"`
	SpaceReserve              string                 `json:"spaceReserve"`
	SecurityStyle             string                 `json:"securityStyle"`
	SnapshotPolicy            string                 `json:"snapshotPolicy,omitempty"`
	SnapshotReserve           string                 `json:"snapshotReserve,omitempty"`
	SnapshotDir               string                 `json:"snapshotDirectory,omitempty"`
	ExportPolicy              string                 `json:"exportPolicy,omitempty"`
	UnixPermissions           string                 `json:"unixPermissions,omitempty"`
	StorageClass              string                 `json:"storageClass,omitempty"`
	AccessMode                config.AccessMode      `json:"accessMode,omitempty"`
	AccessInfo                utils.VolumeAccessInfo `json:"accessInformation"`
	BlockSize                 string                 `json:"blockSize"`
	FileSystem                string                 `json:"fileSystem"`
	Encryption                string                 `json:"encryption"`
	CloneSourceVolume         string                 `json:"cloneSourceVolume"`
	CloneSourceVolumeInternal string                 `json:"cloneSourceVolumeInternal"`
	CloneSourceSnapshot       string                 `json:"cloneSourceSnapshot"`
	SplitOnClone              string                 `json:"splitOnClone"`
	QoS                       string                 `json:"qos,omitempty"`
	QoSType                   string                 `json:"type,omitempty"`
}

func (*VolumeConfig) ConstructClone

func (c *VolumeConfig) ConstructClone() *VolumeConfig

func (*VolumeConfig) Validate

func (c *VolumeConfig) Validate() error

type VolumeExternal

type VolumeExternal struct {
	Config   *VolumeConfig
	Backend  string `json:"backend"`
	Pool     string `json:"pool"`
	Orphaned bool   `json:"orphaned"`
}

func (*VolumeExternal) GetCHAPSecretName

func (v *VolumeExternal) GetCHAPSecretName() string

type VolumeExternalWrapper

type VolumeExternalWrapper struct {
	Volume *VolumeExternal
	Error  error
}

VolumeExternalWrapper is used to return volumes and errors via channels between goroutines

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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