View Source
const (
	Unknown  = BackendState("unknown")
	Online   = BackendState("online")
	Offline  = BackendState("offline")
	Deleting = BackendState("deleting")
	Failed   = BackendState("failed")
View Source
const (
	BackendRename = iota
View Source
const (
	SnapshotStateOnline         = SnapshotState("online")
	SnapshotStateMissingBackend = SnapshotState("missing_backend")
	SnapshotStateMissingVolume  = SnapshotState("missing_volume")
View Source
const (
	VolumeStateUnknown        = VolumeState("unknown")
	VolumeStateOnline         = VolumeState("online")
	VolumeStateDeleting       = VolumeState("deleting")
	VolumeStateUpgrading      = VolumeState("upgrading")
	VolumeStateMissingBackend = VolumeState("missing_backend")
View Source
const SnapshotNameFormat = "20060102T150405Z"
View Source
const SnapshotTimestampFormat = "2006-01-02T15:04:05Z"


This section is empty.


func MakeSnapshotID

func MakeSnapshotID(volumeName, snapshotName string) string

func ParseSnapshotID

func ParseSnapshotID(snapshotID string) (string, string, error)


type Backend

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

func NewFailedStorageBackend

func NewFailedStorageBackend(driver Driver) *Backend

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, volAttributes map[string]sa.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) CreateSnapshot

func (b *Backend) CreateSnapshot(snapConfig *SnapshotConfig, volConfig *VolumeConfig) (*Snapshot, error)

func (*Backend) DeleteSnapshot

func (b *Backend) DeleteSnapshot(snapConfig *SnapshotConfig, volConfig *VolumeConfig) error

func (*Backend) GetDriverName

func (b *Backend) GetDriverName() string

func (*Backend) GetProtocol

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

func (*Backend) GetSnapshot

func (b *Backend) GetSnapshot(snapConfig *SnapshotConfig) (*Snapshot, error)

func (*Backend) GetSnapshots

func (b *Backend) GetSnapshots(volConfig *VolumeConfig) ([]*Snapshot, error)

func (*Backend) GetUpdateType

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

func (*Backend) GetVolumeExternal

func (b *Backend) GetVolumeExternal(volumeName string) (*VolumeExternal, error)

func (*Backend) HasVolumes

func (b *Backend) HasVolumes() bool

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

    func (*Backend) ImportVolume

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

    func (*Backend) RemoveCachedVolume

    func (b *Backend) RemoveCachedVolume(volumeName string)

    func (*Backend) RemoveVolume

    func (b *Backend) RemoveVolume(volConfig *VolumeConfig) error

    func (*Backend) RenameVolume

    func (b *Backend) RenameVolume(volConfig *VolumeConfig, newName string) error

    func (*Backend) ResizeVolume

    func (b *Backend) ResizeVolume(volConfig *VolumeConfig, newSize string) error

    func (*Backend) RestoreSnapshot

    func (b *Backend) RestoreSnapshot(snapConfig *SnapshotConfig, volConfig *VolumeConfig) 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"`
      	BackendUUID string                 `json:"backendUUID"`
      	Protocol    tridentconfig.Protocol `json:"protocol"`
      	Config      interface{}            `json:"config"`
      	Storage     map[string]interface{} `json:"storage"`
      	State       BackendState           `json:"state"`
      	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"`
      	BackendUUID string                         `json:"backendUUID"`
      	Online      bool                           `json:"online"`
      	State       BackendState                   `json:"state"`

      func (*BackendPersistent) ExtractBackendSecrets

      func (p *BackendPersistent) ExtractBackendSecrets(secretName string) (*BackendPersistent, map[string]string, error)

        ExtractBackendSecrets clones itself (a BackendPersistent struct), builds a map of any secret data it contains (credentials, etc.), clears those fields in the clone, and returns the clone and the map.

        func (*BackendPersistent) InjectBackendSecrets

        func (p *BackendPersistent) InjectBackendSecrets(secretMap map[string]string) error

        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 BackendState

          type BackendState string

          func (BackendState) IsDeleting

          func (s BackendState) IsDeleting() bool

          func (BackendState) IsFailed

          func (s BackendState) IsFailed() bool

          func (BackendState) IsOffline

          func (s BackendState) IsOffline() bool

          func (BackendState) IsOnline

          func (s BackendState) IsOnline() bool

          func (BackendState) IsUnknown

          func (s BackendState) IsUnknown() bool

          func (BackendState) String

          func (s BackendState) String() string

          type ByVolumeExternalName

          type ByVolumeExternalName []*VolumeExternal

          func (ByVolumeExternalName) Len

          func (a ByVolumeExternalName) Len() int

          func (ByVolumeExternalName) Less

          func (a ByVolumeExternalName) Less(i, j int) bool

          func (ByVolumeExternalName) Swap

          func (a ByVolumeExternalName) Swap(i, j int)

          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.
          	Create(volConfig *VolumeConfig, storagePool *Pool, volAttributes map[string]sa.Request) error
          	CreatePrepare(volConfig *VolumeConfig) error
          	// 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.
          	CreateClone(volConfig *VolumeConfig) error
          	Import(volConfig *VolumeConfig, originalName string) error
          	Destroy(name string) error
          	Rename(name string, newName string) error
          	Resize(volConfig *VolumeConfig, sizeBytes uint64) error
          	Get(name string) error
          	GetInternalVolumeName(name string) string
          	GetStorageBackendSpecs(backend *Backend) error
          	GetProtocol() tridentconfig.Protocol
          	Publish(name string, publishInfo *utils.VolumePublishInfo) error
          	GetSnapshot(snapConfig *SnapshotConfig) (*Snapshot, error)
          	GetSnapshots(volConfig *VolumeConfig) ([]*Snapshot, error)
          	CreateSnapshot(snapConfig *SnapshotConfig) (*Snapshot, error)
          	RestoreSnapshot(snapConfig *SnapshotConfig) error
          	DeleteSnapshot(snapConfig *SnapshotConfig) error
          	StoreConfig(b *PersistentStorageBackendConfig)
          	// GetExternalConfig returns a version of the driver configuration that
          	// lacks confidential information, such as usernames and passwords.
          	GetExternalConfig() interface{}
          	// GetVolumeExternal accepts the internal name of a volume and returns a VolumeExternal
          	// object.  This method is only available if using the passthrough store (i.e. Docker).
          	GetVolumeExternal(name string) (*VolumeExternal, error)
          	// GetVolumeExternalWrappers reads all volumes owned by this driver from the storage backend and
          	// writes them to the supplied channel as VolumeExternalWrapper objects.  This method is only
          	// available if using the passthrough store (i.e. Docker).
          	GetVolumeExternalWrappers(chan *VolumeExternalWrapper)
          	GetUpdateType(driver Driver) *roaring.Bitmap

            Driver provides a common interface for storage related operations

            type ImportVolumeRequest

            type ImportVolumeRequest struct {
            	Backend      string `json:"backend"`
            	InternalName string `json:"internalName"`
            	NoManage     bool   `json:"noManage"`
            	PVCData      string `json:"pvcData"` // Opaque, base64-encoded

            func (*ImportVolumeRequest) Validate

            func (r *ImportVolumeRequest) Validate() error

            type NotManagedError

            type NotManagedError struct {
            	// contains filtered or unexported fields

            func (*NotManagedError) Error

            func (e *NotManagedError) Error() string

            type PVUpgradeConfig

            type PVUpgradeConfig struct {
            	PVCConfig       *v1.PersistentVolumeClaim `json:"pvcConfig,omitempty"`
            	PVConfig        *v1.PersistentVolume      `json:"pvConfig,omitempty"`
            	OwnedPodsForPVC []string                  `json:"ownedPodsForPVC,omitempty"`

            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"`
            	AWSConfig               *drivers.AWSNFSStorageDriverConfig    `json:"aws_config,omitempty"`
            	AzureConfig             *drivers.AzureNFSStorageDriverConfig  `json:"azure_config,omitempty"`
            	GCPConfig               *drivers.GCPNFSStorageDriverConfig    `json:"gcp_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 // These attributes are used to match storage classes
            	InternalAttributes map[string]string   // These attributes are defined & used internally by storage drivers

            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 {
            	Config    *SnapshotConfig
            	Created   string `json:"dateCreated"` // The UTC time that the snapshot was created, in RFC3339 format
            	SizeBytes int64  `json:"size"`        // The size of the volume at the time the snapshot was created
            	State     SnapshotState

            func NewSnapshot

            func NewSnapshot(config *SnapshotConfig, created string, sizeBytes int64) *Snapshot

            func (*Snapshot) ConstructClone

            func (s *Snapshot) ConstructClone() *Snapshot

            func (*Snapshot) ConstructExternal

            func (s *Snapshot) ConstructExternal() *SnapshotExternal

            func (*Snapshot) ConstructPersistent

            func (s *Snapshot) ConstructPersistent() *SnapshotPersistent

            func (*Snapshot) ID

            func (s *Snapshot) ID() string

            type SnapshotConfig

            type SnapshotConfig struct {
            	Version            string `json:"version,omitempty"`
            	Name               string `json:"name,omitempty"`
            	InternalName       string `json:"internalName,omitempty"`
            	VolumeName         string `json:"volumeName,omitempty"`
            	VolumeInternalName string `json:"volumeInternalName,omitempty"`

            func (*SnapshotConfig) ID

            func (c *SnapshotConfig) ID() string

            func (*SnapshotConfig) Validate

            func (c *SnapshotConfig) Validate() error

            type SnapshotExternal

            type SnapshotExternal struct {

            func (*SnapshotExternal) ID

            func (s *SnapshotExternal) ID() string

            type SnapshotPersistent

            type SnapshotPersistent struct {

            func (*SnapshotPersistent) ConstructExternal

            func (s *SnapshotPersistent) ConstructExternal() *SnapshotExternal

            type SnapshotState

            type SnapshotState string

            func (SnapshotState) IsMissingBackend

            func (s SnapshotState) IsMissingBackend() bool

            func (SnapshotState) IsMissingVolume

            func (s SnapshotState) IsMissingVolume() bool

            func (SnapshotState) IsOnline

            func (s SnapshotState) IsOnline() bool

            type UpdateBackendStateRequest

            type UpdateBackendStateRequest struct {
            	State string `json:"state"`

            type UpgradeVolumeRequest

            type UpgradeVolumeRequest struct {
            	Type   string `json:"type"`
            	Volume string `json:"volume"`

            func (*UpgradeVolumeRequest) Validate

            func (r *UpgradeVolumeRequest) Validate() error

            type Volume

            type Volume struct {
            	Config      *VolumeConfig
            	BackendUUID string // UUID 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
            	State       VolumeState

            func NewVolume

            func NewVolume(conf *VolumeConfig, backendUUID 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"`
            	VolumeMode                config.VolumeMode      `json:"volumeMode,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"`
            	ServiceLevel              string                 `json:"serviceLevel,omitempty"`
            	Network                   string                 `json:"network,omitempty"`
            	ImportOriginalName        string                 `json:"importOriginalName,omitempty"`
            	ImportBackendUUID         string                 `json:"importBackendUUID,omitempty"`
            	ImportNotManaged          bool                   `json:"importNotManaged,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"`     // replaced w/ backendUUID, remains to read old records
            	BackendUUID string      `json:"backendUUID"` // UUID of the storage backend
            	Pool        string      `json:"pool"`
            	Orphaned    bool        `json:"orphaned"`
            	State       VolumeState `json:"state"`

            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

              type VolumeOperation

              type VolumeOperation string
              const (
              	AddVolume      VolumeOperation = "addVolume"
              	DeleteVolume   VolumeOperation = "deleteVolume"
              	ImportVolume   VolumeOperation = "importVolume"
              	ResizeVolume   VolumeOperation = "resizeVolume"
              	UpgradeVolume  VolumeOperation = "upgradeVolume"
              	AddSnapshot    VolumeOperation = "addSnapshot"
              	DeleteSnapshot VolumeOperation = "deleteSnapshot"

              type VolumeState

              type VolumeState string

              func (VolumeState) IsDeleting

              func (s VolumeState) IsDeleting() bool

              func (VolumeState) IsMissingBackend

              func (s VolumeState) IsMissingBackend() bool

              func (VolumeState) IsOnline

              func (s VolumeState) IsOnline() bool

              func (VolumeState) IsUnknown

              func (s VolumeState) IsUnknown() bool

              func (VolumeState) String

              func (s VolumeState) String() string

              type VolumeTransaction

              type VolumeTransaction struct {
              	Config          *VolumeConfig
              	SnapshotConfig  *SnapshotConfig
              	PVUpgradeConfig *PVUpgradeConfig
              	Op              VolumeOperation

              func (*VolumeTransaction) Name

              func (t *VolumeTransaction) Name() string

                Name returns a unique identifier for the VolumeTransaction. Volume transactions should only be identified by their name, while snapshot transactions should be identified by their name as well as their volume name. It's possible that some situations will leave a delete transaction dangling; an add transaction should overwrite this.


                Path Synopsis