core

package
v0.0.2 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: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFakeInternalName

func GetFakeInternalName(name string) string

func IsBootstrapError

func IsBootstrapError(err error) bool

func IsFoundError

func IsFoundError(err error) bool

func IsNotFoundError

func IsNotFoundError(err error) bool

func IsNotReadyError

func IsNotReadyError(err error) bool

Types

type BootstrapError

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

func (*BootstrapError) Error

func (e *BootstrapError) Error() string

type FoundError

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

func (*FoundError) Error

func (e *FoundError) Error() string

type MockOrchestrator

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

MockOrchestrator is a struct that implements the Orchestrator interface for use in testing frontends. Although it retains the appearance of correct functionality for this purpose, all functions are effectively nops. Note: Many of the getter methods are copied verbatim from TridentOrchestrator, since their functionality is not inherently interesting or testable.

func NewMockOrchestrator

func NewMockOrchestrator() *MockOrchestrator

func (*MockOrchestrator) AddBackend

func (m *MockOrchestrator) AddBackend(configJSON string) (*storage.BackendExternal, error)

TODO: Add extra methods to add backends without needing to provide a valid, stringified JSON config.

func (*MockOrchestrator) AddFakeBackend

func (m *MockOrchestrator) AddFakeBackend(backend *storage.Backend) *storage.BackendExternal

func (*MockOrchestrator) AddFrontend

func (m *MockOrchestrator) AddFrontend(f frontend.Plugin)

func (*MockOrchestrator) AddMockFakeNASBackend

func (m *MockOrchestrator) AddMockFakeNASBackend(name string) *storage.BackendExternal

func (*MockOrchestrator) AddMockFakeSANBackend

func (m *MockOrchestrator) AddMockFakeSANBackend(name string) *storage.BackendExternal

func (*MockOrchestrator) AddMockONTAPNFSBackend

func (m *MockOrchestrator) AddMockONTAPNFSBackend(name, lif string) *storage.BackendExternal

func (*MockOrchestrator) AddMockONTAPSANBackend

func (m *MockOrchestrator) AddMockONTAPSANBackend(name, lif string) *storage.BackendExternal

func (*MockOrchestrator) AddNode

func (m *MockOrchestrator) AddNode(node *utils.Node) error

func (*MockOrchestrator) AddStorageClass

func (m *MockOrchestrator) AddStorageClass(
	scConfig *storageclass.Config,
) (*storageclass.External, error)

func (*MockOrchestrator) AddVolume

func (m *MockOrchestrator) AddVolume(volumeConfig *storage.VolumeConfig) (*storage.VolumeExternal, error)

func (*MockOrchestrator) AddVolumeTransaction

func (m *MockOrchestrator) AddVolumeTransaction(volTxn *storage.VolumeTransaction) error

func (*MockOrchestrator) AttachVolume

func (m *MockOrchestrator) AttachVolume(volumeName, mountpoint string, publishInfo *utils.VolumePublishInfo) error

func (*MockOrchestrator) Bootstrap

func (m *MockOrchestrator) Bootstrap() error

func (*MockOrchestrator) CloneVolume

func (m *MockOrchestrator) CloneVolume(volumeConfig *storage.VolumeConfig) (*storage.VolumeExternal, error)

func (*MockOrchestrator) CreateSnapshot

func (m *MockOrchestrator) CreateSnapshot(snapshotConfig *storage.SnapshotConfig) (*storage.SnapshotExternal, error)

func (*MockOrchestrator) DeleteBackend

func (m *MockOrchestrator) DeleteBackend(backend string) error

func (*MockOrchestrator) DeleteBackendByBackendUUID

func (m *MockOrchestrator) DeleteBackendByBackendUUID(backendName, backendUUID string) error

func (*MockOrchestrator) DeleteNode

func (m *MockOrchestrator) DeleteNode(nName string) error

func (*MockOrchestrator) DeleteSnapshot

func (m *MockOrchestrator) DeleteSnapshot(volumeName, snapshotName string) error

