storage

package
v0.0.0-...-0a82276 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package storage defines structures and functions relating to charm storage.

Index

Constants

View Source
const (
	// K8sStorageMediumConst is the constant key
	K8sStorageMediumConst = "storage-medium"
	// K8sStorageMediumMemory is the value use tmpfs in K8s
	K8sStorageMediumMemory = "Memory"
	// K8sStorageMediumHugePages is a K8s storage for volumes
	K8sStorageMediumHugePages = "HugePages"
)
View Source
const (
	// StorageClass is the name of a storage class resource.
	K8sStorageClass       = "storage-class"
	K8sStorageProvisioner = "storage-provisioner"
	K8sStorageMedium      = "storage-medium"
	K8sStorageMode        = "storage-mode"
)
View Source
const (
	// ConfigStorageDir is the path to the directory which a
	// machine-scoped storage source may use to contain storage
	// artifacts. This should not be used for environment-wide
	// storage sources, as the contents are bound to the
	// lifetime of the machine.
	//
	// ConfigStorageDir is set by the storage provisioner, so
	// should not be relied upon until a storage source is
	// constructed.
	ConfigStorageDir = "storage-dir"
)

Variables

This section is empty.

Functions

func IsValidPoolName

func IsValidPoolName(s string) bool

IsValidPoolName checks if given string is a valid pool name.

func ParseDirectivesMap

func ParseDirectivesMap(args []string, mustHaveDirectives bool) (map[string]Directive, error)

ParseDirectivesMap parses string representation of storage directives into a map keyed on storage names with directives as values.

Storage directives may be specified as

<name>=<directive>

or as

<name>

where latter is equivalent to <name>=1.

Duplicate storage names cause an error to be returned. Directive presence can be enforced.

func ToString

func ToString(c Directive) (string, error)

ToString returns a parsable string representation of the storage directives.

Types

type AttachFilesystemsResult

type AttachFilesystemsResult struct {
	FilesystemAttachment *FilesystemAttachment
	Error                error
}

AttachFilesystemsResult contains the result of a FilesystemSource.AttachFilesystems call for one filesystem. FilesystemAttachment should only be used if Error is nil.

type AttachVolumesResult

type AttachVolumesResult struct {
	VolumeAttachment *VolumeAttachment
	Error            error
}

AttachVolumesResult contains the result of a VolumeSource.AttachVolumes call for one volume. VolumeAttachment should only be used if Error is nil.

type AttachmentParams

type AttachmentParams struct {
	// Provider is the name of the storage provider that is to be used to
	// create the attachment.
	Provider ProviderType

	// Machine is the tag of the Juju machine that the storage should be
	// attached to. Storage providers may use this to perform machine-
	// specific operations, such as configuring access controls for the
	// machine.
	// This is a generic tag as it's also used to hold a unit for caas storage.
	// TODO(caas)-rename to Host
	Machine names.Tag

	// InstanceId is the ID of the cloud instance that the storage should
	// be attached to. This will only be of interest to storage providers
	// that interact with the instances, such as EBS/EC2. The InstanceId
	// field will be empty if the instance is not yet provisioned.
	InstanceId instance.Id

	// ReadOnly indicates that the storage should be attached as read-only.
	ReadOnly bool
}

AttachmentParams describes the parameters for attaching a volume or filesystem to a machine.

type Attrs

type Attrs map[string]interface{}

Attrs defines storage attributes.

type ChainedProviderRegistry

type ChainedProviderRegistry []ProviderRegistry

ChainedProviderRegistry is storage provider registry that combines multiple storage provider registries, chaining their results. Registries earlier in the chain take precedence.

func (ChainedProviderRegistry) StorageProvider

func (r ChainedProviderRegistry) StorageProvider(t ProviderType) (Provider, error)

StorageProvider implements ProviderRegistry.

func (ChainedProviderRegistry) StorageProviderTypes

