juju: github.com/juju/juju/apiserver/common/storagecommon Index | Files

package storagecommon

import "github.com/juju/juju/apiserver/common/storagecommon"

Package storagecommon provides common storage-related services for API server facades.

Index

Package Files

blockdevices.go filesystems.go storage.go volumes.go

func BlockDeviceFromState Uses

func BlockDeviceFromState(in state.BlockDeviceInfo) storage.BlockDevice

BlockDeviceFromState translates a state.BlockDeviceInfo to a storage.BlockDevice.

func BlockDeviceInfoToState Uses

func BlockDeviceInfoToState(in storage.BlockDevice) state.BlockDeviceInfo

func ClassifyDetachedStorage Uses

func ClassifyDetachedStorage(
    stVolume VolumeAccess,
    stFile FilesystemAccess,
    storage []state.StorageInstance,
) (destroyed, detached []params.Entity, _ error)

ClassifyDetachedStorage classifies storage instances into those that will be destroyed, and those that will be detached, when their attachment is removed. Any storage that is not found will be omitted.

func FilesystemAttachmentFromState Uses

func FilesystemAttachmentFromState(v state.FilesystemAttachment) (params.FilesystemAttachment, error)

FilesystemAttachmentFromState converts a state.FilesystemAttachment to params.FilesystemAttachment.

func FilesystemAttachmentInfoFromState Uses

func FilesystemAttachmentInfoFromState(info state.FilesystemAttachmentInfo) params.FilesystemAttachmentInfo

FilesystemAttachmentInfoFromState converts a state.FilesystemAttachmentInfo to params.FilesystemAttachmentInfo.

func FilesystemAttachmentToState Uses

func FilesystemAttachmentToState(in params.FilesystemAttachment) (names.MachineTag, names.FilesystemTag, state.FilesystemAttachmentInfo, error)

FilesystemAttachmentToState converts a storage.FilesystemAttachment to a state.FilesystemAttachmentInfo.

func FilesystemFromState Uses

func FilesystemFromState(f state.Filesystem) (params.Filesystem, error)

FilesystemFromState converts a state.Filesystem to params.Filesystem.

func FilesystemInfoFromState Uses

func FilesystemInfoFromState(info state.FilesystemInfo) params.FilesystemInfo

FilesystemInfoFromState converts a state.FilesystemInfo to params.FilesystemInfo.

func FilesystemParams Uses

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 Uses

func FilesystemToState(v params.Filesystem) (names.FilesystemTag, state.FilesystemInfo, error)

FilesystemToState converts a params.Filesystem to state.FilesystemInfo and names.FilesystemTag.

func MatchingBlockDevice Uses

func MatchingBlockDevice(
    blockDevices []state.BlockDeviceInfo,
    volumeInfo state.VolumeInfo,
    attachmentInfo state.VolumeAttachmentInfo,
    planBlockInfo state.BlockDeviceInfo,
) (*state.BlockDeviceInfo, bool)

MatchingBlockDevice finds the block device that matches the provided volume info and volume attachment info.

func MaybeAssignedStorageInstance Uses

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 Uses

func ParseFilesystemAttachmentIds(stringIds []string) ([]params.MachineStorageId, error)

ParseFilesystemAttachmentIds parses the strings, returning machine storage IDs.

func ParseVolumeAttachmentIds Uses

func ParseVolumeAttachmentIds(stringIds []string) ([]params.MachineStorageId, error)

ParseVolumeAttachmentIds parses the strings, returning machine storage IDs.

func StorageAttachmentInfo Uses

