Documentation
¶
Index ¶
- type AdoptState
- type FilesystemService
- type FilesystemState
- type Service
- func (s *Service) GetStorageAttachmentUUIDForStorageInstanceAndUnit(ctx context.Context, uuid domainstorage.StorageInstanceUUID, ...) (domainstorage.StorageAttachmentUUID, error)
- func (s *Service) GetStorageInstanceAttachments(ctx context.Context, uuid domainstorage.StorageInstanceUUID) ([]domainstorage.StorageAttachmentUUID, error)
- func (s *Service) GetStorageInstanceInfo(ctx context.Context, uuid domainstorage.StorageInstanceUUID) (domainstorage.StorageInstanceInfo, error)
- func (s *Service) GetStorageInstanceUUIDForID(ctx context.Context, storageID string) (domainstorage.StorageInstanceUUID, error)
- func (s *Service) GetStorageRegistry(ctx context.Context) (internalstorage.ProviderRegistry, error)deprecated
- type State
- type StorageImportService
- func (s *StorageImportService) GetStoragePoolsToImport(ctx context.Context, userPools []description.StoragePool) ([]domainstorage.ImportStoragePoolParams, ...)
- func (s *StorageImportService) ImportFilesystemsCAAS(ctx context.Context, params []domainstorage.ImportFilesystemParams) error
- func (s *StorageImportService) ImportFilesystemsIAAS(ctx context.Context, params []domainstorage.ImportFilesystemParams) error
- func (s *StorageImportService) ImportStorageInstances(ctx context.Context, params []domainstorage.ImportStorageInstanceParams) error
- func (s *StorageImportService) ImportStoragePools(ctx context.Context, pools []domainstorage.ImportStoragePoolParams) error
- func (s *StorageImportService) ImportVolumes(ctx context.Context, params []domainstorage.ImportVolumeParams) error
- func (s *StorageImportService) SetRecommendedStoragePools(ctx context.Context, pools []domainstorage.RecommendedStoragePoolParams) error
- type StorageImportState
- type StoragePoolService
- func (s *StoragePoolService) CreateStoragePool(ctx context.Context, name string, providerType domainstorage.ProviderType, ...) (domainstorage.StoragePoolUUID, error)
- func (s *StoragePoolService) DeleteStoragePool(ctx context.Context, name string) error
- func (s *StoragePoolService) GetStoragePoolByName(ctx context.Context, name string) (domainstorage.StoragePool, error)
- func (s *StoragePoolService) GetStoragePoolUUID(ctx context.Context, name string) (domainstorage.StoragePoolUUID, error)
- func (s *StoragePoolService) GetStoragePoolUUIDsByName(ctx context.Context, names []string) (map[string]domainstorage.StoragePoolUUID, error)
- func (s *StoragePoolService) ListStoragePools(ctx context.Context) ([]domainstorage.StoragePool, error)
- func (s *StoragePoolService) ListStoragePoolsByNames(ctx context.Context, names domainstorage.Names) ([]domainstorage.StoragePool, error)
- func (s *StoragePoolService) ListStoragePoolsByNamesAndProviders(ctx context.Context, names domainstorage.Names, ...) ([]domainstorage.StoragePool, error)
- func (s *StoragePoolService) ListStoragePoolsByProviders(ctx context.Context, providers domainstorage.Providers) ([]domainstorage.StoragePool, error)
- func (s *StoragePoolService) ReplaceStoragePool(ctx context.Context, name string, providerType internalstorage.ProviderType, ...) error
- type StoragePoolState
- type StorageService
- type VolumeService
- type VolumeState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdoptState ¶
type AdoptState interface {
// GetStorageResourceTagInfoForModel retrieves the model based resource tag
// information for storage entities.
GetStorageResourceTagInfoForModel(
ctx context.Context,
resourceTagModelConfigKey string,
) (domainstorageprovisioning.ModelResourceTagInfo, error)
// CreateStorageInstanceWithExistingFilesystem creates a new storage
// instance, with a filesystem using existing provisioned filesystem
// details. It returns the new storage ID for the created storage instance.
CreateStorageInstanceWithExistingFilesystem(
ctx context.Context,
args domainstorageinternal.CreateStorageInstanceWithExistingFilesystem,
) (string, error)
// CreateStorageInstanceWithExistingVolumeBackedFilesystem creates a new
// storage instance, with a filesystem and volume using existing provisioned
// volume details. It returns the new storage ID for the created storage
// instance.
CreateStorageInstanceWithExistingVolumeBackedFilesystem(
ctx context.Context,
args domainstorageinternal.CreateStorageInstanceWithExistingVolumeBackedFilesystem,
) (string, error)
}
AdoptState defines an interface for interacting with the underlying state.
type FilesystemService ¶
type FilesystemService struct {
// contains filtered or unexported fields
}
FilesystemService provides a sub service implementation for working with Filesystems in the model.
func (*FilesystemService) GetFilesystemsByMachines ¶
func (s *FilesystemService) GetFilesystemsByMachines( ctx context.Context, uuids []coremachine.UUID, ) ([]domainstorage.FilesystemUUID, error)
GetFilesystemsByMachine returns a slice of FilesystemUUIDs that are attached to one ore more of the supplied Machine UUIDs.
If an empty list of Machine UUIDs is supplied the caller will get back an empty list of Filesystem UUIDs.
The following errors may be returned: - github.com/juju/juju/core/errors.NotValid when one of the supplied Machine UUIDs is not valid. - github.com/juju/juju/domain/machine/errors.MachineNotFound when one or more of the supplied Machine UUIDs does not exist in the model.
type FilesystemState ¶
type FilesystemState interface {
// GetFilesystemState returns all of the [domainstorage.FilesystemUUID]s in
// the model that are attached to at least one of the supplied
// [coremachine.UUID]s.
//
// Should no Filesystems be attached to any machine in the model an empty
// slice is returned. As well as should an empty list of Machine UUIDs be
// supplied an empty slice is returned with no error.
//
// The following errors may be returned:
// - [domainmachineerrors.MachineNotFound] when one or more the supplied
// machine uuids does not exist in the model.
GetFilesystemUUIDsByMachines(
context.Context, []coremachine.UUID,
) ([]domainstorage.FilesystemUUID, error)
}
type Service ¶
type Service struct {
FilesystemService
StoragePoolService
StorageService
VolumeService
// contains filtered or unexported fields
}
Service defines a service for interacting with the underlying state.
func NewService ¶
func NewService( st State, logger logger.Logger, clock clock.Clock, registryGetter corestorage.ModelStorageRegistryGetter, ) *Service
NewService returns a new Service for interacting with the underlying state.
func (*Service) GetStorageAttachmentUUIDForStorageInstanceAndUnit ¶
func (s *Service) GetStorageAttachmentUUIDForStorageInstanceAndUnit( ctx context.Context, uuid domainstorage.StorageInstanceUUID, unitUUID coreunit.UUID, ) (domainstorage.StorageAttachmentUUID, error)
GetStorageAttachmentUUIDForStorageInstanceAndUnit returns the domainstorageprovisioning.StorageAttachmentUUID associated with the given storage instance id and unit name.
The following errors may be returned: - coreerrors.NotValid when either of the supplied uuids did not pass validation. - storageerrors.StorageNotFound if the storage instance for the supplied uuid no longer exists. - github.com/juju/juju/domain/application/errors.UnitNotFound if the unit no longer exists for the supplied uuid.
func (*Service) GetStorageInstanceAttachments ¶
func (s *Service) GetStorageInstanceAttachments( ctx context.Context, uuid domainstorage.StorageInstanceUUID, ) ([]domainstorage.StorageAttachmentUUID, error)
GetStorageInstanceAttachments returns the set of attachments a storage instance has. If the storage instance has no attachments then an empty slice is returned.
The following errors may be returned: - coreerrors.NotValid when the supplied uuid did not pass validation. - storageerrors.StorageInstanceNotFound if the storage instance for the supplied uuid does not exist.
func (*Service) GetStorageInstanceInfo ¶
func (s *Service) GetStorageInstanceInfo( ctx context.Context, uuid domainstorage.StorageInstanceUUID, ) (domainstorage.StorageInstanceInfo, error)
GetStorageInstanceInfo returns the basic information about a StorageInstance in the model and its attachments onto Unit's.
The following errors may be returned: - github.com/juju/juju/domain/storage/errors.StorageInstanceNotFound when the Storage Instance does not exist in the model. - coreerrors.NotValid when the supplied Storage Instance UUID is not valid.
func (*Service) GetStorageInstanceUUIDForID ¶
func (s *Service) GetStorageInstanceUUIDForID( ctx context.Context, storageID string, ) (domainstorage.StorageInstanceUUID, error)
GetStorageInstanceUUIDForID returns the StorageInstanceUUID for the given storage ID.
The following errors may be returned: - github.com/juju/juju/domain/storage/errors.StorageInstanceNotFound if no storage instance exists for the provided storage id.
func (*Service) GetStorageRegistry
deprecated
func (s *Service) GetStorageRegistry(ctx context.Context) (internalstorage.ProviderRegistry, error)
GetStorageRegistry returns the storage registry for the model.
Deprecated: This method will be removed once the storage registry is fully implemented in each service.
type State ¶
type State interface {
AdoptState
FilesystemState
StoragePoolState
VolumeState
// GetStorageAttachmentUUIDForStorageInstanceAndUnit returns the
// [domainstorageprovisioning.StorageAttachmentUUID] associated with the given
// storage instance uuid and unit uuid.
//
// The following errors may be returned:
// - [github.com/juju/juju/domain/storage/errors.StorageInstanceNotFound]
// if the storage instance for the supplied uuid no longer exists.
// - [github.com/juju/juju/domain/application/errors.UnitNotFound] if the
// unit no longer exists for the supplied uuid.
GetStorageAttachmentUUIDForStorageInstanceAndUnit(
context.Context,
domainstorage.StorageInstanceUUID,
coreunit.UUID,
) (domainstorage.StorageAttachmentUUID, error)
// GetStorageInstanceAttachments returns the set of attachments a storage
// instance has. If the storage instance has no attachments then an empty
// slice.
//
// The following errors may be returned:
// - [github.com/juju/juju/domain/storage/errors.StorageInstanceNotFound]
// if the storage instance for the supplied uuid does not exist.
GetStorageInstanceAttachments(
context.Context,
domainstorage.StorageInstanceUUID,
) ([]domainstorage.StorageAttachmentUUID, error)
// GetStorageInstanceInfo returns the information about a single Storage
// Instance in the model.
//
// The following errors may be returned:
// - [github.com/juju/juju/domain/storage/errors.StorageInstanceNotFound]
// when no Storage Instance exists for the supplied uuid.
GetStorageInstanceInfo(
context.Context, domainstorage.StorageInstanceUUID,
) (internal.StorageInstanceInfo, error)
// GetStorageInstanceUUIDByID retrieves the UUID of a storage instance by
// its ID.
//
// The following errors may be returned:
// - [storageprovisioningerrors.StorageInstanceNotFound] when no storage
// instance exists for the provided ID.
GetStorageInstanceUUIDByID(
ctx context.Context, storageID string,
) (domainstorage.StorageInstanceUUID, error)
}
State defines an interface for interacting with the underlying state.
type StorageImportService ¶
type StorageImportService struct {
// contains filtered or unexported fields
}
StorageImportService defines a service for importing storage entities during model import.
func NewImportService ¶
func NewImportService( st StorageImportState, logger logger.Logger, registryGetter corestorage.ModelStorageRegistryGetter, ephemeralProviderRunner providertracker.EphemeralProviderRunnerGetter[internalstorage.FilesystemModelMigration], ) *StorageImportService
NewImportService returns a new StorageImportService for interacting with the underlying state during model migration import.
func (*StorageImportService) GetStoragePoolsToImport ¶
func (s *StorageImportService) GetStoragePoolsToImport( ctx context.Context, userPools []description.StoragePool, ) ( []domainstorage.ImportStoragePoolParams, []domainstorage.RecommendedStoragePoolParams, error, )
GetStoragePoolsToImport resolves the full set of storage pools to create during model import.
It starts with user-defined storage pools from the description model, ensuring they take precedence over provider default pools on name and provider conflicts. Provider default pools are then added where safe, followed by resolving any recommended storage pools from the registry.
The function returns:
- A slice of storage pools that should be created during import
- A slice of recommended storage pools referencing existing or newly created pools
func (*StorageImportService) ImportFilesystemsCAAS ¶
func (s *StorageImportService) ImportFilesystemsCAAS( ctx context.Context, params []domainstorage.ImportFilesystemParams) error
ImportFilesystemsCAAS imports filesystems for CAAS models. It differs from ImportFilesystemsIAAS in that it must find the persistent volume claim name to be used as the attachment ProviderID.
func (*StorageImportService) ImportFilesystemsIAAS ¶
func (s *StorageImportService) ImportFilesystemsIAAS(ctx context.Context, params []domainstorage.ImportFilesystemParams) error
ImportFilesystemsIAAS imports filesystems from the provided parameters for IAAS models.
The following errors may be returned: - coreerrors.NotValid when any of the params did not pass validation. - domainstorageerrors.StoragePoolNotFound when any of the specified storage pools do not exist. - domainstorageerrors.ProviderTypeNotFound when the provider type for any of the specified storage pools cannot be found in the storage registry. - domainstorageerrors.StorageInstanceNotFound when any of the provided IDs do not have a corresponding storage instance. - applicationerrors.UnitNotFound when a host unit name is provided but not found in the model. - machineerrors.MachineNotFound when a host machine name is provided but not found in the model.
func (*StorageImportService) ImportStorageInstances ¶
func (s *StorageImportService) ImportStorageInstances(ctx context.Context, params []domainstorage.ImportStorageInstanceParams) error
ImportStorageInstances imports storage instances and storage unit owners. Storage unit owners are created if the unit name is provided.
The following errors may be returned: - coreerrors.NotValid when any of the params did not pass validation. - applicationerrors.UnitNotFound when a unit name is provided but not found in the model.
func (*StorageImportService) ImportStoragePools ¶
func (s *StorageImportService) ImportStoragePools( ctx context.Context, pools []domainstorage.ImportStoragePoolParams, ) error
ImportStoragePools creates new storage pools with the slice of domainstorage.ImportStoragePoolParams . This is slightly different to [CreateStoragePools] because:
- the storage pool name validation uses a legacy regex and,
- the storage pools could be user-defined and provider default.
The following errors may be returned: - domainstorageerrors.StoragePoolNameInvalid when the supplied storage pool name is considered invalid or empty. - domainstorageerrors.ProviderTypeInvalid when the supplied provider type value is invalid for further use. - domainstorageerrors.ProviderTypeNotFound when the supplied provider type is not known to the controller. - domainstorageerrors.StoragePoolAlreadyExists when a storage pool for the supplied name already exists in the model. - domainstorageerrors.StoragePoolAttributeInvalid when one of the supplied storage pool attributes is invalid.
func (*StorageImportService) ImportVolumes ¶
func (s *StorageImportService) ImportVolumes(ctx context.Context, params []domainstorage.ImportVolumeParams) error
ImportVolumes creates new volumes and storage instance volumes.
The following errors may be returned: - coreerrors.NotValid when any of the args did not pass validation. - domainstorageerrors.ProviderTypeNotFound if storage provider was not found. - domainstorageerrors.StorageInstanceNotFound if the storage ID was not found. - domainstorageerrors.StoragePoolNotFound if any of the storage pools do not exist. - applicationerrors.UnitNotFound when a host unit name is provided but not found in the model. - machineerrors.MachineNotFound when a host machine name is provided but not found in the model.
func (*StorageImportService) SetRecommendedStoragePools ¶
func (s *StorageImportService) SetRecommendedStoragePools(ctx context.Context, pools []domainstorage.RecommendedStoragePoolParams) error
SetRecommendedStoragePools persists the set of recommended storage pools that are to be used for a model.
type StorageImportState ¶
type StorageImportState interface {
// CreateStoragePool creates a new storage pool in the model with the
// specified args and uuid value.
//
// The following errors can be expected:
// - [storageerrors.PoolAlreadyExists] if a pool with the same name or
// uuid already exist in the model.
CreateStoragePool(context.Context, internal.CreateStoragePool) error
// GetBlockDevicesForMachinesByNetNodeUUIDs returns the BlockDevices for the
// specified machines. If a machine is not found or dead then it is excluded
// from the result.
GetBlockDevicesForMachinesByNetNodeUUIDs(
ctx context.Context, netNodeUUIDs []network.NetNodeUUID,
) (map[network.NetNodeUUID][]internal.BlockDevice, error)
// and unit names provided. If a machine name or unit name is not found then it
// is excluded from the result.
GetNetNodeUUIDsByMachineOrUnitName(
ctx context.Context,
machines []machine.Name,
units []unit.Name,
) (map[machine.Name]network.NetNodeUUID, map[unit.Name]network.NetNodeUUID, error)
// GetStorageInstanceUUIDsByIDs retrieves the UUIDs of storage instances by
// their IDs.
GetStorageInstanceUUIDsByIDs(ctx context.Context, storageIDs []string) (map[string]domainstorage.StorageInstanceUUID, error)
// GetStoragePoolProvidersByNames returns a map of storage pool names to their
// provider types for the specified storage pool names.
GetStoragePoolProvidersByNames(ctx context.Context, names []string) (map[string]string, error)
// GetUnitUUIDsByNames returns a map of unit names to unit UUIDs for the provided
// unit names.
GetUnitUUIDsByNames(ctx context.Context, units []string) (map[string]string, error)
// ImportFilesystemsIAAS imports filesystems from the provided parameters
// for IAAS models.
ImportFilesystemsIAAS(
ctx context.Context,
fsArgs []internal.ImportFilesystemArgs,
attachmentArgs []internal.ImportFilesystemAttachmentArgs,
) error
// ImportStorageInstances imports storage instances, storage attachments, and
// storage unit owners if the unit name is provided.
ImportStorageInstances(
ctx context.Context,
instanceArgs []internal.ImportStorageInstanceArgs,
attachmentArgs []internal.ImportStorageInstanceAttachmentArgs,
) error
// ImportVolumes creates new storage volumes and related database structures.
ImportVolumes(ctx context.Context, args []internal.ImportVolumeArgs) error
// SetModelStoragePools replaces the model's recommended storage pools with the
// supplied set. All existing model storage pool mappings are removed before the
// new ones are inserted.
//
// If any referenced storage pool UUID does not exist in the model, this
// returns [domainstorageerrors.StoragePoolNotFound]. Supplying an empty slice
// results in a no-op.
SetModelStoragePools(ctx context.Context, pools []domainstorage.RecommendedStoragePoolArg) error
}
StorageImportState defines an interface for interacting with the underlying state for storage import operations.
type StoragePoolService ¶
type StoragePoolService struct {
// contains filtered or unexported fields
}
StoragePoolService defines a service for interacting with the underlying state.
func (*StoragePoolService) CreateStoragePool ¶
func (s *StoragePoolService) CreateStoragePool( ctx context.Context, name string, providerType domainstorage.ProviderType, attrs map[string]any, ) (domainstorage.StoragePoolUUID, error)
CreateStoragePool creates a new storage pool with the given name and provider in the model. Returned is the unique uuid for the new storage pool.
The following errors may be returned: - domainstorageerrors.StoragePoolNameInvalid when the supplied storage pool name is considered invalid or empty. - domainstorageerrors.ProviderTypeInvalid when the supplied provider type value is invalid for further use. - domainstorageerrors.ProviderTypeNotFound when the supplied provider type is not known to the controller. - domainstorageerrors.StoragePoolAlreadyExists when a storage pool for the supplied name already exists in the model. - domainstorageerrors.StoragePoolAttributeInvalid when one of the supplied storage pool attributes is invalid.
func (*StoragePoolService) DeleteStoragePool ¶
func (s *StoragePoolService) DeleteStoragePool(ctx context.Context, name string) error
DeleteStoragePool deletes a storage pool with the specified name. The following errors can be expected: - domainstorageerrors.StoragePoolNotFound if a pool with the specified name does not exist.
func (*StoragePoolService) GetStoragePoolByName ¶
func (s *StoragePoolService) GetStoragePoolByName(ctx context.Context, name string) (domainstorage.StoragePool, error)
GetStoragePoolByName returns the storage pool with the specified name. The following errors can be expected: - domainstorageerrors.StoragePoolNotFound if a pool with the specified name does not exist.
func (*StoragePoolService) GetStoragePoolUUID ¶
func (s *StoragePoolService) GetStoragePoolUUID(ctx context.Context, name string) (domainstorage.StoragePoolUUID, error)
GetStoragePoolUUID returns the UUID of the storage pool for the specified name. The following errors can be expected: - domainstorageerrors.StoragePoolNotFound if a pool with the specified name does not exist. - domainstorageerrors.StoragePoolNameInvalid if the pool name is not valid.
func (*StoragePoolService) GetStoragePoolUUIDsByName ¶
func (s *StoragePoolService) GetStoragePoolUUIDsByName( ctx context.Context, names []string, ) (map[string]domainstorage.StoragePoolUUID, error)
GetStoragePoolUUIDsByName returns storage pool UUIDs keyed by pool name for the supplied names. Unknown names are omitted. If no names are specified, an empty map is returned without error.
func (*StoragePoolService) ListStoragePools ¶
func (s *StoragePoolService) ListStoragePools(ctx context.Context) ([]domainstorage.StoragePool, error)
ListStoragePools returns all of the storage pools available in the model.
func (*StoragePoolService) ListStoragePoolsByNames ¶
func (s *StoragePoolService) ListStoragePoolsByNames( ctx context.Context, names domainstorage.Names, ) ([]domainstorage.StoragePool, error)
ListStoragePoolsByNames returns the storage pools matching the specified names, including the default storage pools. If no names are specified, an empty slice is returned without an error. If no storage pools match the criteria, an empty slice is returned without an error.
func (*StoragePoolService) ListStoragePoolsByNamesAndProviders ¶
func (s *StoragePoolService) ListStoragePoolsByNamesAndProviders( ctx context.Context, names domainstorage.Names, providers domainstorage.Providers, ) ([]domainstorage.StoragePool, error)
ListStoragePoolsByNamesAndProviders returns the storage pools matching the specified names and providers, including the default storage pools. If no names and providers are specified, an empty slice is returned without an error. If no storage pools match the criteria, an empty slice is returned without an error.
func (*StoragePoolService) ListStoragePoolsByProviders ¶
func (s *StoragePoolService) ListStoragePoolsByProviders( ctx context.Context, providers domainstorage.Providers, ) ([]domainstorage.StoragePool, error)
ListStoragePoolsByProviders returns the storage pools matching the specified providers, including the default storage pools. If no providers are specified, an empty slice is returned without an error. If no storage pools match the criteria, an empty slice is returned without an error.
func (*StoragePoolService) ReplaceStoragePool ¶
func (s *StoragePoolService) ReplaceStoragePool( ctx context.Context, name string, providerType internalstorage.ProviderType, attrs map[string]any, ) error
ReplaceStoragePool replaces an existing storage pool with the specified configuration. The following errors can be expected: - domainstorageerrors.StoragePoolNotFound if a pool with the specified name does not exist. - domainstorageerrors.StoragePoolNameInvalid if the pool name is not valid.
type StoragePoolState ¶
type StoragePoolState interface {
// CreateStoragePool creates a new storage pool in the model with the
// specified args and uuid value.
//
// The following errors can be expected:
// - [storageerrors.PoolAlreadyExists] if a pool with the same name or
// uuid already exist in the model.
CreateStoragePool(context.Context, domainstorageinternal.CreateStoragePool) error
// DeleteStoragePool deletes a storage pool with the specified name.
// The following errors can be expected:
// - [storageerrors.PoolNotFoundError] if a pool with the specified name does not exist.
DeleteStoragePool(ctx context.Context, name string) error
// ReplaceStoragePool replaces an existing storage pool with the specified configuration.
// The following errors can be expected:
// - [storageerrors.PoolNotFoundError] if a pool with the specified name does not exist.
ReplaceStoragePool(ctx context.Context, pool domainstorage.StoragePool) error
// ListStoragePools returns the storage pools including default storage pools.
ListStoragePools(ctx context.Context) ([]domainstorage.StoragePool, error)
// ListStoragePoolsByNamesAndProviders returns the storage pools matching the specified
// names and or providers, including the default storage pools.
// If no storage pools match the criteria, an empty slice is returned without an error.
ListStoragePoolsByNamesAndProviders(
ctx context.Context, names, providers []string,
) ([]domainstorage.StoragePool, error)
// ListStoragePoolsByNames returns the storage pools matching the specified names, including
// the default storage pools.
// If no names are specified, an empty slice is returned without an error.
// If no storage pools match the criteria, an empty slice is returned without an error.
ListStoragePoolsByNames(
ctx context.Context, names []string,
) ([]domainstorage.StoragePool, error)
// ListStoragePoolsByProviders returns the storage pools matching the specified
// providers, including the default storage pools.
// If no providers are specified, an empty slice is returned without an error.
// If no storage pools match the criteria, an empty slice is returned without an error.
ListStoragePoolsByProviders(
ctx context.Context, providers []string,
) ([]domainstorage.StoragePool, error)
// GetStoragePoolUUID returns the UUID of the storage pool for the specified name.
// The following errors can be expected:
// - [storageerrors.PoolNotFoundError] if a pool with the specified name does not exist.
GetStoragePoolUUID(ctx context.Context, name string) (domainstorage.StoragePoolUUID, error)
// GetStoragePool returns the storage pool for the specified UUID.
// The following errors can be expected:
// - [storageerrors.PoolNotFoundError] if a pool with the specified UUID does not exist.
GetStoragePool(ctx context.Context, poolUUID domainstorage.StoragePoolUUID) (domainstorage.StoragePool, error)
// GetStoragePoolUUIDsByName returns storage pool UUIDs keyed by pool name for
// the supplied names. Unknown names are omitted.
// If no names are specified, an empty map is returned without error.
GetStoragePoolUUIDsByName(ctx context.Context, names []string) ([]domainstorage.StoragePoolNameUUID, error)
}
StoragePoolState defines an interface for interacting with the underlying state of storage pools in the model.
type StorageService ¶
type StorageService struct {
// contains filtered or unexported fields
}
StorageService defines a service for storage related behaviour.
func (*StorageService) AdoptFilesystem ¶
func (s *StorageService) AdoptFilesystem( ctx context.Context, storageName domainstorage.Name, poolUUID domainstorage.StoragePoolUUID, providerID string, force bool, ) (corestorage.ID, error)
AdoptFilesystem adopts a filesystem by invoking the provider of the given storage pool to identify the filesystem on the given natural entity specified by the provider ID (e.g. a filesystem on a volume or a filesystem directly). The result of this call is the name of a new storage instance using the given storage name. The following errors can be expected: - domainstorageerrors.StoragePoolNotFound if the specified storage pool does not exist. - domainstorageerrors.StorageEntityNotFoundInPool if the pool name is not valid. - domainstorageerrors.InvalidStorageName if the storage name is not valid. - coreerrors.NotValid if the storage pool uuid is not valid. - domainstorageerrors.ProviderTypeNotFound if the storage pool refers to a missing storage provider type. - domainstorageerrors.AdoptionNotSupported if the storage provider referred to by the specified storage pool does not support adopting storage entities or does not support adopting the specified storage entity.
type VolumeService ¶
type VolumeService struct {
// contains filtered or unexported fields
}
VolumeService provides a sub service implementation for working with Volumes in the model.
func (*VolumeService) GetVolumesByMachines ¶
func (s *VolumeService) GetVolumesByMachines( ctx context.Context, uuids []coremachine.UUID, ) ([]domainstorage.VolumeUUID, error)
GetVolumesByMachines returns a slice of VolumeUUIDs that are attached to one ore more of the supplied Machine UUIDs.
If an empty list of Machine UUIDs is supplied the caller will get back an empty list of Volume UUIDs.
The following errors may be returned: - github.com/juju/juju/core/errors.NotValid when one of the supplied Machine UUIDs is not valid. - github.com/juju/juju/domain/machine/errors.MachineNotFound when one or more of the supplied Machine UUIDs does not exist in the model.
type VolumeState ¶
type VolumeState interface {
// GetVolumeUUIDsByMachines returns all of the [domainstorage.VolumeUUID]s in
// the model that are attached to at least one of the supplied
// [coremachine.UUID]s.
//
// Should no Volumes be attached to any machine in the model an empty slice is
// returned. As well as should an empty list of Machine UUIDs be supplied an
// empty slice is returned with no error.
//
// The following errors may be returned:
// - [domainmachineerrors.MachineNotFound] when one or more the supplied machine
// uuids does not exist in the model.
GetVolumeUUIDsByMachines(
context.Context, []coremachine.UUID,
) ([]domainstorage.VolumeUUID, error)
}
VolumeState describes the state layer interface required for getting Volume information in the model.