storage

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unknown  = BackendState("unknown")
	Online   = BackendState("online")
	Offline  = BackendState("offline")
	Deleting = BackendState("deleting")
	Failed   = BackendState("failed")
)
View Source
const (
	BackendRename = iota
	VolumeAccessInfoChange
	InvalidUpdate
	UsernameChange
	PasswordChange
	PrefixChange
	CredentialsChange
)
View Source
const (
	SnapshotTimestampFormat = "2006-01-02T15:04:05Z"
	SnapshotNameFormat      = "20060102T150405Z"
)
View Source
const (
	SnapshotStateCreating       = SnapshotState("creating")  // Request accepted, data upload not started
	SnapshotStateUploading      = SnapshotState("uploading") // Snapshot cut, being uploaded, not ready for use
	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")
	VolumeStateSubordinate    = VolumeState("subordinate")
)
View Source
const ProvisioningLabelTag = "provisioning"

TODO: Try moving all ProvisioningLabelTag related code here

Variables

This section is empty.

Functions

func AllowPoolLabelOverwrite

func AllowPoolLabelOverwrite(key, originalLabel string) bool

AllowLabelOverwrite returns true if it has a key we could have set. For example: {"provisioning":{"cloud":"anf","clusterName":"dev-test-cluster-1"}}

func DeleteProvisioningLabels

func DeleteProvisioningLabels(volumeLabels []string) []string

deleteProvisioningLabels returns the volume labels with the provisioning label deleted

func IsStoragePoolUnset

func IsStoragePoolUnset(storagePool Pool) bool

func MakeSnapshotID

func MakeSnapshotID(volumeName, snapshotName string) string

func ParseSnapshotID

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

func UpdateProvisioningLabels

func UpdateProvisioningLabels(provisioningLabel string, volumeLabels []string) []string

updateProvisioningLabels returns the volume labels with an updated provisioning label provided Note:- Currently not used. Will be used for update storagevolume labels

Types

type Backend

type Backend interface {
	Driver() Driver
	SetDriver(Driver Driver)
	Name() string
	SetName(Name string)
	BackendUUID() string
	SetBackendUUID(BackendUUID string)
	Online() bool
	SetOnline(Online bool)
	State() BackendState
	SetState(State BackendState)
	Storage() map[string]Pool
	SetStorage(Storage map[string]Pool)
	Volumes() map[string]*Volume
	SetVolumes(Volumes map[string]*Volume)
	ConfigRef() string
	SetConfigRef(ConfigRef string)
	AddStoragePool(pool Pool)
	GetPhysicalPoolNames(ctx context.Context) []string
	GetDriverName() string
	GetProtocol(ctx context.Context) config.Protocol
	IsCredentialsFieldSet(ctx context.Context) bool
	AddVolume(
		ctx context.Context, volConfig *VolumeConfig, storagePool Pool,
		volAttributes map[string]storageattribute.Request, retry bool,
	) (*Volume, error)
	GetDebugTraceFlags(ctx context.Context) map[string]bool
	CloneVolume(
		ctx context.Context, sourceVolConfig, cloneVolConfig *VolumeConfig, storagePool Pool, retry bool,
	) (*Volume, error)
	PublishVolume(
		ctx context.Context, volConfig *VolumeConfig, publishInfo *utils.VolumePublishInfo,
	) error
	UnpublishVolume(ctx context.Context, volConfig *VolumeConfig, publishInfo *utils.VolumePublishInfo) error
	GetVolumeExternal(ctx context.Context, volumeName string) (*VolumeExternal, error)
	ImportVolume(ctx context.Context, volConfig *VolumeConfig) (*Volume, error)
	ResizeVolume(ctx context.Context, volConfig *VolumeConfig, newSize string) error
	RenameVolume(ctx context.Context, volConfig *VolumeConfig, newName string) error
	RemoveVolume(ctx context.Context, volConfig *VolumeConfig) error
	RemoveCachedVolume(volumeName string)
	CanSnapshot(ctx context.Context, snapConfig *SnapshotConfig, volConfig *VolumeConfig) error
	GetSnapshot(ctx context.Context, snapConfig *SnapshotConfig, volConfig *VolumeConfig) (*Snapshot, error)
	GetSnapshots(ctx context.Context, volConfig *VolumeConfig) ([]*Snapshot, error)
	CreateSnapshot(ctx context.Context, snapConfig *SnapshotConfig, volConfig *VolumeConfig) (*Snapshot, error)
	RestoreSnapshot(ctx context.Context, snapConfig *SnapshotConfig, volConfig *VolumeConfig) error
	DeleteSnapshot(ctx context.Context, snapConfig *SnapshotConfig, volConfig *VolumeConfig) error
	GetUpdateType(ctx context.Context, origBackend Backend) *roaring.Bitmap
	HasVolumes() bool
	Terminate(ctx context.Context)
	InvalidateNodeAccess()
	ReconcileNodeAccess(ctx context.Context, nodes []*utils.Node) error
	ConstructExternal(ctx context.Context) *BackendExternal
	ConstructPersistent(ctx context.Context) *BackendPersistent
	CanMirror() bool
	ChapEnabled
	PublishEnforceable
}