func (r ChainedProviderRegistry) StorageProviderTypes() ([]ProviderType, error)

StorageProviderTypes implements ProviderRegistry.

type Config

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

Config defines the configuration for a storage source.

func NewConfig

func NewConfig(name string, provider ProviderType, attrs Attrs) (*Config, error)

NewConfig creates a new Config for instantiating a storage source.

func (*Config) Attrs

func (c *Config) Attrs() Attrs

Attrs returns the configuration attributes for a storage source.

func (*Config) Name

func (c *Config) Name() string

Name returns the name of a storage source. This is not necessarily unique, and should only be used for informational purposes.

func (*Config) Provider

func (c *Config) Provider() ProviderType

Provider returns the name of a storage provider.

func (*Config) ValueString

func (c *Config) ValueString(name string) (string, bool)

ValueString returns the named config attribute as a string.

type CreateFilesystemsResult

type CreateFilesystemsResult struct {
	Filesystem *Filesystem
	Error      error
}

CreateFilesystemsResult contains the result of a FilesystemSource.CreateFilesystems call for one filesystem. Filesystem should only be used if Error is nil.

type CreateVolumesResult

type CreateVolumesResult struct {
	Volume           *Volume
	VolumeAttachment *VolumeAttachment
	Error            error
}

CreateVolumesResult contains the result of a VolumeSource.CreateVolumes call for one volume. Volume and VolumeAttachment should only be used if Error is nil.

type DescribeVolumesResult

type DescribeVolumesResult struct {
	VolumeInfo *VolumeInfo
	Error      error
}

DescribeVolumesResult contains the result of a VolumeSource.DescribeVolumes call for one volume. Volume should only be used if Error is nil.

type DeviceType

type DeviceType string
var (
	DeviceTypeLocal DeviceType = "local"
	DeviceTypeISCSI DeviceType = "iscsi"
)

type Directive

type Directive struct {
	// Pool is the name of the storage pool (ebs, ceph, custompool, ...)
	// that must provide the storage, or "" if the default pool should be
	// used.
	Pool string

	// Size is the minimum size of the storage in MiB.
	Size uint64

	// Count is the number of instances of the storage to create.
	Count uint64
}

Directive describes a set of storage directives.

func ParseDirective

func ParseDirective(s string) (Directive, error)

ParseDirective parses the specified string and creates a Directive structure.

The acceptable format for storage directive is a comma separated sequence of: POOL, COUNT, and SIZE, where

POOL identifies the storage pool. POOL can be a string
starting with a letter, followed by zero or more digits
or letters optionally separated by hyphens.

COUNT is a positive integer indicating how many instances
of the storage to create. If unspecified, and SIZE is
specified, COUNT defaults to 1.

SIZE describes the minimum size of the storage instances to
create. SIZE is a floating point number and multiplier from
the set (M, G, T, P, E, Z, Y), which are all treated as
powers of 1024.

type Filesystem

type Filesystem struct {
	// Tag is a unique name assigned by Juju to the filesystem.
	Tag names.FilesystemTag

	// Volume is the tag of the volume that backs the filesystem, if any.
	Volume names.VolumeTag

	FilesystemInfo
}

Filesystem identifies and describes a filesystem, either local or remote (NFS, Ceph etc).

type FilesystemAttachment

type FilesystemAttachment struct {
	// Filesystem is the unique tag assigned by Juju for the filesystem
	// that this attachment corresponds to.
	Filesystem names.FilesystemTag

	// Machine is the unique tag assigned by Juju for the machine that
	// this attachment corresponds to.
	Machine names.Tag

	FilesystemAttachmentInfo
}

FilesystemAttachment describes machine-specific filesystem attachment information, including how the filesystem is exposed on the machine.

type FilesystemAttachmentInfo

type FilesystemAttachmentInfo struct {
	// Path is the path at which the filesystem is mounted on the machine
	// that this attachment corresponds to.
	Path string

	// ReadOnly indicates that the filesystem is mounted read-only.
	ReadOnly bool
}