func (*MockOrchestrator) DeleteStorageClass

func (m *MockOrchestrator) DeleteStorageClass(scName string) error

func (*MockOrchestrator) DeleteVolume

func (m *MockOrchestrator) DeleteVolume(volumeName string) error

func (*MockOrchestrator) DeleteVolumeTransaction

func (m *MockOrchestrator) DeleteVolumeTransaction(volTxn *storage.VolumeTransaction) error

func (*MockOrchestrator) DetachVolume

func (m *MockOrchestrator) DetachVolume(volumeName, mountpoint string) error

func (*MockOrchestrator) GetBackend

func (m *MockOrchestrator) GetBackend(backendName string) (*storage.BackendExternal, error)

func (*MockOrchestrator) GetBackendByBackendUUID

func (m *MockOrchestrator) GetBackendByBackendUUID(backendUUID string) (*storage.BackendExternal, error)

func (*MockOrchestrator) GetDriverTypeForVolume

func (m *MockOrchestrator) GetDriverTypeForVolume(
	vol *storage.VolumeExternal,
) (string, error)

Copied verbatim from TridentOrchestrator

func (*MockOrchestrator) GetFrontend

func (m *MockOrchestrator) GetFrontend(name string) (frontend.Plugin, error)

func (*MockOrchestrator) GetNode

func (m *MockOrchestrator) GetNode(nName string) (*utils.Node, error)

func (*MockOrchestrator) GetSnapshot

func (m *MockOrchestrator) GetSnapshot(volumeName, snapshotName string) (*storage.SnapshotExternal, error)

func (*MockOrchestrator) GetStorageClass

func (m *MockOrchestrator) GetStorageClass(scName string) (*storageclass.External, error)

func (*MockOrchestrator) GetVersion

func (m *MockOrchestrator) GetVersion() (string, error)

func (*MockOrchestrator) GetVolume

func (m *MockOrchestrator) GetVolume(volume string) (*storage.VolumeExternal, error)

func (*MockOrchestrator) GetVolumeExternal

func (m *MockOrchestrator) GetVolumeExternal(volumeName string, backendName string) (*storage.VolumeExternal, error)

func (*MockOrchestrator) GetVolumeTransaction

func (m *MockOrchestrator) GetVolumeTransaction(volTxn *storage.VolumeTransaction) (*storage.VolumeTransaction, error)

func (*MockOrchestrator) GetVolumeType

func (m *MockOrchestrator) GetVolumeType(vol *storage.VolumeExternal) (config.VolumeType, error)

Copied verbatim from TridentOrchestrator

func (*MockOrchestrator) ImportVolume

func (m *MockOrchestrator) ImportVolume(
	volumeConfig *storage.VolumeConfig,
) (externalVol *storage.VolumeExternal, err error)

func (*MockOrchestrator) LegacyImportVolume

func (m *MockOrchestrator) LegacyImportVolume(
	volumeConfig *storage.VolumeConfig, backendName string, notManaged bool, createPVandPVC VolumeCallback,
) (externalVol *storage.VolumeExternal, err error)

func (*MockOrchestrator) ListBackends

func (m *MockOrchestrator) ListBackends() ([]*storage.BackendExternal, error)

func (*MockOrchestrator) ListNodes

func (m *MockOrchestrator) ListNodes() ([]*utils.Node, error)

func (*MockOrchestrator) ListSnapshots

func (m *MockOrchestrator) ListSnapshots() ([]*storage.SnapshotExternal, error)

func (*MockOrchestrator) ListSnapshotsByName

func (m *MockOrchestrator) ListSnapshotsByName(snapshotName string) ([]*storage.SnapshotExternal, error)

func (*MockOrchestrator) ListSnapshotsForVolume

func (m *MockOrchestrator) ListSnapshotsForVolume(volumeName string) ([]*storage.SnapshotExternal, error)

func (*MockOrchestrator) ListStorageClasses

func (m *MockOrchestrator) ListStorageClasses() ([]*storageclass.External, error)

func (*MockOrchestrator) ListVolumes