func NewFailedStorageBackend

func NewFailedStorageBackend(ctx context.Context, driver Driver) Backend

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"`
	ConfigRef   string                 `json:"configRef"`
}

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"`
	ConfigRef   string                         `json:"configRef"`
}

func (*BackendPersistent) ExtractBackendSecrets

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

ExtractBackendSecrets clones itself (a BackendPersistent struct), identified if the backend is using trident created secret (tbe-<backendUUID>) or user-provided secret (via credentials field), if these valus are same or not and accordingly sets usingTridentSecretName boolean field. From the clone it builds a map of secret data it contains (username, password, etc.), replaces those fields with the correct secret name, and returns the clone, the secret data map (or empty map if using credentials field) and usingTridentSecretName field.

func (*BackendPersistent) GetBackendCredentials

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

GetBackendCredentials identifies the storage driver and returns the credentials field name and type (if set)

func (*BackendPersistent) InjectBackendSecrets

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

func (*BackendPersistent) MarshalConfig

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

MarshalConfig returns a persistent backend config as JSON. 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 BySnapshotExternalID

type BySnapshotExternalID []*SnapshotExternal

func (BySnapshotExternalID) Len

func (a BySnapshotExternalID) Len() int

func (BySnapshotExternalID) Less

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

func (BySnapshotExternalID) Swap

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

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 ChapEnabled

type ChapEnabled interface {
	GetChapInfo(ctx context.Context, volumeName, nodeName string) (*utils.IscsiChapInfo, error)
}

type Driver