FilesystemAttachmentInfo describes machine-specific filesystem attachment information, including how the filesystem is exposed on the machine.

type FilesystemAttachmentParams

type FilesystemAttachmentParams struct {
	AttachmentParams

	// Filesystem is a unique tag assigned by Juju for the filesystem that
	// should be attached/detached.
	Filesystem names.FilesystemTag

	// FilesystemId is the unique provider-supplied ID for the filesystem that
	// should be attached/detached.
	FilesystemId string

	// Path is the path at which the filesystem is to be mounted on the machine that
	// this attachment corresponds to.
	Path string
}

FilesystemAttachmentParams is a set of parameters for filesystem attachment or detachment.

type FilesystemImporter

type FilesystemImporter interface {
	// ImportFilesystem updates the filesystem with the specified
	// filesystem provider ID with the given resource tags, so that
	// it is seen as being managed by this Juju controller/model.
	// ImportFilesystem returns the filesystem information to store
	// in the model.
	//
	// Implementations of ImportFilesystem should validate that the
	// filesystem is not in use before allowing the import to proceed.
	// Once it is imported, it is assumed to be in a detached state.
	ImportFilesystem(
		ctx envcontext.ProviderCallContext,
		filesystemId string,
		resourceTags map[string]string,
	) (FilesystemInfo, error)
}

FilesystemImporter provides an interface for importing filesystems into the controller/model.

TODO(axw) make this part of FilesystemSource?

type FilesystemInfo

type FilesystemInfo struct {
	// FilesystemId is a unique provider-supplied ID for the filesystem.
	// FilesystemId is required to be unique for the lifetime of the
	// filesystem, but may be reused.
	FilesystemId string

	// Size is the size of the filesystem, in MiB.
	Size uint64
}

Filesystem describes a filesystem, either local or remote (NFS, Ceph etc).

type FilesystemParams

type FilesystemParams struct {
	// Tag is a unique tag assigned by Juju for the requested filesystem.
	Tag names.FilesystemTag

	// Volume is the tag of the volume that backs the filesystem, if any.
	Volume names.VolumeTag

	// Size is the minimum size of the filesystem in MiB.
	Size uint64

	// The provider type for this filesystem.
	Provider ProviderType

	// Attributes is a set of provider-specific options for storage creation,
	// as defined in a storage pool.
	Attributes map[string]interface{}

	// ResourceTags is a set of tags to set on the created filesystem, if the
	// storage provider supports tags.
	ResourceTags map[string]string

	// Attachment identifies the machine that the filesystem should be attached
	// to initially, or nil if the filesystem should not be attached to any
	// machine.
	Attachment *FilesystemAttachmentParams
}

FilesystemParams is a fully specified set of parameters for filesystem creation, derived from one or more of user-specified storage directives, a storage pool definition, and charm storage metadata.

type FilesystemSource

type FilesystemSource interface {
	// ValidateFilesystemParams validates the provided filesystem creation
	// parameters, returning an error if they are invalid.
	ValidateFilesystemParams(params FilesystemParams) error

	// CreateFilesystems creates filesystems with the specified size, in MiB.
	CreateFilesystems(ctx envcontext.ProviderCallContext, params []FilesystemParams) ([]CreateFilesystemsResult, error)

	// DestroyFilesystems destroys the filesystems with the specified
	// providerd filesystem IDs.
	DestroyFilesystems(ctx envcontext.ProviderCallContext, fsIds []string) ([]error, error)

	// ReleaseFilesystems releases the filesystems with the specified provider
	// filesystem IDs from the model/controller.
	ReleaseFilesystems(ctx envcontext.ProviderCallContext, volIds []string) ([]error, error)

	// AttachFilesystems attaches filesystems to machines.
	//
	// AttachFilesystems must be idempotent; it may be called even if
	// the attachment already exists, to ensure that it exists, e.g. over
	// machine restarts.
	//
	// TODO(axw) we need to validate attachment requests prior to
	// recording in state. For example, the ec2 provider must reject
	// an attempt to attach a volume to an instance if they are in
	// different availability zones.
	AttachFilesystems(ctx envcontext.ProviderCallContext, params []FilesystemAttachmentParams) ([]AttachFilesystemsResult, error)

	// DetachFilesystems detaches the filesystems with the specified
	// provider filesystem IDs from the instances with the corresponding
	// index.
	DetachFilesystems(ctx envcontext.ProviderCallContext, params []FilesystemAttachmentParams) ([]error, error)
}