func (m *MockOrchestrator) ListVolumes() ([]*storage.VolumeExternal, error)

func (*MockOrchestrator) ListVolumesByPlugin

func (m *MockOrchestrator) ListVolumesByPlugin(pluginName string) ([]*storage.VolumeExternal, error)

func (*MockOrchestrator) PublishVolume

func (m *MockOrchestrator) PublishVolume(
	volumeName string, publishInfo *utils.VolumePublishInfo) error

func (*MockOrchestrator) ReadSnapshotsForVolume

func (m *MockOrchestrator) ReadSnapshotsForVolume(volumeName string) ([]*storage.SnapshotExternal, error)

func (*MockOrchestrator) ReloadVolumes

func (m *MockOrchestrator) ReloadVolumes() error

func (*MockOrchestrator) ResizeVolume

func (m *MockOrchestrator) ResizeVolume(volumeName, newSize string) error

func (*MockOrchestrator) SetVolumeState

func (m *MockOrchestrator) SetVolumeState(volumeName string, state storage.VolumeState) error

func (*MockOrchestrator) UpdateBackend

func (m *MockOrchestrator) UpdateBackend(backendName, configJSON string) (
	storageBackendExternal *storage.BackendExternal, err error)

UpdateBackend updates an existing backend

func (*MockOrchestrator) UpdateBackendByBackendUUID

func (m *MockOrchestrator) UpdateBackendByBackendUUID(backendName, configJSON, backendUUID string) (
	storageBackendExternal *storage.BackendExternal, err error)

UpdateBackendByBackendUUID updates an existing backend

func (*MockOrchestrator) UpdateBackendState

func (m *MockOrchestrator) UpdateBackendState(backendName, backendState string) (
	storageBackendExternal *storage.BackendExternal, err error)

UpdateBackendState updates an existing backend

func (*MockOrchestrator) ValidateVolumes

func (m *MockOrchestrator) ValidateVolumes(
	t *testing.T,
	expectedConfigs []*storage.VolumeConfig,
) bool

type NotFoundError

type NotFoundError struct {
	Message string
}

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type NotReadyError

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

func (*NotReadyError) Error

func (e *NotReadyError) Error() string

type Orchestrator

