Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewStorageProvisioner ¶
func NewStorageProvisioner( scope names.Tag, storageDir string, v VolumeAccessor, f FilesystemAccessor, l LifecycleManager, e EnvironAccessor, m MachineAccessor, ) worker.Worker
NewStorageProvisioner returns a Worker which manages provisioning (deprovisioning), and attachment (detachment) of first-class volumes and filesystems.
Machine-scoped storage workers will be provided with a storage directory, while environment-scoped workers will not. If the directory path is non-empty, then it will be passed to the storage source via its config.
Types ¶
type EnvironAccessor ¶
type EnvironAccessor interface { // WatchForEnvironConfigChanges returns a watcher that will be notified // whenever the environment config changes in state. WatchForEnvironConfigChanges() (apiwatcher.NotifyWatcher, error) // EnvironConfig returns the current environment config. EnvironConfig() (*config.Config, error) }
EnvironAccessor defines an interface used to enable a storage provisioner worker to watch changes to and read environment config, to use when provisioning storage.
type FilesystemAccessor ¶
type FilesystemAccessor interface { // WatchFilesystems watches for changes to filesystems that this // storage provisioner is responsible for. WatchFilesystems() (apiwatcher.StringsWatcher, error) // WatchFilesystemAttachments watches for changes to filesystem attachments // that this storage provisioner is responsible for. WatchFilesystemAttachments() (apiwatcher.MachineStorageIdsWatcher, error) // Filesystems returns details of filesystems with the specified tags. Filesystems([]names.FilesystemTag) ([]params.FilesystemResult, error) // FilesystemAttachments returns details of filesystem attachments with // the specified tags. FilesystemAttachments([]params.MachineStorageId) ([]params.FilesystemAttachmentResult, error) // FilesystemParams returns the parameters for creating the filesystems // with the specified tags. FilesystemParams([]names.FilesystemTag) ([]params.FilesystemParamsResult, error) // FilesystemAttachmentParams returns the parameters for creating the // filesystem attachments with the specified tags. FilesystemAttachmentParams([]params.MachineStorageId) ([]params.FilesystemAttachmentParamsResult, error) // SetFilesystemInfo records the details of newly provisioned filesystems. SetFilesystemInfo([]params.Filesystem) ([]params.ErrorResult, error) // SetFilesystemAttachmentInfo records the details of newly provisioned // filesystem attachments. SetFilesystemAttachmentInfo([]params.FilesystemAttachment) ([]params.ErrorResult, error) }
FilesystemAccessor defines an interface used to allow a storage provisioner worker to perform filesystem related operations.
type LifecycleManager ¶
type LifecycleManager interface { // Life returns the lifecycle state of the specified entities. Life([]names.Tag) ([]params.LifeResult, error) // Remove removes the specified entities from state. Remove([]names.Tag) ([]params.ErrorResult, error) // AttachmentLife returns the lifecycle state of the specified // machine/entity attachments. AttachmentLife([]params.MachineStorageId) ([]params.LifeResult, error) // RemoveAttachments removes the specified machine/entity attachments // from state. RemoveAttachments([]params.MachineStorageId) ([]params.ErrorResult, error) }
LifecycleManager defines an interface used to enable a storage provisioner worker to perform lifcycle-related operations on storage entities and attachments.
type MachineAccessor ¶
type MachineAccessor interface { // WatchMachine watches for changes to the specified machine. WatchMachine(names.MachineTag) (apiwatcher.NotifyWatcher, error) // InstanceIds returns the instance IDs of each machine. InstanceIds([]names.MachineTag) ([]params.StringResult, error) }
MachineAccessor defines an interface used to allow a storage provisioner worker to perform machine related operations.
type VolumeAccessor ¶
type VolumeAccessor interface { // WatchBlockDevices watches for changes to the block devices of the // specified machine. WatchBlockDevices(names.MachineTag) (apiwatcher.NotifyWatcher, error) // WatchVolumes watches for changes to volumes that this storage // provisioner is responsible for. WatchVolumes() (apiwatcher.StringsWatcher, error) // WatchVolumeAttachments watches for changes to volume attachments // that this storage provisioner is responsible for. WatchVolumeAttachments() (apiwatcher.MachineStorageIdsWatcher, error) // Volumes returns details of volumes with the specified tags. Volumes([]names.VolumeTag) ([]params.VolumeResult, error) // VolumeBlockDevices returns details of block devices corresponding to // the specified volume attachment IDs. VolumeBlockDevices([]params.MachineStorageId) ([]params.BlockDeviceResult, error) // VolumeAttachments returns details of volume attachments with // the specified tags. VolumeAttachments([]params.MachineStorageId) ([]params.VolumeAttachmentResult, error) // VolumeParams returns the parameters for creating the volumes // with the specified tags. VolumeParams([]names.VolumeTag) ([]params.VolumeParamsResult, error) // VolumeAttachmentParams returns the parameters for creating the // volume attachments with the specified tags. VolumeAttachmentParams([]params.MachineStorageId) ([]params.VolumeAttachmentParamsResult, error) // SetVolumeInfo records the details of newly provisioned volumes. SetVolumeInfo([]params.Volume) ([]params.ErrorResult, error) // SetVolumeAttachmentInfo records the details of newly provisioned // volume attachments. SetVolumeAttachmentInfo([]params.VolumeAttachment) ([]params.ErrorResult, error) }
VolumeAccessor defines an interface used to allow a storage provisioner worker to perform volume related operations.