type Driver interface {
	Name() string
	BackendName() string
	Initialize(
		context.Context, tridentconfig.DriverContext, string, *drivers.CommonStorageDriverConfig,
		map[string]string, string,
	) error
	Initialized() bool
	// Terminate tells the driver to clean up, as it won't be called again.
	Terminate(ctx context.Context, backendUUID string)
	Create(ctx context.Context, volConfig *VolumeConfig, storagePool Pool, volAttributes map[string]sa.Request) error
	CreatePrepare(ctx context.Context, volConfig *VolumeConfig)
	// CreateFollowup adds necessary information for accessing the volume to VolumeConfig.
	CreateFollowup(ctx context.Context, volConfig *VolumeConfig) error
	CreateClone(ctx context.Context, sourceVolConfig, cloneVolConfig *VolumeConfig, storagePool Pool) error
	Import(ctx context.Context, volConfig *VolumeConfig, originalName string) error
	Destroy(ctx context.Context, volConfig *VolumeConfig) error
	Rename(ctx context.Context, name, newName string) error
	Resize(ctx context.Context, volConfig *VolumeConfig, sizeBytes uint64) error
	Get(ctx context.Context, name string) error
	GetInternalVolumeName(ctx context.Context, name string) string
	GetStorageBackendSpecs(ctx context.Context, backend Backend) error
	GetStorageBackendPhysicalPoolNames(ctx context.Context) []string
	GetProtocol(ctx context.Context) tridentconfig.Protocol
	Publish(ctx context.Context, volConfig *VolumeConfig, publishInfo *utils.VolumePublishInfo) error
	CanSnapshot(ctx context.Context, snapConfig *SnapshotConfig, volConfig *VolumeConfig) error
	GetSnapshot(ctx context.Context, snapConfig *SnapshotConfig, volConfig *VolumeConfig) (*Snapshot, error)
	GetSnapshots(ctx context.Context, volConfig *VolumeConfig) ([]*Snapshot, error)
	CreateSnapshot(ctx context.Context, snapConfig *SnapshotConfig, volConfig *VolumeConfig) (*Snapshot, error)
	RestoreSnapshot(ctx context.Context, snapConfig *SnapshotConfig, volConfig *VolumeConfig) error
	DeleteSnapshot(ctx context.Context, snapConfig *SnapshotConfig, volConfig *VolumeConfig) error
	StoreConfig(ctx context.Context, b *PersistentStorageBackendConfig)
	// GetExternalConfig returns a version of the driver configuration that
	// lacks confidential information, such as usernames and passwords.
	GetExternalConfig(ctx context.Context) 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(ctx context.Context, 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(context.Context, chan *VolumeExternalWrapper)
	GetUpdateType(ctx context.Context, driver Driver) *roaring.Bitmap
	ReconcileNodeAccess(ctx context.Context, nodes []*utils.Node, backendUUID string) error
	GetCommonConfig(context.Context) *drivers.CommonStorageDriverConfig
}

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 Mirrorer

type Mirrorer interface {
	EstablishMirror(
		ctx context.Context, localVolumeHandle, remoteVolumeHandle, replicationPolicy,
		replicationSchedule string,
	) error
	ReestablishMirror(
		ctx context.Context, localVolumeHandle, remoteVolumeHandle, replicationPolicy,
		replicationSchedule string,
	) error
	PromoteMirror(ctx context.Context, localVolumeHandle, remoteVolumeHandle, snapshotName string) (bool, error)
	GetMirrorStatus(ctx context.Context, localVolumeHandle, remoteVolumeHandle string) (string, error)
	ReleaseMirror(ctx context.Context, localVolumeHandle string) error
	GetReplicationDetails(ctx context.Context, localVolumeHandle, remoteVolumeHandle string) (string, string, error)
}

Mirrorer provides a common interface for backends that support mirror replication

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"`
	AzureConfig             *drivers.AzureNASStorageDriverConfig  `json:"azure_config,omitempty"`
	GCPConfig               *drivers.GCPNFSStorageDriverConfig    `json:"gcp_config,omitempty"`
	FakeStorageDriverConfig *drivers.FakeStorageDriverConfig      `json:"fake_config,omitempty"`
}

func (*PersistentStorageBackendConfig) GetDriverConfig

func (psbc *PersistentStorageBackendConfig) GetDriverConfig() (drivers.DriverConfig, error)

type Pool

type Pool interface {
	Name() string
	SetName(name string)
	StorageClasses() []string
	SetStorageClasses(storageClasses []string)
	Backend() Backend
	SetBackend(backend Backend)
	Attributes() map[string]storageattribute.Offer
	SetAttributes(attributes map[string]storageattribute.Offer)
	InternalAttributes() map[string]string
	SetInternalAttributes(internalAttributes map[string]string)
	SupportedTopologies() []map[string]string
	SetSupportedTopologies(supportedTopologies []map[string]string)
	AddStorageClass(class string)
	RemoveStorageClass(class string) bool
	ConstructExternal() *PoolExternal
	GetLabelsJSON(ctx context.Context, key string, labelLimit int) (string, error)
	GetLabels(ctx context.Context, prefix string) map[string]string
}

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"`
	SupportedTopologies []map[string]string `json:"supportedTopologies"`
}

type PublishEnforceable

type PublishEnforceable interface {
	EnablePublishEnforcement(ctx context.Context, volume *Volume) error
}

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 `json:"state"`
}