type Orchestrator interface {
	Bootstrap() error
	AddFrontend(f frontend.Plugin)
	GetFrontend(name string) (frontend.Plugin, error)
	GetVersion() (string, error)

	AddBackend(configJSON string) (*storage.BackendExternal, error)
	DeleteBackend(backend string) error
	DeleteBackendByBackendUUID(backendName, backendUUID string) error
	GetBackend(backend string) (*storage.BackendExternal, error)
	GetBackendByBackendUUID(backendUUID string) (*storage.BackendExternal, error)
	ListBackends() ([]*storage.BackendExternal, error)
	UpdateBackend(backendName, configJSON string) (storageBackendExternal *storage.BackendExternal, err error)
	UpdateBackendByBackendUUID(backendName, configJSON, backendUUID string) (storageBackendExternal *storage.BackendExternal, err error)
	UpdateBackendState(backendName, backendState string) (storageBackendExternal *storage.BackendExternal, err error)

	AddVolume(volumeConfig *storage.VolumeConfig) (*storage.VolumeExternal, error)
	AttachVolume(volumeName, mountpoint string, publishInfo *utils.VolumePublishInfo) error
	CloneVolume(volumeConfig *storage.VolumeConfig) (*storage.VolumeExternal, error)
	DetachVolume(volumeName, mountpoint string) error
	DeleteVolume(volume string) error
	GetVolume(volume string) (*storage.VolumeExternal, error)
	GetVolumeExternal(volumeName string, backendName string) (*storage.VolumeExternal, error)
	GetVolumeType(vol *storage.VolumeExternal) (config.VolumeType, error)
	LegacyImportVolume(volumeConfig *storage.VolumeConfig, backendName string, notManaged bool, createPVandPVC VolumeCallback) (*storage.VolumeExternal, error)
	ImportVolume(volumeConfig *storage.VolumeConfig) (*storage.VolumeExternal, error)
	ListVolumes() ([]*storage.VolumeExternal, error)
	ListVolumesByPlugin(pluginName string) ([]*storage.VolumeExternal, error)
	PublishVolume(volumeName string, publishInfo *utils.VolumePublishInfo) error
	ResizeVolume(volumeName, newSize string) error
	SetVolumeState(volumeName string, state storage.VolumeState) error

	CreateSnapshot(snapshotConfig *storage.SnapshotConfig) (*storage.SnapshotExternal, error)
	GetSnapshot(volumeName, snapshotName string) (*storage.SnapshotExternal, error)
	ListSnapshots() ([]*storage.SnapshotExternal, error)
	ListSnapshotsByName(snapshotName string) ([]*storage.SnapshotExternal, error)
	ListSnapshotsForVolume(volumeName string) ([]*storage.SnapshotExternal, error)
	ReadSnapshotsForVolume(volumeName string) ([]*storage.SnapshotExternal, error)
	DeleteSnapshot(volumeName, snapshotName string) error

	GetDriverTypeForVolume(vol *storage.VolumeExternal) (string, error)
	ReloadVolumes() error

	AddStorageClass(scConfig *storageclass.Config) (*storageclass.External, error)
	DeleteStorageClass(scName string) error
	GetStorageClass(scName string) (*storageclass.External, error)
	ListStorageClasses() ([]*storageclass.External, error)

	AddNode(node *utils.Node) error
	GetNode(nName string) (*utils.Node, error)
	ListNodes() ([]*utils.Node, error)
	DeleteNode(nName string) error

	AddVolumeTransaction(volTxn *storage.VolumeTransaction) error
	GetVolumeTransaction(volTxn *storage.VolumeTransaction) (*storage.VolumeTransaction, error)
	DeleteVolumeTransaction(volTxn *storage.VolumeTransaction) error
}

type TridentOrchestrator

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

func NewTridentOrchestrator

func NewTridentOrchestrator(client persistentstore.Client) *TridentOrchestrator

NewTridentOrchestrator returns a storage orchestrator instance

func (*TridentOrchestrator) AddBackend

func (o *TridentOrchestrator) AddBackend(configJSON string) (*storage.BackendExternal, error)

AddBackend handles creation of a new storage backend

func (*TridentOrchestrator) AddFrontend

func (o *TridentOrchestrator) AddFrontend(f frontend.Plugin)

func (*TridentOrchestrator) AddNode

func (o *TridentOrchestrator) AddNode(node *utils.Node) error

func (*TridentOrchestrator) AddStorageClass

func (o *TridentOrchestrator) AddStorageClass(scConfig *storageclass.Config) (*storageclass.External, error)

func (*TridentOrchestrator) AddVolume

func (o *TridentOrchestrator) AddVolume(volumeConfig *storage.VolumeConfig) (
	externalVol *storage.VolumeExternal, err error)

func (*TridentOrchestrator) AddVolumeTransaction

func (o *TridentOrchestrator) AddVolumeTransaction(volTxn *storage.VolumeTransaction) error

AddVolumeTransaction is called from the volume create, clone, and resize methods to save a record of the operation in case it fails and must be cleaned up later.

func (*TridentOrchestrator) AttachVolume

func (o *TridentOrchestrator) AttachVolume(
	volumeName, mountpoint string, publishInfo *utils.VolumePublishInfo,
) error

AttachVolume mounts a volume to the local host. This method is currently only used by Docker, and it should be able to accomplish its task using only the data passed in; it should not need to use the storage controller API. It may be assumed that this method always runs on the host to which the volume will be attached.

func (*TridentOrchestrator) Bootstrap

func (o *TridentOrchestrator) Bootstrap() error

func (*TridentOrchestrator) CloneVolume

func (o *TridentOrchestrator) CloneVolume(volumeConfig *storage.VolumeConfig) (
	externalVol *storage.VolumeExternal, err error)

func (*TridentOrchestrator) CreateSnapshot