FilesystemSource provides an interface for creating, destroying and describing filesystems in the environment. A FilesystemSource is configured in a particular way, and corresponds to a storage "pool".

type KubernetesFilesystemAttachmentParams

type KubernetesFilesystemAttachmentParams struct {
	AttachmentParams

	// Path is the path at which the filesystem is to be mounted on the pod that
	// this attachment corresponds to.
	Path string
}

KubernetesFilesystemAttachmentParams is a set of parameters for filesystem attachment or detachment.

type KubernetesFilesystemInfo

type KubernetesFilesystemInfo struct {
	// MountPoint is the path the filesystem is mounted at.
	MountPoint string

	// ReadOnly is true if the filesystem is readonly.
	ReadOnly bool

	// FilesystemId is a unique provider id for the filesystem.
	FilesystemId string

	// Pool is the name of the storage pool used to
	// allocate the filesystem.
	Pool string

	// Size is the size of the filesystem in MiB.
	Size uint64
}

FilesystemAttachmentInfo describes a filesystem attachment.

type KubernetesFilesystemParams

type KubernetesFilesystemParams struct {
	// StorageName is the name of the storage as specified in the charm.
	StorageName string

	// Size is the minimum size of the filesystem in MiB.
	Size uint64

	// The provider type for this filesystem.
	Provider ProviderType

	// Attributes is a set of provider-specific options for storage creation,
	// as defined in a storage pool.
	Attributes map[string]interface{}

	// ResourceTags is a set of tags to set on the created filesystem, if the
	// storage provider supports tags.
	ResourceTags map[string]string

	// Attachment identifies the mount point the filesystem should be
	// mounted at.
	Attachment *KubernetesFilesystemAttachmentParams
}

KubernetesFilesystemParams is a fully specified set of parameters for filesystem creation, derived from one or more of user-specified storage directives, a storage pool definition, and charm storage metadata.

type NotImplementedProviderRegistry

type NotImplementedProviderRegistry struct{}

NotImplementedProviderRegistry is a storage provider registry that returns an error satisfying errors.NotImplemented for any method call.

func (NotImplementedProviderRegistry) StorageProvider

StorageProvider implements ProviderRegistry.

func (NotImplementedProviderRegistry) StorageProviderTypes

func (r NotImplementedProviderRegistry) StorageProviderTypes() ([]ProviderType, error)

StorageProviderTypes implements ProviderRegistry.

type Provider

