Common and Misc Libraries

Common and Misc Libraries

Libraries common throughout manila or just ones that haven’t yet been categorized in depth.

The manila.context Module

RequestContext: context for requests that persist through all of manila.

class RequestContext(user_id, project_id, is_admin=None, read_deleted='no', roles=None, remote_address=None, timestamp=None, request_id=None, auth_token=None, overwrite=True, quota_class=None, service_catalog=None, **kwargs)

Bases: oslo_context.context.RequestContext

Security context and request information.

Represents the user taking a given action within the system.

elevated(read_deleted=None, overwrite=False)

Return a version of this context with admin flag set.

classmethod from_dict(values)

Construct a context object from a provided dictionary.

read_deleted
to_dict()

Return a dictionary of context attributes.

to_policy_values()

A dictionary of context attributes to enforce policy with.

oslo.policy enforcement requires a dictionary of attributes representing the current logged in user on which it applies policy enforcement. This dictionary defines a standard list of attributes that should be available for enforcement across services.

It is expected that services will often have to override this method with either deprecated values or additional attributes used by that service specific policy.

get_admin_context(read_deleted='no')

The manila.exception Module

Manila base exception handling.

Includes decorator for re-raising Manila-type exceptions.

SHOULD include dedicated exception logging.

exception AdminIPNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Admin port IP for service instance not found: %(reason)s'
exception AdminRequired(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotAuthorized

message = 'User does not have admin privileges.'
exception AvailabilityZoneNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Availability zone %(id)s could not be found.'
exception BadConfigurationException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Bad configuration: %(reason)s.'
exception BridgeDoesNotExist(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Bridge %(bridge)s does not exist.'
exception ConfigNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Could not find config at %(path)s.'
exception Conflict(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

code = 409
message = '%(err)s'
exception ConvertedException(code=400, title='', explanation='')

Bases: webob.exc.WSGIHTTPException

exception DefaultShareTypeNotConfigured(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'No default share type is configured. Either configure a default share type or explicitly specify a share type.'
exception DriverNotInitialized(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = "Share driver '%(driver)s' not initialized."
exception EMCUnityError(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ShareBackendException

message = '%(err)s'
exception EMCVmaxInvalidMoverID(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Invalid mover or vdm %(id)s.'
exception EMCVmaxLockRequiredException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Unable to acquire lock(s).'
exception EMCVmaxXMLAPIError(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = '%(err)s'
exception EMCVnxInvalidMoverID(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Invalid mover or vdm %(id)s.'
exception EMCVnxLockRequiredException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Unable to acquire lock(s).'
exception EMCVnxXMLAPIError(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = '%(err)s'
exception Error

Bases: Exception

exception EvaluatorParseException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Error during evaluator parsing: %(reason)s'
exception ExportLocationNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Export location %(uuid)s could not be found.'
exception FileNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'File %(file_path)s could not be found.'
exception Found(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

code = 302
message = 'Resource was found.'
safe = True
exception GPFSException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'GPFS exception occurred.'
exception GPFSGaneshaException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'GPFS Ganesha exception occurred.'
exception GaneshaCommandFailure(**kw)

Bases: oslo_concurrency.processutils.ProcessExecutionError

exception GaneshaException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Unknown NFS-Ganesha library exception.'
exception GlusterfsException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Unknown Gluster exception.'
exception HDFSException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'HDFS exception occurred!'
exception HNASBackendException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'HNAS Backend Exception: %(msg)s'
exception HNASConnException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'HNAS Connection Exception: %(msg)s'
exception HNASDirectoryNotEmpty(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'HNAS Directory is not empty: %(msg)s'
exception HNASItemNotFoundException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.StorageResourceNotFound

message = 'HNAS Item Not Found Exception: %(msg)s'
exception HNASNothingToCloneException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'HNAS Nothing To Clone Exception: %(msg)s'
exception HNASSSCContextChange(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'HNAS SSC Context has been changed unexpectedly: %(msg)s'
exception HNASSSCIsBusy(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'HNAS SSC is busy and cannot execute the command: %(msg)s'
exception HPE3ParInvalid(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = '%(err)s'
exception HPE3ParInvalidClient(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = '%(err)s'
exception HPE3ParUnexpectedError(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = '%(err)s'
exception HSPBackendException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ShareBackendException

message = 'HSP Backend Exception: %(msg)s'
exception HSPItemNotFoundException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ShareBackendException

message = 'HSP Item Not Found Exception: %(msg)s'
exception HSPTimeoutException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ShareBackendException

message = 'HSP Timeout Exception: %(msg)s'
exception HostBinaryNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Could not find binary %(binary)s on host %(host)s.'
exception HostNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Host %(host)s could not be found.'
exception IPAddressInUse(message=None, detail_data={}, **kwargs)

Bases: manila.exception.InUse

message = 'IP address %(ip)s is already used.'
exception InUse(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Resource is in use.'
exception InstanceNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Instance %(instance_id)s could not be found.'
exception Invalid(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

code = 400
message = 'Unacceptable parameters.'
exception InvalidAPIVersionString(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'API Version String %(version)s is of invalid format. Must be of format MajorNum.MinorNum.'
exception InvalidCapacity(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid capacity: %(name)s = %(value)s.'
exception InvalidContentType(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid content type %(content_type)s.'
exception InvalidDriverMode(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid driver mode: %(driver_mode)s.'
exception InvalidExtraSpec(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid extra_spec: %(reason)s.'
exception InvalidGlobalAPIVersion(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Version %(req_ver)s is not supported by the API. Minimum is %(min_ver)s and maximum is %(max_ver)s.'
exception InvalidHost(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid host: %(reason)s'
exception InvalidInput(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid input received: %(reason)s.'
exception InvalidMetadata(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid metadata.'
exception InvalidMetadataSize(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid metadata size.'
exception InvalidParameterValue(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = '%(err)s'
exception InvalidQuotaValue(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Change would make usage less than 0 for the following resources: %(unders)s.'
exception InvalidRequest(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'The request is invalid.'
exception InvalidReservationExpiration(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid reservation expiration %(expire)s.'
exception InvalidResults(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'The results are invalid.'
exception InvalidShare(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid share: %(reason)s.'
exception InvalidShareAccess(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid access rule: %(reason)s'
exception InvalidShareAccessLevel(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid or unsupported share access level: %(level)s.'
exception InvalidShareGroup(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid share group: %(reason)s'
exception InvalidShareGroupSnapshot(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid share group snapshot: %(reason)s'
exception InvalidShareGroupType(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid share group type: %(reason)s.'
exception InvalidShareInstance(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid share instance: %(reason)s.'
exception InvalidShareServer(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Share server %(share_server_id)s is not valid.'
exception InvalidShareSnapshot(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid share snapshot: %(reason)s.'
exception InvalidShareSnapshotInstance(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid share snapshot instance: %(reason)s.'
exception InvalidShareType(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid share type: %(reason)s.'
exception InvalidSnapshotAccess(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid access rule: %(reason)s'
exception InvalidSqliteDB(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid Sqlite database.'
exception InvalidUUID(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Expected a uuid but received %(uuid)s.'
exception InvalidVolume(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid volume.'
exception LockCreationFailed(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Unable to create lock. Coordination backend not started.'
exception LockingFailed(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Lock acquisition failed.'
exception MalformedRequestBody(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Malformed message body: %(reason)s.'
exception ManageExistingShareTypeMismatch(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Manage existing share failed due to share type mismatch: %(reason)s'
exception ManageInvalidShare(message=None, detail_data={}, **kwargs)

Bases: manila.exception.InvalidShare

message = 'Manage existing share failed due to invalid share: %(reason)s'
exception ManageInvalidShareSnapshot(message=None, detail_data={}, **kwargs)

Bases: manila.exception.InvalidShareSnapshot

message = 'Manage existing share snapshot failed due to invalid share snapshot: %(reason)s.'
exception ManageShareServerError(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Manage existing share server failed due to: %(reason)s'
exception ManilaException(message=None, detail_data={}, **kwargs)

Bases: Exception

Base Manila Exception

To correctly use this class, inherit from it and define a ‘message’ property. That message will get printf’d with the keyword arguments provided to the constructor.

code = 500
headers = {}
message = 'An unknown exception occurred.'
safe = False
exception MapRFSException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'MapRFS exception occurred: %(msg)s'
exception MessageNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Message %(message_id)s could not be found.'
exception MigrationError(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Migration error: %(reason)s.'
exception MigrationNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Migration %(migration_id)s could not be found.'
exception MigrationNotFoundByStatus(message=None, detail_data={}, **kwargs)

Bases: manila.exception.MigrationNotFound

message = 'Migration not found for instance %(instance_id)s with status %(status)s.'
exception NetAppException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Exception due to NetApp failure.'
exception NetworkBadConfigurationException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NetworkException

message = 'Bad network configuration: %(reason)s.'
exception NetworkBindException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Exception due to failed port status in binding.'
exception NetworkException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Exception due to network failure.'
exception NexentaException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ShareBackendException

message = 'Exception due to Nexenta failure. %(reason)s'
exception NoValidHost(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'No valid host was found. %(reason)s.'
exception NotAuthorized(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

code = 403
message = 'Not authorized.'
exception NotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

code = 404
message = 'Resource could not be found.'
safe = True
exception OverQuota(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Quota exceeded for resources: %(overs)s.'
exception PasteAppNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = "Could not load paste app '%(name)s' from %(path)s."
exception PolicyNotAuthorized(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotAuthorized

message = "Policy doesn't allow %(action)s to be performed."
exception PortLimitExceeded(message=None, detail_data={}, **kwargs)

Bases: manila.exception.QuotaError

message = 'Maximum number of ports exceeded.'
exception ProjectQuotaNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.QuotaNotFound

message = 'Quota for project %(project_id)s could not be found.'
exception ProjectShareTypeQuotaNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.QuotaNotFound

message = 'Quota for share_type %(share_type)s in project %(project_id)s could not be found.'
exception ProjectUserQuotaNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.QuotaNotFound

message = 'Quota for user %(user_id)s in project %(project_id)s could not be found.'
exception QBException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Quobyte exception occurred: %(msg)s'
exception QBRpcException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

Quobyte backend specific exception.

message = 'Quobyte JsonRpc call to backend raised an exception: %(result)s, Quobyte error code %(qbcode)s'
exception QuotaClassNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.QuotaNotFound

message = 'Quota class %(class_name)s could not be found.'
exception QuotaError(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

code = 413
headers = {'Retry-After': '0'}
message = 'Quota exceeded: code=%(code)s.'
safe = True
exception QuotaExists(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Quota exists for project %(project_id)s, resource %(resource)s.'
exception QuotaNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Quota could not be found.'
exception QuotaResourceUnknown(message=None, detail_data={}, **kwargs)

Bases: manila.exception.QuotaNotFound

message = 'Unknown quota resources %(unknown)s.'
exception QuotaUsageNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.QuotaNotFound

message = 'Quota usage for project %(project_id)s could not be found.'
exception ReplicationException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Unable to perform a replication action: %(reason)s.'
exception ReservationNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.QuotaNotFound

message = 'Quota reservation %(uuid)s could not be found.'
exception SSHException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Exception in SSH protocol negotiation or logic.'
exception SSHInjectionThreat(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'SSH command injection detected: %(command)s'
exception SchedulerHostFilterNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Scheduler host filter %(filter_name)s could not be found.'
exception SchedulerHostWeigherNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Scheduler host weigher %(weigher_name)s could not be found.'
exception SecurityServiceNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Security service %(security_service_id)s could not be found.'
exception ServiceIPNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Service IP for instance not found: %(reason)s'
exception ServiceInstanceException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Exception in service instance manager occurred.'
exception ServiceInstanceUnavailable(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ServiceInstanceException

message = 'Service instance is not available.'
exception ServiceIsDown(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Service %(service)s is down.'
exception ServiceNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Service %(service_id)s could not be found.'
exception ShareAccessExists(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Share access %(access_type)s:%(access)s exists.'
exception ShareAccessMetadataNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Share access rule metadata does not exist.'
exception ShareBackendException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Share backend error: %(msg)s.'
exception ShareBusyException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'Share is busy with an active task: %(reason)s.'
exception ShareCopyDataException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Failed to copy data: %(reason)s'
exception ShareDataCopyCancelled(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Copy of contents from share instance %(src_instance)s to share instance %(dest_instance)s was cancelled.'
exception ShareDataCopyFailed(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Share Data copy failed: %(reason)s'
exception ShareExtendingError(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Share %(share_id)s could not be extended due to error in the driver: %(reason)s'
exception ShareGroupNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Share group %(share_group_id)s could not be found.'
exception ShareGroupSnapshotMemberNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Share group snapshot member %(member_id)s could not be found.'
exception ShareGroupSnapshotNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Share group snapshot %(share_group_snapshot_id)s could not be found.'
exception ShareGroupSnapshotNotSupported(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Share group %(share_group)s does not support snapshots.'
exception ShareGroupSnapshotsLimitExceeded(message=None, detail_data={}, **kwargs)

Bases: manila.exception.QuotaError

message = 'Maximum number of allowed share-group-snapshots is exceeded.'
exception ShareGroupTypeAccessExists(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Share group type access for %(type_id)s / %(project_id)s combination already exists.'
exception ShareGroupTypeAccessNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Share group type access not found for %(type_id)s / %(project_id)s combination.'
exception ShareGroupTypeCreateFailed(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Cannot create share group type with name %(name)s and specs %(group_specs)s.'
exception ShareGroupTypeExists(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Share group type %(type_id)s already exists.'
exception ShareGroupTypeInUse(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Share group Type %(type_id)s deletion is not allowed with groups present with the type.'
exception ShareGroupTypeNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Share group type %(type_id)s could not be found.'
exception ShareGroupTypeNotFoundByName(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ShareTypeNotFound

message = 'Share group type with name %(type_name)s could not be found.'
exception ShareGroupTypeSpecsNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Share group type %(type_id)s has no group specs with key %(specs_key)s.'
exception ShareGroupsLimitExceeded(message=None, detail_data={}, **kwargs)

Bases: manila.exception.QuotaError

message = 'Maximum number of allowed share-groups is exceeded.'
exception ShareLimitExceeded(message=None, detail_data={}, **kwargs)

Bases: manila.exception.QuotaError

message = 'Maximum number of shares allowed (%(allowed)d) either per project/user or share type quota is exceeded.'
exception ShareMetadataNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Metadata item is not found.'
exception ShareMigrationError(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Error in share migration: %(reason)s'
exception ShareMigrationFailed(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Share migration failed: %(reason)s'
exception ShareMountException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Failed to mount share: %(reason)s'
exception ShareNetworkNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Share network %(share_network_id)s could not be found.'
exception ShareNetworkSecurityServiceAssociationError(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Failed to associate share network %(share_network_id)s and security service %(security_service_id)s: %(reason)s.'
exception ShareNetworkSecurityServiceDissociationError(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Failed to dissociate share network %(share_network_id)s and security service %(security_service_id)s: %(reason)s.'
exception ShareNetworksLimitExceeded(message=None, detail_data={}, **kwargs)

Bases: manila.exception.QuotaError

message = 'Maximum number of share-networks allowed (%(allowed)d) exceeded.'
exception ShareNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Share %(share_id)s could not be found.'
exception ShareReplicaNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Share Replica %(replica_id)s could not be found.'
exception ShareResourceNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.StorageResourceNotFound

message = 'Share id %(share_id)s could not be found in storage backend.'
exception ShareServerInUse(message=None, detail_data={}, **kwargs)

Bases: manila.exception.InUse

message = 'Share server %(share_server_id)s is in use.'
exception ShareServerNotCreated(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Share server %(share_server_id)s failed on creation.'
exception ShareServerNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Share server %(share_server_id)s could not be found.'
exception ShareServerNotFoundByFilters(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ShareServerNotFound

message = 'Share server could not be found by filters: %(filters_description)s.'
exception ShareServerNotReady(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = "Share server %(share_server_id)s failed to reach '%(state)s' within %(time)s seconds."
exception ShareShrinkingError(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Share %(share_id)s could not be shrunk due to error in the driver: %(reason)s'
exception ShareShrinkingPossibleDataLoss(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Share %(share_id)s could not be shrunk due to possible data loss'
exception ShareSizeExceedsAvailableQuota(message=None, detail_data={}, **kwargs)

Bases: manila.exception.QuotaError

message = 'Requested share exceeds allowed project/user or share type gigabytes quota.'
exception ShareSnapshotAccessExists(message=None, detail_data={}, **kwargs)

Bases: manila.exception.InvalidInput

message = 'Share snapshot access %(access_type)s:%(access)s exists.'
exception ShareSnapshotInstanceNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Snapshot instance %(instance_id)s could not be found.'
exception ShareSnapshotIsBusy(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Deleting snapshot %(snapshot_name)s that has dependent shares.'
exception ShareSnapshotNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Snapshot %(snapshot_id)s could not be found.'
exception ShareSnapshotNotSupported(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Share %(share_name)s does not support snapshots.'
exception ShareTypeAccessExists(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Share type access for %(share_type_id)s / %(project_id)s combination already exists.'
exception ShareTypeAccessNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Share type access not found for %(share_type_id)s / %(project_id)s combination.'
exception ShareTypeCreateFailed(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Cannot create share_type with name %(name)s and specs %(extra_specs)s.'
exception ShareTypeDoesNotExist(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Share Type %(share_type)s does not exist.'
exception ShareTypeExists(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Share Type %(id)s already exists.'
exception ShareTypeExtraSpecsNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Share Type %(share_type_id)s has no extra specs with key %(extra_specs_key)s.'
exception ShareTypeInUse(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Share Type %(share_type_id)s deletion is not allowed with shares present with the type.'
exception ShareTypeNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Share type %(share_type_id)s could not be found.'
exception ShareTypeNotFoundByName(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ShareTypeNotFound

message = 'Share type with name %(share_type_name)s could not be found.'
exception ShareUmountException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Failed to unmount share: %(reason)s'
exception SnapshotLimitExceeded(message=None, detail_data={}, **kwargs)

Bases: manila.exception.QuotaError

message = 'Maximum number of snapshots allowed (%(allowed)d) either per project/user or share type quota is exceeded.'
exception SnapshotResourceNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.StorageResourceNotFound

message = 'Snapshot %(name)s not found.'
exception SnapshotSizeExceedsAvailableQuota(message=None, detail_data={}, **kwargs)

Bases: manila.exception.QuotaError

message = 'Requested snapshot exceeds allowed project/user or share type gigabytes quota.'
exception SnapshotUnavailable(message=None, detail_data={}, **kwargs)

Bases: manila.exception.StorageResourceException

message = 'Snapshot %(name)s info not available.'
exception StorageCommunicationException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ShareBackendException

message = 'Could not communicate with storage array.'
exception StorageResourceException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'Storage resource exception.'
exception StorageResourceNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.StorageResourceException

code = 404
message = 'Storage resource %(name)s not found.'
exception TegileAPIException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ShareBackendException

message = 'Unexpected response from Tegile IntelliFlash API: %(response)s'
exception UnmanageInvalidShare(message=None, detail_data={}, **kwargs)

Bases: manila.exception.InvalidShare

message = 'Unmanage existing share failed due to invalid share: %(reason)s'
exception UnmanageInvalidShareSnapshot(message=None, detail_data={}, **kwargs)

Bases: manila.exception.InvalidShareSnapshot

message = 'Unmanage existing share snapshot failed due to invalid share snapshot: %(reason)s.'
exception VersionNotFoundForAPIMethod(message=None, detail_data={}, **kwargs)

Bases: manila.exception.Invalid

message = 'API version %(version)s is not supported on this method.'
exception VolumeNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Volume %(volume_id)s could not be found.'
exception VolumeSnapshotNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NotFound

message = 'Snapshot %(snapshot_id)s could not be found.'
exception VserverNotFound(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NetAppException

message = 'Vserver %(vserver)s not found.'
exception VserverNotSpecified(message=None, detail_data={}, **kwargs)

Bases: manila.exception.NetAppException

message = 'Vserver not specified.'
exception WillNotSchedule(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = "Host %(host)s is not up or doesn't exist."
exception ZFSonLinuxException(message=None, detail_data={}, **kwargs)

Bases: manila.exception.ManilaException

message = 'ZFSonLinux exception occurred: %(msg)s'

The manila.test Module

Base classes for our unit tests.

Allows overriding of flags for use of fakes, and some black magic for inline callbacks.

class Database(db_session, db_migrate, sql_connection, sqlite_db, sqlite_clean_db)

Bases: fixtures.fixture.Fixture

setUp()

Prepare the Fixture for use.

This should not be overridden. Concrete fixtures should implement _setUp. Overriding of setUp is still supported, just not recommended.

After setUp has completed, the fixture will have one or more attributes which can be used (these depend totally on the concrete subclass).

Raises:MultipleExceptions if _setUp fails. The last exception captured within the MultipleExceptions will be a SetupError exception.
Returns:None.
Changed in 1.3:The recommendation to override setUp has been reversed - before 1.3, setUp() should be overridden, now it should not be.
Changed in 1.3.1:
 BaseException is now caught, and only subclasses of Exception are wrapped in MultipleExceptions.
setup_sqlite(db_migrate)
class TestCase(*args, **kwds)

Bases: oslotest.base.BaseTestCase

Test case base class for all unit tests.

assertDictListMatch(L1, L2, approx_equal=False, tolerance=0.001)

Assert a list of dicts are equivalent.

assertDictMatch(d1, d2, approx_equal=False, tolerance=0.001)

Assert two dicts are equivalent.

This is a ‘deep’ match in the sense that it handles nested dictionaries appropriately.

NOTE:

If you don’t care (or don’t know) a given value, you can specify the string DONTCARE as the value. This will cause that dict-item to be skipped.
assertIn(a, b, *args, **kwargs)

Python < v2.7 compatibility. Assert ‘a’ in ‘b’.

assertIsInstance(a, b, *args, **kwargs)

Python < v2.7 compatibility.

assertIsNone(a, *args, **kwargs)

Python < v2.7 compatibility.

assertNotIn(a, b, *args, **kwargs)

Python < v2.7 compatibility. Assert ‘a’ NOT in ‘b’.

assertSubDictMatch(sub_dict, super_dict)

Assert a sub_dict is subset of super_dict.

assert_notify_called(mock_notify, calls)
flags(**kw)

Override flag variables for a test.

is_microversion_ge(left, right)
is_microversion_lt(left, right)
mock_class(class_name, new_val=None, **kwargs)

Use python mock to mock a class

Mocks the specified objects attribute with the given value. Automatically performs ‘addCleanup’ for the mock.

mock_object(obj, attr_name, new_attr=None, **kwargs)

Use python mock to mock an object attribute

Mocks the specified objects attribute with the given value. Automatically performs ‘addCleanup’ for the mock.

override_config(name, override, group=None)

Cleanly override CONF variables.

setUp()

Run before each test method to initialize test environment.

start_service(name, host=None, **kwargs)
tearDown()

Runs after each test method to tear down test environment.

The manila.utils Module

Utilities and helper functions.

class ComparableMixin

Bases: object

DO_NOTHING

Class that literrally does nothing.

We inherit from str in case it’s called with json.dumps.

class DoNothing

Bases: str

Class that literrally does nothing.

We inherit from str in case it’s called with json.dumps.

class IsAMatcher(expected_value=None)

Bases: object

class LazyPluggable(pivot, **backends)

Bases: object

A pluggable backend loaded lazily based on some value.

class SSHPool(ip, port, conn_timeout, login, password=None, privatekey=None, *args, **kwargs)

Bases: eventlet.pools.Pool

A simple eventlet pool to hold ssh connections.

create()

Generate a new pool item. In order for the pool to function, either this method must be overriden in a subclass or the pool must be constructed with the create argument. It accepts no arguments and returns a single instance of whatever thing the pool is supposed to contain.

In general, create() is called whenever the pool exceeds its previous high-water mark of concurrently-checked-out-items. In other words, in a new pool with min_size of 0, the very first call to get() will result in a call to create(). If the first caller calls put() before some other caller calls get(), then the first item will be returned, and create() will not be called a second time.

get()

Return an item from the pool, when one is available.

This may cause the calling greenthread to block. Check if a connection is active before returning it. For dead connections create and return a new connection.

remove(ssh)

Close an ssh client and remove it from free_items.

check_params_are_boolean(keys, params, default=False)

Validates if keys in params are boolean.

Parameters:
  • keys – List of keys to check
  • params – Parameters received from REST API
  • default – default value when it does not exist
Returns:

a dictionary with keys and respective retrieved value

check_params_exist(keys, params)

Validates if keys exist in params.

Parameters:
  • keys – List of keys to check
  • params – Parameters received from REST API
check_ssh_injection(cmd_list)
cidr_to_netmask(cidr)

Convert cidr to netmask.

cidr_to_network(cidr)

Convert cidr to network.

cidr_to_prefixlen(cidr)

Convert cidr to prefix length.

convert_str(text)

Convert to native string.

Convert bytes and Unicode strings to native strings:

  • convert to bytes on Python 2: encode Unicode using encodeutils.safe_encode()
  • convert to Unicode on Python 3: decode bytes from UTF-8
execute(*cmd, **kwargs)

Convenience wrapper around oslo’s execute() function.

file_open(*args, **kwargs)

Open file

see built-in open() documentation for more details

Note: The reason this is kept in a separate module is to easily
be able to provide a stub module that doesn’t alter system state at all (for unit tests)
get_bool_from_api_params(key, params, default=False, strict=True)

Parse bool value from request params.

HTTPBadRequest will be directly raised either of the cases below: 1. invalid bool string was found by key(with strict on). 2. key not found while default value is invalid(with strict on).

if_notifications_enabled(function)

Calls decorated method only if notifications are enabled.

is_all_tenants(search_opts)

Checks to see if the all_tenants flag is in search_opts

Parameters:search_opts (dict) – The search options for a request
Returns:boolean indicating if all_tenants are being requested or not
is_valid_ip_address(ip_address, ip_version)
isotime(at=None, subsecond=False)

Stringify time in ISO 8601 format.

monkey_patch()

Patch decorator.

If the Flags.monkey_patch set as True, this function patches a decorator for all functions in specified modules. You can set decorators for each modules using CONF.monkey_patch_modules. The format is “Module path:Decorator function”. Example: ‘manila.api.ec2.cloud:’ manila.openstack.common.notifier.api.notify_decorator’

Parameters of the decorator is as follows. (See manila.openstack.common.notifier.api.notify_decorator)

name - name of the function function - object of the function

notifications_enabled(conf)

Check if oslo notifications are enabled.

require_driver_initialized(func)
retry(exception, interval=1, retries=10, backoff_rate=2, wait_random=False, backoff_sleep_max=None)

A wrapper around retrying library.

This decorator allows to log and to check ‘retries’ input param. Time interval between retries is calculated in the following way: interval * backoff_rate ^ previous_attempt_number

Parameters:
  • exception – expected exception type. When wrapped function raises an exception of this type, the function execution is retried.
  • interval – param ‘interval’ is used to calculate time interval between retries: interval * backoff_rate ^ previous_attempt_number
  • retries – number of retries. Use 0 for an infinite retry loop.
  • backoff_rate – param ‘backoff_rate’ is used to calculate time interval between retries: interval * backoff_rate ^ previous_attempt_number
  • wait_random – boolean value to enable retry with random wait timer.
  • backoff_sleep_max – Maximum number of seconds for the calculated backoff sleep. Use None if no maximum is needed.
service_is_up(service)

Check whether a service is up based on last heartbeat.

synchronized(name, *, lock_file_prefix='manila-', external=False, lock_path=None, semaphores=None, delay=0.01, fair=False)

Synchronization decorator.

Decorating a method like so:

@synchronized('mylock')
def foo(self, *args):
   ...

ensures that only one thread will execute the foo method at a time.

Different methods can share the same lock:

@synchronized('mylock')
def foo(self, *args):
   ...

@synchronized('mylock')
def bar(self, *args):
   ...

This way only one of either foo or bar can be executing at a time.

Changed in version 0.3: Added delay and semaphores optional parameter.

tempdir(**kwargs)
translate_string_size_to_float(string, multiplier='G')

Translates human-readable storage size to float value.

Supported values for ‘multiplier’ are following:
K - kilo | 1 M - mega | 1024 G - giga | 1024 * 1024 T - tera | 1024 * 1024 * 1024 P = peta | 1024 * 1024 * 1024 * 1024
returns:
  • float if correct input data provided
  • None if incorrect
validate_service_host(context, host)
wait_for_access_update(context, db, share_instance, migration_wait_access_rules_timeout)
walk_class_hierarchy(clazz, encountered=None)

Walk class hierarchy, yielding most derived classes first.

write_local_file(filename, contents, as_root=False)
write_remote_file(ssh, filename, contents, as_root=False)

The manila.wsgi Module

Tests

The test_exception Module

class FakeNotifier

Bases: object

Acts like the manila.openstack.common.notifier.api module.

ERROR = 88
notify(context, publisher, event, priority, payload)
class ManilaExceptionResponseCode400(*args, **kwds)

Bases: manila.test.TestCase

test_invalid()
test_invalid_content_type()
test_invalid_input()
test_invalid_parameter_value()
test_invalid_quota_value()
test_invalid_request()
test_invalid_reservation_expiration()
test_invalid_results()
test_invalid_share()
test_invalid_share_access()
test_invalid_share_metadata()
test_invalid_share_metadata_size()
test_invalid_share_snapshot()
test_invalid_share_snapshot_instance()
test_invalid_share_type()
test_invalid_uuid()
test_invalid_volume()
test_manage_invalid_share_snapshot()
test_unmanage_invalid_share_snapshot()
class ManilaExceptionResponseCode403(*args, **kwds)

Bases: manila.test.TestCase

test_admin_required()
test_not_authorized()
test_policy_not_authorized()
class ManilaExceptionResponseCode404(*args, **kwds)

Bases: manila.test.TestCase

test_config_not_found()
test_default_share_type_not_configured()
test_export_location_not_found()
test_file_not_found()
test_host_binary_not_found()
test_host_not_found()
test_instance_not_found()
test_migration_not_found()
test_migration_not_found_by_status()
test_not_found()
test_paste_app_not_found()
test_project_quota_not_found()
test_quota_class_not_found()
test_quota_not_found()
test_quota_resource_unknown()
test_quota_usage_not_found()
test_reservation_not_found()
test_scheduler_host_filter_not_found()
test_scheduler_host_weigher_not_found()
test_security_service_not_found()
test_service_not_found()
test_share_metadata_not_found()
test_share_network_not_found()
test_share_not_found()
test_share_replica_not_found_exception()
test_share_resource_not_found()
test_share_server_not_found()
test_share_server_not_found_by_filters()
test_share_snapshot_not_found()
test_share_type_does_not_exist()
test_share_type_extra_specs_not_found()
test_share_type_not_found()
test_share_type_not_found_by_name()
test_snapshot_instance_not_found()
test_snapshot_resource_not_found()
test_storage_resource_not_found()
test_volume_not_found()
test_volume_snapshot_not_found()
class ManilaExceptionResponseCode413(*args, **kwds)

Bases: manila.test.TestCase

test_port_limit_exceeded()
test_quota_error()
test_share_limit_exceeded()
test_share_networks_limit_exceeded()
test_share_size_exceeds_available_quota()
test_snapshot_limit_exceeded()
class ManilaExceptionTestCase(*args, **kwds)

Bases: manila.test.TestCase

test_default_error_code()
test_default_error_msg()
test_default_error_msg_with_kwargs()
test_error_code_from_kwarg()
test_error_msg()
test_error_msg_exception_with_kwargs()
test_error_msg_is_exception_to_string()
test_exception_kwargs_to_string()
test_exception_multi_kwargs_to_string()
test_exception_not_redundant_period_1_test_message_(msg)
test_exception_not_redundant_period_2_test_message____(msg)
test_exception_not_redundant_period_3__(msg)
test_exception_redundant_period()
test_manage_share_server_error()
test_replication_exception()
test_snapshot_access_already_exists()
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.