func NewSnapshot

func NewSnapshot(config *SnapshotConfig, created string, sizeBytes int64, state SnapshotState) *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 {
	Snapshot
}

func (*SnapshotExternal) ID

func (s *SnapshotExternal) ID() string

type SnapshotPersistent

type SnapshotPersistent struct {
	Snapshot
}

func (*SnapshotPersistent) ConstructExternal

func (s *SnapshotPersistent) ConstructExternal() *SnapshotExternal

type SnapshotState

type SnapshotState string

func (SnapshotState) IsCreating

func (s SnapshotState) IsCreating() bool

func (SnapshotState) IsMissingBackend

func (s SnapshotState) IsMissingBackend() bool

func (SnapshotState) IsMissingVolume

func (s SnapshotState) IsMissingVolume() bool

func (SnapshotState) IsOnline

func (s SnapshotState) IsOnline() bool

func (SnapshotState) IsUploading

func (s SnapshotState) IsUploading() bool

type StorageBackend

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

func NewStorageBackend

func NewStorageBackend(ctx context.Context, driver Driver) (*StorageBackend, error)

func (*StorageBackend) AddStoragePool

func (b *StorageBackend) AddStoragePool(pool Pool)

func (*StorageBackend) AddVolume

func (b *StorageBackend) AddVolume(
	ctx context.Context, volConfig *VolumeConfig, storagePool Pool, volAttributes map[string]sa.Request, retry bool,
) (*Volume, error)

func (*StorageBackend) BackendUUID

func (b *StorageBackend) BackendUUID() string

func (*StorageBackend) CanMirror

func (b *StorageBackend) CanMirror() bool

func (*StorageBackend) CanSnapshot

func (b *StorageBackend) CanSnapshot(ctx context.Context, snapConfig *SnapshotConfig, volConfig *VolumeConfig) error

CanSnapshot determines whether a snapshot as specified in the provided snapshot config may be taken.

func (*StorageBackend) CloneVolume

func (b *StorageBackend) CloneVolume(
	ctx context.Context, sourceVolConfig, cloneVolConfig *VolumeConfig, storagePool Pool, retry bool,
) (*Volume, error)

func (*StorageBackend) ConfigRef

func (b *StorageBackend) ConfigRef() string

func (*StorageBackend) ConstructExternal

func (b *StorageBackend) ConstructExternal(ctx context.Context) *BackendExternal

func (*StorageBackend) ConstructPersistent

func (b *StorageBackend) ConstructPersistent(ctx context.Context) *BackendPersistent

func (*StorageBackend) CreateSnapshot

func (b *StorageBackend) CreateSnapshot(
	ctx context.Context, snapConfig *SnapshotConfig, volConfig *VolumeConfig,
) (*Snapshot, error)

func (*StorageBackend) DeleteSnapshot

func (b *StorageBackend) DeleteSnapshot(
	ctx context.Context, snapConfig *SnapshotConfig, volConfig *VolumeConfig,
) error

func (*StorageBackend) Driver

func (b *StorageBackend) Driver() Driver

func (*StorageBackend) EnablePublishEnforcement

func (b *StorageBackend) EnablePublishEnforcement(ctx context.Context, volume *Volume) error

func (*StorageBackend) EstablishMirror

func (b *StorageBackend) EstablishMirror(
	ctx context.Context, localVolumeHandle, remoteVolumeHandle, replicationPolicy,
	replicationSchedule string,
) error

func (*StorageBackend) GetChapInfo

func (b *StorageBackend) GetChapInfo(ctx context.Context, volumeName, nodeName string) (*utils.IscsiChapInfo, error)

func (*StorageBackend) GetDebugTraceFlags

func (b *StorageBackend) GetDebugTraceFlags(ctx context.Context) map[string]bool

func (*StorageBackend) GetDriverName

func (b *StorageBackend) GetDriverName() string

func (*StorageBackend) GetMirrorStatus

func (b *StorageBackend) GetMirrorStatus(
	ctx context.Context, localVolumeHandle, remoteVolumeHandle string,
) (string, error)