type Provider interface {
	// VolumeSource returns a VolumeSource given the specified storage
	// provider configurations, or an error if the provider does not
	// support creating volumes or the configuration is invalid.
	//
	// If the storage provider does not support creating volumes as a
	// first-class primitive, then VolumeSource must return an error
	// satisfying errors.IsNotSupported.
	VolumeSource(*Config) (VolumeSource, error)

	// FilesystemSource returns a FilesystemSource given the specified
	// storage provider configurations, or an error if the provider does
	// not support creating filesystems or the configuration is invalid.
	FilesystemSource(*Config) (FilesystemSource, error)

	// Supports reports whether or not the storage provider supports
	// the specified storage kind.
	//
	// A provider that supports volumes but not filesystems can still
	// be used for creating filesystem storage; Juju will request a
	// volume from the provider and then manage the filesystem itself.
	Supports(kind StorageKind) bool

	// Scope returns the scope of storage managed by this provider.
	Scope() Scope

	// Dynamic reports whether or not the storage provider is capable
	// of dynamic storage provisioning. Non-dynamic storage must be
	// created at the time a machine is provisioned.
	Dynamic() bool

	// Releasable reports whether or not the storage provider is capable
	// of releasing dynamic storage, with either ReleaseVolumes or
	// ReleaseFilesystems.
	Releasable() bool

	// DefaultPools returns the default storage pools for this provider,
	// to register in each new model.
	DefaultPools() []*Config

	// ValidateConfig validates the provided storage provider config,
	// returning an error if it is invalid.
	ValidateConfig(*Config) error

	// ValidateForK8s validates if a storage provider can be set for
	// a given K8s configuration.
	ValidateForK8s(map[string]any) error
}

Provider is an interface for obtaining storage sources.

type ProviderRegistry

type ProviderRegistry interface {
	// StorageProviderTypes returns the storage provider types
	// contained within this registry.
	//
	// Determining the supported storage providers may be dynamic.
	// Multiple calls for the same registry must return consistent
	// results.
	StorageProviderTypes() ([]ProviderType, error)

	// StorageProvider returns the storage provider with the given
	// provider type. StorageProvider must return an errors satisfying
	// errors.IsNotFound if the registry does not contain the
	// specified provider type.
	StorageProvider(ProviderType) (Provider, error)
}

ProviderRegistry is an interface for obtaining storage providers.

type ProviderType

type ProviderType string

ProviderType uniquely identifies a storage provider, such as "ebs" or "loop".

type Scope

type Scope int

Scope defines the scope of the storage that a provider manages. Machine-scoped storage must be managed from within the machine, whereas environment-level storage must be managed by an environment storage provisioner.

const (
	ScopeEnviron Scope = iota
	ScopeMachine
)

type StaticProviderRegistry

type StaticProviderRegistry struct {
	// Providers contains the storage providers for this registry.
	Providers map[ProviderType]Provider
}

StaticProviderRegistry is a storage provider registry with a statically defined set of providers.

func (StaticProviderRegistry) StorageProvider

func (r StaticProviderRegistry) StorageProvider(t ProviderType) (Provider, error)

StorageProvider implements ProviderRegistry.

func (StaticProviderRegistry) StorageProviderTypes

func (r StaticProviderRegistry) StorageProviderTypes() ([]ProviderType, error)

StorageProviderTypes implements ProviderRegistry.

type StorageAttachmentInfo

type StorageAttachmentInfo struct {
	// Kind is the kind of the storage attachment.
	Kind StorageKind

	// Location is the storage attachment's location: the mount point
	// for a filesystem-kind storage attachment, and the device path
	// for a block-kind.
	Location string
}

StorageAttachmentInfo provides unit-specific information about a storage instance. StorageAttachmentInfo is based on either a volume attachment or a filesystem attachment, depending on its kind.

type StorageInstance

type StorageInstance struct {
	// Tag is a unique tag assigned by Juju to the storage instance.
	Tag names.StorageTag

	// Kind is the kind of the datastore (block device, filesystem).
	Kind StorageKind
}

StorageInstance describes a storage instance, assigned to an application or unit.

type StorageKind

type StorageKind int

StorageKind defines the type of the datastore: whether it is a raw block device, or a filesystem.

const (
	StorageKindUnknown StorageKind = iota
	StorageKindBlock
	StorageKindFilesystem
)

func (StorageKind) String

func (k StorageKind) String() string

type Volume

type Volume struct {
	// Name is a unique name assigned by Juju to the volume.
	Tag names.VolumeTag

	VolumeInfo
}

Volume identifies and describes a volume (disk, logical volume, etc.)

type VolumeAttachment