func (o *TridentOrchestrator) CreateSnapshot(
	snapshotConfig *storage.SnapshotConfig,
) (externalSnapshot *storage.SnapshotExternal, err error)

CreateSnapshot creates a snapshot of the given volume

func (*TridentOrchestrator) DeleteBackend

func (o *TridentOrchestrator) DeleteBackend(backendName string) error

func (*TridentOrchestrator) DeleteBackendByBackendUUID

func (o *TridentOrchestrator) DeleteBackendByBackendUUID(backendName, backendUUID string) error

func (*TridentOrchestrator) DeleteNode

func (o *TridentOrchestrator) DeleteNode(nName string) error

func (*TridentOrchestrator) DeleteSnapshot

func (o *TridentOrchestrator) DeleteSnapshot(volumeName, snapshotName string) (err error)

DeleteSnapshot deletes a snapshot of the given volume

func (*TridentOrchestrator) DeleteStorageClass

func (o *TridentOrchestrator) DeleteStorageClass(scName string) error

func (*TridentOrchestrator) DeleteVolume

func (o *TridentOrchestrator) DeleteVolume(volumeName string) (err error)

DeleteVolume does the necessary set up to delete a volume during the course of normal operation, verifying that the volume is present in Trident and creating a transaction to ensure that the delete eventually completes.

func (*TridentOrchestrator) DeleteVolumeTransaction

func (o *TridentOrchestrator) DeleteVolumeTransaction(volTxn *storage.VolumeTransaction) error

DeleteVolumeTransaction deletes a volume transaction created by addVolumeTransaction.

func (*TridentOrchestrator) DetachVolume

func (o *TridentOrchestrator) DetachVolume(volumeName, mountpoint string) error

DetachVolume unmounts a volume from the local host. This method is currently only used by Docker, and it should be able to accomplish its task using only the data passed in; it should not need to use the storage controller API. It may be assumed that this method always runs on the host to which the volume will be attached. It ensures the volume is already mounted, and it attempts to delete the mount point.

func (*TridentOrchestrator) GetBackend

func (o *TridentOrchestrator) GetBackend(backendName string) (*storage.BackendExternal, error)

func (*TridentOrchestrator) GetBackendByBackendUUID

func (o *TridentOrchestrator) GetBackendByBackendUUID(backendUUID string) (*storage.BackendExternal, error)

func (*TridentOrchestrator) GetDriverTypeForVolume

func (o *TridentOrchestrator) GetDriverTypeForVolume(vol *storage.VolumeExternal) (string, error)

func (*TridentOrchestrator) GetFrontend

func (o *TridentOrchestrator) GetFrontend(name string) (frontend.Plugin, error)

func (*TridentOrchestrator) GetNode

func (o *TridentOrchestrator) GetNode(nName string) (*utils.Node, error)

func (*TridentOrchestrator) GetSnapshot

func (o *TridentOrchestrator) GetSnapshot(volumeName, snapshotName string) (*storage.SnapshotExternal, error)

func (*TridentOrchestrator) GetStorageClass

func (o *TridentOrchestrator) GetStorageClass(scName string) (*storageclass.External, error)

func (*TridentOrchestrator) GetVersion

func (o *TridentOrchestrator) GetVersion() (string, error)

func (*TridentOrchestrator) GetVolume

func (o *TridentOrchestrator) GetVolume(volume string) (*storage.VolumeExternal, error)

func (*TridentOrchestrator) GetVolumeExternal

func (o *TridentOrchestrator) GetVolumeExternal(volumeName string, backendName string) (*storage.VolumeExternal, error)

This func is used by volume import so it doesn't check core's o.volumes to see if the volume exists or not. Instead it asks the driver if the volume exists before requesting the volume size. Returns the VolumeExternal representation of the volume.

func (*TridentOrchestrator) GetVolumeTransaction

func (o *TridentOrchestrator) GetVolumeTransaction(
	volTxn *storage.VolumeTransaction,
) (*storage.VolumeTransaction, error)