func (*StorageBackend) GetPhysicalPoolNames

func (b *StorageBackend) GetPhysicalPoolNames(ctx context.Context) []string

func (*StorageBackend) GetProtocol

func (b *StorageBackend) GetProtocol(ctx context.Context) tridentconfig.Protocol

func (*StorageBackend) GetReplicationDetails

func (b *StorageBackend) GetReplicationDetails(
	ctx context.Context, localVolumeHandle, remoteVolumeHandle string,
) (string, string, error)

func (*StorageBackend) GetSnapshot

func (b *StorageBackend) GetSnapshot(
	ctx context.Context, snapConfig *SnapshotConfig, volConfig *VolumeConfig,
) (*Snapshot, error)

func (*StorageBackend) GetSnapshots

func (b *StorageBackend) GetSnapshots(ctx context.Context, volConfig *VolumeConfig) ([]*Snapshot, error)

func (*StorageBackend) GetUpdateType

func (b *StorageBackend) GetUpdateType(ctx context.Context, origBackend Backend) *roaring.Bitmap

func (*StorageBackend) GetVolumeExternal

func (b *StorageBackend) GetVolumeExternal(ctx context.Context, volumeName string) (*VolumeExternal, error)

func (*StorageBackend) HasVolumes

func (b *StorageBackend) HasVolumes() bool

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

func (*StorageBackend) ImportVolume

func (b *StorageBackend) ImportVolume(ctx context.Context, volConfig *VolumeConfig) (*Volume, error)

func (*StorageBackend) InvalidateNodeAccess

func (b *StorageBackend) InvalidateNodeAccess()

InvalidateNodeAccess marks the backend as needing the node access rule reconciled

func (*StorageBackend) IsCredentialsFieldSet

func (b *StorageBackend) IsCredentialsFieldSet(ctx context.Context) bool

func (*StorageBackend) Name

func (b *StorageBackend) Name() string

func (*StorageBackend) Online

func (b *StorageBackend) Online() bool

func (*StorageBackend) PromoteMirror

func (b *StorageBackend) PromoteMirror(
	ctx context.Context, localVolumeHandle, remoteVolumeHandle, snapshotHandle string,
) (bool, error)

func (*StorageBackend) PublishVolume

func (b *StorageBackend) PublishVolume(
	ctx context.Context, volConfig *VolumeConfig, publishInfo *utils.VolumePublishInfo,
) error

func (*StorageBackend) ReconcileNodeAccess

func (b *StorageBackend) ReconcileNodeAccess(ctx context.Context, nodes []*utils.Node) error

ReconcileNodeAccess will ensure that the driver only has allowed access to its volumes from active nodes in the k8s cluster. This is usually handled via export policies or initiators

func (*StorageBackend) ReestablishMirror

func (b *StorageBackend) ReestablishMirror(
	ctx context.Context, localVolumeHandle, remoteVolumeHandle,
	replicationPolicy, replicationSchedule string,
) error

func (*StorageBackend) ReleaseMirror

func (b *StorageBackend) ReleaseMirror(ctx context.Context, localVolumeHandle string) error

func (*StorageBackend) RemoveCachedVolume

func (b *StorageBackend) RemoveCachedVolume(volumeName string)

func (*StorageBackend) RemoveVolume

func (b *StorageBackend) RemoveVolume(ctx context.Context, volConfig *VolumeConfig) error

func (*StorageBackend) RenameVolume

func (b *StorageBackend) RenameVolume(ctx context.Context, volConfig *VolumeConfig, newName string) error

func (*StorageBackend) ResizeVolume

func (b *StorageBackend) ResizeVolume(ctx context.Context, volConfig *VolumeConfig, newSize string) error

func (*StorageBackend) RestoreSnapshot

func (b *StorageBackend) RestoreSnapshot(
	ctx context.Context, snapConfig *SnapshotConfig, volConfig *VolumeConfig,
) error

func (*StorageBackend) SetBackendUUID

func (b *StorageBackend) SetBackendUUID(BackendUUID string)