type VolumeAttachment struct {
	// Volume is the unique tag assigned by Juju for the volume
	// that this attachment corresponds to.
	Volume names.VolumeTag

	// Machine is the unique tag assigned by Juju for the machine that
	// this attachment corresponds to.
	Machine names.Tag

	VolumeAttachmentInfo
}

VolumeAttachment identifies and describes machine-specific volume attachment information, including how the volume is exposed on the machine.

type VolumeAttachmentInfo

type VolumeAttachmentInfo struct {
	// DeviceName is the volume's OS-specific device name (e.g. "sdb").
	//
	// If the device name may change (e.g. on machine restart), then this
	// field must be left blank.
	DeviceName string

	// DeviceLink is an OS-specific device link that must exactly match
	// one of the block device's links when attached.
	//
	// If no device link is known, or it may change (e.g. on machine
	// restart), then this field must be left blank.
	DeviceLink string

	// BusAddress is the bus address, where the volume is attached to
	// the machine.
	//
	// The format of this field must match the field of the same name
	// in BlockDevice.
	BusAddress string

	// ReadOnly signifies whether the volume is read only or writable.
	ReadOnly bool

	// PlanInfo holds information that the machine agent might use to
	// initialize the block device that has been attached to it.
	PlanInfo *VolumeAttachmentPlanInfo
}

VolumeAttachmentInfo describes machine-specific volume attachment information, including how the volume is exposed on the machine.

type VolumeAttachmentParams

type VolumeAttachmentParams struct {
	AttachmentParams

	// Volume is a unique tag assigned by Juju for the volume that
	// should be attached/detached.
	Volume names.VolumeTag

	// VolumeId is the unique provider-supplied ID for the volume that
	// should be attached/detached.
	VolumeId string
}

VolumeAttachmentParams is a set of parameters for volume attachment or detachment.

type VolumeAttachmentPlan

type VolumeAttachmentPlan struct {
	// Volume is the unique tag assigned by Juju for the volume
	// that this attachment corresponds to.
	Volume names.VolumeTag

	// Machine is the unique tag assigned by Juju for the machine that
	// this attachment corresponds to.
	Machine names.MachineTag

	VolumeAttachmentPlanInfo
}

type VolumeAttachmentPlanInfo

type VolumeAttachmentPlanInfo struct {
	// DeviceType describes what type of volume we are dealing with
	// possible options are:
	// * local - a block device that is directly attached to this instance
	// * iscsi - an iSCSI disk. This type of disk will require the machine agent
	// to execute additional steps before the device is available
	DeviceType DeviceType
	// DeviceAttributes is a map that contains DeviceType specific initialization
	// values. For example, in the case of iscsi, it may contain server address:port,
	// target, chap secrets, etc.
	DeviceAttributes map[string]string
}

type VolumeImporter

type VolumeImporter interface {
	// ImportVolume updates the volume with the specified volume
	// provider ID with the given resource tags, so that it is
	// seen as being managed by this Juju controller/model.
	// ImportVolume returns the volume information to store
	// in the model.
	//
	// Implementations of ImportVolume should validate that the
	// volume is not in use before allowing the import to proceed.
	// Once it is imported, it is assumed to be in a detached state.
	ImportVolume(
		ctx envcontext.ProviderCallContext,
		volumeId string,
		resourceTags map[string]string,
	) (VolumeInfo, error)
}

VolumeImporter provides an interface for importing volumes into the controller/model.

TODO(axw) make this part of VolumeSource?

type VolumeInfo

type VolumeInfo struct {
	// VolumeId is a unique provider-supplied ID for the volume.
	// VolumeId is required to be unique for the lifetime of the
	// volume, but may be reused.
	VolumeId string

	// HardwareId is the volume's hardware ID. Not all volumes have
	// a hardware ID, so this may be left blank.
	HardwareId string

	// WWN is the volume's World Wide Name (WWN). Not all volumes
	// have a WWN, so this may be left blank.
	WWN string

	// Size is the size of the volume, in MiB.
	Size uint64

	// Persistent reflects whether the volume is destroyed with the
	// machine to which it is attached.
	Persistent bool
}