func (*TridentOrchestrator) GetVolumeType

func (o *TridentOrchestrator) GetVolumeType(vol *storage.VolumeExternal) (
	volumeType config.VolumeType, err error,
)

func (*TridentOrchestrator) ImportVolume

func (o *TridentOrchestrator) ImportVolume(
	volumeConfig *storage.VolumeConfig,
) (externalVol *storage.VolumeExternal, err error)

func (*TridentOrchestrator) LegacyImportVolume

func (o *TridentOrchestrator) LegacyImportVolume(
	volumeConfig *storage.VolumeConfig, backendName string, notManaged bool, createPVandPVC VolumeCallback,
) (externalVol *storage.VolumeExternal, err error)

func (*TridentOrchestrator) ListBackends

func (o *TridentOrchestrator) ListBackends() ([]*storage.BackendExternal, error)

func (*TridentOrchestrator) ListNodes

func (o *TridentOrchestrator) ListNodes() ([]*utils.Node, error)

func (*TridentOrchestrator) ListSnapshots

func (o *TridentOrchestrator) ListSnapshots() ([]*storage.SnapshotExternal, error)

func (*TridentOrchestrator) ListSnapshotsByName

func (o *TridentOrchestrator) ListSnapshotsByName(snapshotName string) ([]*storage.SnapshotExternal, error)

func (*TridentOrchestrator) ListSnapshotsForVolume

func (o *TridentOrchestrator) ListSnapshotsForVolume(volumeName string) ([]*storage.SnapshotExternal, error)

func (*TridentOrchestrator) ListStorageClasses

func (o *TridentOrchestrator) ListStorageClasses() ([]*storageclass.External, error)

func (*TridentOrchestrator) ListVolumes

func (o *TridentOrchestrator) ListVolumes() ([]*storage.VolumeExternal, error)

func (*TridentOrchestrator) ListVolumesByPlugin

func (o *TridentOrchestrator) ListVolumesByPlugin(pluginName string) ([]*storage.VolumeExternal, error)

func (*TridentOrchestrator) PublishVolume

func (o *TridentOrchestrator) PublishVolume(
	volumeName string, publishInfo *utils.VolumePublishInfo,
) error

func (*TridentOrchestrator) ReadSnapshotsForVolume

func (o *TridentOrchestrator) ReadSnapshotsForVolume(volumeName string) ([]*storage.SnapshotExternal, error)

func (*TridentOrchestrator) ReloadVolumes

func (o *TridentOrchestrator) ReloadVolumes() error

func (*TridentOrchestrator) ResizeVolume

func (o *TridentOrchestrator) ResizeVolume(volumeName, newSize string) (err error)

ResizeVolume resizes a volume to the new size.

func (*TridentOrchestrator) SetVolumeState

func (o *TridentOrchestrator) SetVolumeState(volumeName string, state storage.VolumeState) error

SetVolumeState sets the state of a volume to a given value

func (*TridentOrchestrator) UpdateBackend

func (o *TridentOrchestrator) UpdateBackend(backendName, configJSON string) (
	backendExternal *storage.BackendExternal, err error)

UpdateBackend updates an existing backend.

func (*TridentOrchestrator) UpdateBackendByBackendUUID

func (o *TridentOrchestrator) UpdateBackendByBackendUUID(backendName, configJSON, backendUUID string) (
	backendExternal *storage.BackendExternal, err error)

UpdateBackendByBackendUUID updates an existing backend.

func (*TridentOrchestrator) UpdateBackendState

func (o *TridentOrchestrator) UpdateBackendState(backendName, backendState string) (
	backendExternal *storage.BackendExternal, err error)

UpdateBackend updates an existing backend.

type UnsupportedError

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

func (*UnsupportedError) Error

func (e *UnsupportedError) Error() string

type VolumeCallback

type VolumeCallback func(*storage.VolumeExternal, string) error

type VolumeDeletingError

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

func (*VolumeDeletingError) Error

func (e *VolumeDeletingError) Error() string

Jump to

Keyboard shortcuts

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