func (*StorageBackend) SetConfigRef

func (b *StorageBackend) SetConfigRef(ConfigRef string)

func (*StorageBackend) SetDriver

func (b *StorageBackend) SetDriver(Driver Driver)

func (*StorageBackend) SetName

func (b *StorageBackend) SetName(Name string)

func (*StorageBackend) SetOnline

func (b *StorageBackend) SetOnline(Online bool)

func (*StorageBackend) SetState

func (b *StorageBackend) SetState(State BackendState)

func (*StorageBackend) SetStorage

func (b *StorageBackend) SetStorage(Storage map[string]Pool)

func (*StorageBackend) SetVolumes

func (b *StorageBackend) SetVolumes(Volumes map[string]*Volume)

func (*StorageBackend) State

func (b *StorageBackend) State() BackendState

func (*StorageBackend) Storage

func (b *StorageBackend) Storage() map[string]Pool

func (*StorageBackend) Terminate

func (b *StorageBackend) Terminate(ctx context.Context)

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.

func (*StorageBackend) UnpublishVolume

func (b *StorageBackend) UnpublishVolume(
	ctx context.Context, volConfig *VolumeConfig, publishInfo *utils.VolumePublishInfo,
) error

func (*StorageBackend) Volumes

func (b *StorageBackend) Volumes() map[string]*Volume

type StoragePool

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

func NewStoragePool

func NewStoragePool(backend Backend, name string) *StoragePool

func (*StoragePool) AddStorageClass

func (p *StoragePool) AddStorageClass(class string)

func (*StoragePool) Attributes

func (p *StoragePool) Attributes() map[string]sa.Offer

func (*StoragePool) Backend

func (p *StoragePool) Backend() Backend

func (*StoragePool) ConstructExternal

func (p *StoragePool) ConstructExternal() *PoolExternal

func (*StoragePool) GetLabels

func (p *StoragePool) GetLabels(_ context.Context, prefix string) map[string]string

GetLabels returns a map containing the labels on this pool, suitable for individual metadata key/value pairs set on a storage volume. Each key may be customized with a common prefix, unless it already has a prefix as detected by the presence of a slash. For example: {"prefix/cloud":"anf", "prefix/clusterName":"dev-test-cluster-1", "otherPrefix/tier":"hot"}

func (*StoragePool) GetLabelsJSON

func (p *StoragePool) GetLabelsJSON(ctx context.Context, key string, labelLimit int) (string, error)

GetLabelsJSON returns a JSON-formatted string containing the labels on this pool, suitable for a label set on a storage volume. The outer key may be customized. For example: {"provisioning":{"cloud":"anf","clusterName":"dev-test-cluster-1"}}

func (*StoragePool) InternalAttributes

func (p *StoragePool) InternalAttributes() map[string]string

func (*StoragePool) Name

func (p *StoragePool) Name() string

func (*StoragePool) RemoveStorageClass

func (p *StoragePool) RemoveStorageClass(class string) bool

func (*StoragePool) SetAttributes

func (p *StoragePool) SetAttributes(attributes map[string]sa.Offer)

func (*StoragePool) SetBackend

func (p *StoragePool) SetBackend(backend Backend)

func (*StoragePool) SetInternalAttributes

func (p *StoragePool) SetInternalAttributes(internalAttributes map[string]string)

func (*StoragePool) SetName

func (p *StoragePool) SetName(name string)

func (*StoragePool) SetStorageClasses

func (p *StoragePool) SetStorageClasses(storageClasses []string)

func (*StoragePool) SetSupportedTopologies

func (p *StoragePool) SetSupportedTopologies(supportedTopologies []map[string]string)

func (*StoragePool) StorageClasses

func (p *StoragePool) StorageClasses() []string

func (*StoragePool) SupportedTopologies

func (p *StoragePool) SupportedTopologies() []map[string]string

type Unpublisher

type Unpublisher interface {
	Unpublish(ctx context.Context, volConfig *VolumeConfig, publishInfo *utils.VolumePublishInfo) error
}

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, pool string, orphaned bool, state VolumeState) *Volume