VolumeInfo describes a volume (disk, logical volume etc.)

type VolumeParams

type VolumeParams struct {
	// Tag is a unique tag name assigned by Juju for the requested volume.
	Tag names.VolumeTag

	// Size is the minimum size of the volume in MiB.
	Size uint64

	// Provider is the name of the storage provider that is to be used to
	// create the volume.
	Provider ProviderType

	// Attributes is the set of provider-specific attributes to pass to
	// the storage provider when creating the volume. Attributes is derived
	// from the storage pool configuration.
	Attributes map[string]interface{}

	// ResourceTags is a set of tags to set on the created volume, if the
	// storage provider supports tags.
	ResourceTags map[string]string

	// Attachment identifies the machine that the volume should be attached
	// to initially, or nil if the volume should not be attached to any
	// machine. Some providers, such as MAAS, do not support dynamic
	// attachment, and so provisioning time is the only opportunity to
	// perform attachment.
	//
	// When machine instances are created, the instance provider will be
	// presented with parameters for any due-to-be-attached volumes. If
	// once the instance is created there are still unprovisioned volumes,
	// the dynamic storage provisioner will take care of creating them.
	Attachment *VolumeAttachmentParams
}

VolumeParams is a fully specified set of parameters for volume creation, derived from one or more of user-specified storage directives, a storage pool definition, and charm storage metadata.

type VolumeSource

type VolumeSource interface {
	// CreateVolumes creates volumes with the specified parameters. If the
	// volumes are initially attached, then CreateVolumes returns
	// information about those attachments too.
	CreateVolumes(ctx envcontext.ProviderCallContext, params []VolumeParams) ([]CreateVolumesResult, error)

	// ListVolumes lists the provider volume IDs for every volume
	// created by this volume source.
	ListVolumes(ctx envcontext.ProviderCallContext) ([]string, error)

	// DescribeVolumes returns the properties of the volumes with the
	// specified provider volume IDs.
	DescribeVolumes(ctx envcontext.ProviderCallContext, volIds []string) ([]DescribeVolumesResult, error)

	// DestroyVolumes destroys the volumes with the specified provider
	// volume IDs.
	DestroyVolumes(ctx envcontext.ProviderCallContext, volIds []string) ([]error, error)

	// ReleaseVolumes releases the volumes with the specified provider
	// volume IDs from the model/controller.
	ReleaseVolumes(ctx envcontext.ProviderCallContext, volIds []string) ([]error, error)

	// ValidateVolumeParams validates the provided volume creation
	// parameters, returning an error if they are invalid.
	ValidateVolumeParams(params VolumeParams) error

	// AttachVolumes attaches volumes to machines.
	//
	// AttachVolumes must be idempotent; it may be called even if the
	// attachment already exists, to ensure that it exists, e.g. over
	// machine restarts.
	//
	// TODO(axw) we need to validate attachment requests prior to
	// recording in state. For example, the ec2 provider must reject
	// an attempt to attach a volume to an instance if they are in
	// different availability zones.
	AttachVolumes(ctx envcontext.ProviderCallContext, params []VolumeAttachmentParams) ([]AttachVolumesResult, error)

	// DetachVolumes detaches the volumes with the specified provider
	// volume IDs from the instances with the corresponding index.
	//
	// TODO(axw) we need to record in state whether or not volumes
	// are detachable, and reject attempts to attach/detach on
	// that basis.
	DetachVolumes(ctx envcontext.ProviderCallContext, params []VolumeAttachmentParams) ([]error, error)
}

VolumeSource provides an interface for creating, destroying, describing, attaching and detaching volumes in the environment. A VolumeSource is configured in a particular way, and corresponds to a storage "pool".

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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