func StorageAttachmentInfo(
    st StorageAccess,
    stVolume VolumeAccess,
    stFile FilesystemAccess,
    att state.StorageAttachment,
    hostTag names.Tag,
) (*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 Uses

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 StorageTags Uses

func StorageTags(
    storageInstance state.StorageInstance,
    modelUUID, controllerUUID string,
    tagger tags.ResourceTagger,
) (map[string]string, error)

StorageTags returns the tags that should be set on a volume or filesystem, if the provider supports them.

func UnitStorage Uses

func UnitStorage(st StorageAccess, unit names.UnitTag) ([]state.StorageInstance, error)

UnitStorage returns the storage instances attached to the specified unit.

func VolumeAttachmentFromState Uses

func VolumeAttachmentFromState(v state.VolumeAttachment) (params.VolumeAttachment, error)

VolumeAttachmentFromState converts a state.VolumeAttachment to params.VolumeAttachment.

func VolumeAttachmentInfoFromState Uses

func VolumeAttachmentInfoFromState(info state.VolumeAttachmentInfo) params.VolumeAttachmentInfo

VolumeAttachmentInfoFromState converts a state.VolumeAttachmentInfo to params.VolumeAttachmentInfo.

func VolumeAttachmentInfoToState Uses

func VolumeAttachmentInfoToState(in params.VolumeAttachmentInfo) state.VolumeAttachmentInfo

VolumeAttachmentInfoToState converts a params.VolumeAttachmentInfo to a state.VolumeAttachmentInfo.

func VolumeAttachmentInfosToState Uses

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 VolumeAttachmentPlanBlockInfoFromState Uses

func VolumeAttachmentPlanBlockInfoFromState(blockInfo state.BlockDeviceInfo) storage.BlockDevice

func VolumeAttachmentPlanFromState Uses

func VolumeAttachmentPlanFromState(v state.VolumeAttachmentPlan) (params.VolumeAttachmentPlan, error)

VolumeAttachmentPlanFromState converts a state.VolumeAttachmentPlan to params.VolumeAttachmentPlan.

func VolumeAttachmentPlanInfoFromState Uses

func VolumeAttachmentPlanInfoFromState(planInfo state.VolumeAttachmentPlanInfo) params.VolumeAttachmentPlanInfo

func VolumeAttachmentPlanInfoToState Uses

func VolumeAttachmentPlanInfoToState(in params.VolumeAttachmentPlanInfo) state.VolumeAttachmentPlanInfo

func VolumeAttachmentPlanToState Uses

func VolumeAttachmentPlanToState(in params.VolumeAttachmentPlan) (names.MachineTag, names.VolumeTag, state.VolumeAttachmentPlanInfo, state.BlockDeviceInfo, error)

func VolumeAttachmentToState Uses

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 Uses

func VolumeFromState(v state.Volume) (params.Volume, error)

VolumeFromState converts a state.Volume to params.Volume.

func VolumeInfoFromState Uses

func VolumeInfoFromState(info state.VolumeInfo) params.VolumeInfo

VolumeInfoFromState converts a state.VolumeInfo to params.VolumeInfo.

func VolumeParams Uses

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 Uses

func VolumeToState(v params.Volume) (names.VolumeTag, state.VolumeInfo, error)

VolumeToState converts a params.Volume to state.VolumeInfo and names.VolumeTag.

func VolumesToState Uses

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.

type FilesystemAccess Uses

type FilesystemAccess interface {
    // StorageInstanceFilesystem returns the state.Filesystem assigned
    // to the storage instance with the specified storage tag.
    StorageInstanceFilesystem(names.StorageTag) (state.Filesystem, error)

    // FilesystemAttachment returns the state.FilesystemAttachment
    // corresponding to the specified host and filesystem.
    FilesystemAttachment(names.Tag, names.FilesystemTag) (state.FilesystemAttachment, error)
}

FilesystemAccess is an interface for obtaining information about filesystem storage instances and related entities.

type StorageAccess Uses

type StorageAccess interface {
    // StorageInstance returns the state.StorageInstance corresponding
    // to the specified storage tag.
    StorageInstance(names.StorageTag) (state.StorageInstance, error)

    // UnitStorageAttachments returns the storage attachments for the
    // specified unit.
    UnitStorageAttachments(names.UnitTag) ([]state.StorageAttachment, error)
}

StorageAccess is an interface for obtaining information about storage instances and any associated volume and/or filesystem instances.

type VolumeAccess Uses

type VolumeAccess interface {
    // StorageInstanceVolume returns the state.Volume assigned to the
    // storage instance with the specified storage tag.
    StorageInstanceVolume(names.StorageTag) (state.Volume, error)

    // VolumeAttachment returns the state.VolumeAttachment corresponding
    // to the specified host and volume.
    VolumeAttachment(names.Tag, names.VolumeTag) (state.VolumeAttachment, error)

    // VolumeAttachmentPlan returns state.VolumeAttachmentPlan corresponding
    // to the specified machine and volume
    VolumeAttachmentPlan(names.Tag, names.VolumeTag) (state.VolumeAttachmentPlan, error)

    // BlockDevices returns information about block devices published
    // for the specified machine.
    BlockDevices(names.MachineTag) ([]state.BlockDeviceInfo, error)
}

VolumeAccess is an interface for obtaining information about block storage instances and related entities.

Package storagecommon imports 10 packages (graph) and is imported by 119 packages. Updated 2019-10-23. Refresh now. Tools for package owners.