func (*Volume) ConstructExternal

func (v *Volume) ConstructExternal() *VolumeExternal

func (*Volume) IsDeleting

func (v *Volume) IsDeleting() bool

func (*Volume) IsSubordinate

func (v *Volume) IsSubordinate() bool

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"`
	LUKSEncryption            string                 `json:"LUKSEncryption,omitempty"`
	CloneSourceVolume         string                 `json:"cloneSourceVolume"`
	CloneSourceVolumeInternal string                 `json:"cloneSourceVolumeInternal"`
	CloneSourceSnapshot       string                 `json:"cloneSourceSnapshot"`
	SplitOnClone              string                 `json:"splitOnClone"`
	QosPolicy                 string                 `json:"qosPolicy,omitempty"`
	AdaptiveQosPolicy         string                 `json:"adaptiveQosPolicy,omitempty"`
	Qos                       string                 `json:"qos,omitempty"`
	QosType                   string                 `json:"type,omitempty"`
	ServiceLevel              string                 `json:"serviceLevel,omitempty"`
	CVSStorageClass           string                 `json:"cvsStorageClass,omitempty"`
	Network                   string                 `json:"network,omitempty"`
	Zone                      string                 `json:"zone,omitempty"`
	ImportOriginalName        string                 `json:"importOriginalName,omitempty"`
	ImportBackendUUID         string                 `json:"importBackendUUID,omitempty"`
	ImportNotManaged          bool                   `json:"importNotManaged,omitempty"`
	MountOptions              string                 `json:"mountOptions,omitempty"`
	RequisiteTopologies       []map[string]string    `json:"requisiteTopologies,omitempty"`
	PreferredTopologies       []map[string]string    `json:"preferredTopologies,omitempty"`
	AllowedTopologies         []map[string]string    `json:"allowedTopologies,omitempty"`
	MirrorHandle              string                 `json:"mirrorHandle,omitempty"`
	// IsMirrorDestination is whether the volume is currently the destination in a mirror relationship
	IsMirrorDestination bool `json:"mirrorDestination,omitempty"`
	// PeerVolumeHandle is the internal volume handle for the source volume if this volume is a mirror destination
	PeerVolumeHandle string `json:"requiredPeerVolumeHandle,omitempty"`
	// InternalID is an optional, backend-specific identifier to help find an object
	InternalID         string                 `json:"internalID,omitempty"`
	ShareSourceVolume  string                 `json:"shareSourceVolume"`
	SubordinateVolumes map[string]interface{} `json:"-"`
}

func (*VolumeConfig) ConstructClone

func (c *VolumeConfig) ConstructClone() *VolumeConfig

func (*VolumeConfig) Validate

func (c *VolumeConfig) Validate() error

type VolumeCreatingConfig

type VolumeCreatingConfig struct {
	StartTime   time.Time `json:"startTime"`   // Time this create operation began
	BackendUUID string    `json:"backendUUID"` // UUID of the storage backend
	Pool        string    `json:"pool"`        // Name of the pool on which this volume was first provisioned
	VolumeConfig
}

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 (
	// Transactions for synchronous operations
	AddVolume      VolumeOperation = "addVolume"
	DeleteVolume   VolumeOperation = "deleteVolume"
	ImportVolume   VolumeOperation = "importVolume"
	ResizeVolume   VolumeOperation = "resizeVolume"
	UpgradeVolume  VolumeOperation = "upgradeVolume"
	AddSnapshot    VolumeOperation = "addSnapshot"
	DeleteSnapshot VolumeOperation = "deleteSnapshot"

	// Transactions for long-running operations
	VolumeCreating VolumeOperation = "volumeCreating"
)

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) IsSubordinate

func (s VolumeState) IsSubordinate() bool

func (VolumeState) IsUnknown

func (s VolumeState) IsUnknown() bool

func (VolumeState) String

func (s VolumeState) String() string

type VolumeTransaction

type VolumeTransaction struct {
	Config               *VolumeConfig
	VolumeCreatingConfig *VolumeCreatingConfig
	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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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