Documentation ¶
Overview ¶
Package storagecommon provides common storage-related services for API server facades.
Index ¶
- func BlockDeviceFromState(in state.BlockDeviceInfo) storage.BlockDevice
- func FilesystemAttachmentFromState(v state.FilesystemAttachment) (params.FilesystemAttachment, error)
- func FilesystemAttachmentInfoFromState(info state.FilesystemAttachmentInfo) params.FilesystemAttachmentInfo
- func FilesystemAttachmentToState(in params.FilesystemAttachment) (names.MachineTag, names.FilesystemTag, state.FilesystemAttachmentInfo, error)
- func FilesystemFromState(f state.Filesystem) (params.Filesystem, error)
- func FilesystemInfoFromState(info state.FilesystemInfo) params.FilesystemInfo
- func FilesystemParams(f state.Filesystem, storageInstance state.StorageInstance, ...) (params.FilesystemParams, error)
- func FilesystemToState(v params.Filesystem) (names.FilesystemTag, state.FilesystemInfo, error)
- func FilesystemsToState(in []params.Filesystem) (map[names.FilesystemTag]state.FilesystemInfo, error)
- func IsVolumeAlreadyProvisioned(err error) bool
- func MatchingBlockDevice(blockDevices []state.BlockDeviceInfo, volumeInfo state.VolumeInfo, ...) (*state.BlockDeviceInfo, bool)
- func MaybeAssignedStorageInstance(getTag func() (names.StorageTag, error), ...) (state.StorageInstance, error)
- func ParseFilesystemAttachmentIds(stringIds []string) ([]params.MachineStorageId, error)
- func ParseVolumeAttachmentIds(stringIds []string) ([]params.MachineStorageId, error)
- func StorageAttachmentInfo(st StorageInterface, att state.StorageAttachment, machineTag names.MachineTag) (*storage.StorageAttachmentInfo, error)
- func StoragePoolConfig(name string, poolManager poolmanager.PoolManager, ...) (storage.ProviderType, *storage.Config, error)
- func VolumeAttachmentFromState(v state.VolumeAttachment) (params.VolumeAttachment, error)
- func VolumeAttachmentInfoFromState(info state.VolumeAttachmentInfo) params.VolumeAttachmentInfo
- func VolumeAttachmentInfoToState(in params.VolumeAttachmentInfo) state.VolumeAttachmentInfo
- func VolumeAttachmentInfosToState(in map[string]params.VolumeAttachmentInfo) (map[names.VolumeTag]state.VolumeAttachmentInfo, error)
- func VolumeAttachmentToState(in params.VolumeAttachment) (names.MachineTag, names.VolumeTag, state.VolumeAttachmentInfo, error)
- func VolumeFromState(v state.Volume) (params.Volume, error)
- func VolumeInfoFromState(info state.VolumeInfo) params.VolumeInfo
- func VolumeParams(v state.Volume, storageInstance state.StorageInstance, ...) (params.VolumeParams, error)
- func VolumeToState(v params.Volume) (names.VolumeTag, state.VolumeInfo, error)
- func VolumesToState(in []params.Volume) (map[names.VolumeTag]state.VolumeInfo, error)
- func WatchStorageAttachment(st StorageInterface, storageTag names.StorageTag, machineTag names.MachineTag, ...) (state.NotifyWatcher, error)
- type StorageInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlockDeviceFromState ¶
func BlockDeviceFromState(in state.BlockDeviceInfo) storage.BlockDevice
BlockDeviceFromState translates a state.BlockDeviceInfo to a storage.BlockDevice.
func FilesystemAttachmentFromState ¶
func FilesystemAttachmentFromState(v state.FilesystemAttachment) (params.FilesystemAttachment, error)
FilesystemAttachmentFromState converts a state.FilesystemAttachment to params.FilesystemAttachment.
func FilesystemAttachmentInfoFromState ¶
func FilesystemAttachmentInfoFromState(info state.FilesystemAttachmentInfo) params.FilesystemAttachmentInfo
FilesystemAttachmentInfoFromState converts a state.FilesystemAttachmentInfo to params.FilesystemAttachmentInfo.
func FilesystemAttachmentToState ¶
func FilesystemAttachmentToState(in params.FilesystemAttachment) (names.MachineTag, names.FilesystemTag, state.FilesystemAttachmentInfo, error)
FilesystemAttachmentToState converts a storage.FilesystemAttachment to a state.FilesystemAttachmentInfo.
func FilesystemFromState ¶
func FilesystemFromState(f state.Filesystem) (params.Filesystem, error)
FilesystemFromState converts a state.Filesystem to params.Filesystem.
func FilesystemInfoFromState ¶
func FilesystemInfoFromState(info state.FilesystemInfo) params.FilesystemInfo
FilesystemInfoFromState converts a state.FilesystemInfo to params.FilesystemInfo.
func FilesystemParams ¶
func FilesystemParams( f state.Filesystem, storageInstance state.StorageInstance, modelUUID, controllerUUID string, environConfig *config.Config, poolManager poolmanager.PoolManager, registry storage.ProviderRegistry, ) (params.FilesystemParams, error)
FilesystemParams returns the parameters for creating or destroying the given filesystem.
func FilesystemToState ¶
func FilesystemToState(v params.Filesystem) (names.FilesystemTag, state.FilesystemInfo, error)
FilesystemToState converts a params.Filesystem to state.FilesystemInfo and names.FilesystemTag.
func FilesystemsToState ¶
func FilesystemsToState(in []params.Filesystem) (map[names.FilesystemTag]state.FilesystemInfo, error)
FilesystemsToState converts a slice of params.Filesystem to a mapping of filesystem tags to state.FilesystemInfo.
func IsVolumeAlreadyProvisioned ¶
IsVolumeAlreadyProvisioned returns true if the specified error is caused by a volume already being provisioned.
func MatchingBlockDevice ¶
func MatchingBlockDevice( blockDevices []state.BlockDeviceInfo, volumeInfo state.VolumeInfo, attachmentInfo state.VolumeAttachmentInfo, ) (*state.BlockDeviceInfo, bool)
MatchingBlockDevice finds the block device that matches the provided volume info and volume attachment info.
func MaybeAssignedStorageInstance ¶
func MaybeAssignedStorageInstance( getTag func() (names.StorageTag, error), getStorageInstance func(names.StorageTag) (state.StorageInstance, error), ) (state.StorageInstance, error)
MaybeAssignedStorageInstance calls the provided function to get a StorageTag, and returns the corresponding state.StorageInstance if it didn't return an errors.IsNotAssigned error, or nil if it did.
func ParseFilesystemAttachmentIds ¶
func ParseFilesystemAttachmentIds(stringIds []string) ([]params.MachineStorageId, error)
ParseFilesystemAttachmentIds parses the strings, returning machine storage IDs.
func ParseVolumeAttachmentIds ¶
func ParseVolumeAttachmentIds(stringIds []string) ([]params.MachineStorageId, error)
ParseVolumeAttachmentIds parses the strings, returning machine storage IDs.
func StorageAttachmentInfo ¶
func StorageAttachmentInfo( st StorageInterface, att state.StorageAttachment, machineTag names.MachineTag, ) (*storage.StorageAttachmentInfo, error)
StorageAttachmentInfo returns the StorageAttachmentInfo for the specified StorageAttachment by gathering information from related entities (volumes, filesystems).
StorageAttachmentInfo returns an error satisfying errors.IsNotProvisioned if the storage attachment is not yet fully provisioned and ready for use by a charm.
func StoragePoolConfig ¶
func StoragePoolConfig(name string, poolManager poolmanager.PoolManager, registry storage.ProviderRegistry) (storage.ProviderType, *storage.Config, error)
StoragePoolConfig returns the storage provider type and configuration for a named storage pool. If there is no such pool with the specified name, but it identifies a storage provider, then that type will be returned with a nil configuration.
func VolumeAttachmentFromState ¶
func VolumeAttachmentFromState(v state.VolumeAttachment) (params.VolumeAttachment, error)
VolumeAttachmentFromState converts a state.VolumeAttachment to params.VolumeAttachment.
func VolumeAttachmentInfoFromState ¶
func VolumeAttachmentInfoFromState(info state.VolumeAttachmentInfo) params.VolumeAttachmentInfo
VolumeAttachmentInfoFromState converts a state.VolumeAttachmentInfo to params.VolumeAttachmentInfo.
func VolumeAttachmentInfoToState ¶
func VolumeAttachmentInfoToState(in params.VolumeAttachmentInfo) state.VolumeAttachmentInfo
VolumeAttachmentInfoToState converts a params.VolumeAttachmentInfo to a state.VolumeAttachmentInfo.
func VolumeAttachmentInfosToState ¶
func VolumeAttachmentInfosToState(in map[string]params.VolumeAttachmentInfo) (map[names.VolumeTag]state.VolumeAttachmentInfo, error)
VolumeAttachmentInfosToState converts a map of volume tags to params.VolumeAttachmentInfo to a map of volume tags to state.VolumeAttachmentInfo.
func VolumeAttachmentToState ¶
func VolumeAttachmentToState(in params.VolumeAttachment) (names.MachineTag, names.VolumeTag, state.VolumeAttachmentInfo, error)
VolumeAttachmentToState converts a params.VolumeAttachment to a state.VolumeAttachmentInfo and tags.
func VolumeFromState ¶
VolumeFromState converts a state.Volume to params.Volume.
func VolumeInfoFromState ¶
func VolumeInfoFromState(info state.VolumeInfo) params.VolumeInfo
VolumeInfoFromState converts a state.VolumeInfo to params.VolumeInfo.
func VolumeParams ¶
func VolumeParams( v state.Volume, storageInstance state.StorageInstance, modelUUID, controllerUUID string, environConfig *config.Config, poolManager poolmanager.PoolManager, registry storage.ProviderRegistry, ) (params.VolumeParams, error)
VolumeParams returns the parameters for creating or destroying the given volume.
func VolumeToState ¶
func VolumeToState(v params.Volume) (names.VolumeTag, state.VolumeInfo, error)
VolumeToState converts a params.Volume to state.VolumeInfo and names.VolumeTag.
func VolumesToState ¶
func VolumesToState(in []params.Volume) (map[names.VolumeTag]state.VolumeInfo, error)
VolumesToState converts a slice of params.Volume to a mapping of volume tags to state.VolumeInfo.
func WatchStorageAttachment ¶
func WatchStorageAttachment( st StorageInterface, storageTag names.StorageTag, machineTag names.MachineTag, unitTag names.UnitTag, ) (state.NotifyWatcher, error)
WatchStorageAttachment returns a state.NotifyWatcher that reacts to changes to the VolumeAttachmentInfo or FilesystemAttachmentInfo corresponding to the tags specified.
Types ¶
type StorageInterface ¶
type StorageInterface interface { // StorageInstance returns the state.StorageInstance corresponding // to the specified storage tag. StorageInstance(names.StorageTag) (state.StorageInstance, error) // StorageInstanceFilesystem returns the state.Filesystem assigned // to the storage instance with the specified storage tag. StorageInstanceFilesystem(names.StorageTag) (state.Filesystem, error) // StorageInstanceVolume returns the state.Volume assigned to the // storage instance with the specified storage tag. StorageInstanceVolume(names.StorageTag) (state.Volume, error) // FilesystemAttachment returns the state.FilesystemAttachment // corresponding to the identified machine and filesystem. FilesystemAttachment(names.MachineTag, names.FilesystemTag) (state.FilesystemAttachment, error) // VolumeAttachment returns the state.VolumeAttachment corresponding // to the identified machine and volume. VolumeAttachment(names.MachineTag, names.VolumeTag) (state.VolumeAttachment, error) // WatchStorageAttachment watches for changes to the storage attachment // corresponding to the identfified unit and storage instance. WatchStorageAttachment(names.StorageTag, names.UnitTag) state.NotifyWatcher // WatchFilesystemAttachment watches for changes to the filesystem // attachment corresponding to the identfified machine and filesystem. WatchFilesystemAttachment(names.MachineTag, names.FilesystemTag) state.NotifyWatcher // WatchVolumeAttachment watches for changes to the volume attachment // corresponding to the identfified machine and volume. WatchVolumeAttachment(names.MachineTag, names.VolumeTag) state.NotifyWatcher // WatchBlockDevices watches for changes to block devices associated // with the specified machine. WatchBlockDevices(names.MachineTag) state.NotifyWatcher // BlockDevices returns information about block devices published // for the specified machine. BlockDevices(names.MachineTag) ([]state.BlockDeviceInfo, error) }
StorageInterface is an interface for obtaining information about storage instances and related entities.