Common and Misc Libraries

Libraries common throughout Cinder or just ones that haven’t been categorized very well yet.

The cinder.adminclient Module

The cinder.context Module

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

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

Bases: oslo_context.context.RequestContext

Security context and request information.

Represents the user taking a given action within the system.

deepcopy()
elevated(read_deleted=None, overwrite=False)

Return a version of this context with admin flag set.

classmethod from_dict(values)
project_id
read_deleted
to_dict()
user_id
get_admin_context(read_deleted='no')

The cinder.exception Module

Cinder base exception handling.

Includes decorator for re-raising Cinder-type exceptions.

SHOULD include dedicated exception logging.

exception APIException(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Error while requesting %(service)s API.'
exception APITimeout(message=None, **kwargs)

Bases: cinder.exception.APIException

message = u'Timeout while requesting %(service)s API.'
exception AdminRequired(message=None, **kwargs)

Bases: cinder.exception.NotAuthorized

message = u'User does not have admin privileges'
exception BackupDriverException(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Backup driver reported an error: %(message)s'
exception BackupFailedToGetVolumeBackend(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'Failed to identify volume backend.'
exception BackupInvalidCephArgs(message=None, **kwargs)

Bases: cinder.exception.BackupDriverException

message = u'Invalid Ceph args provided for backup rbd operation'
exception BackupLimitExceeded(message=None, **kwargs)

Bases: cinder.exception.QuotaError

message = u'Maximum number of backups allowed (%(allowed)d) exceeded'
exception BackupMetadataUnsupportedVersion(message=None, **kwargs)

Bases: cinder.exception.BackupDriverException

message = u'Unsupported backup metadata version requested'
exception BackupNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'Backup %(backup_id)s could not be found.'
exception BackupOperationError(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'An error has occurred during backup operation'
exception BackupRBDOperationFailed(message=None, **kwargs)

Bases: cinder.exception.BackupDriverException

message = u'Backup RBD operation failed'
exception BackupVerifyUnsupportedDriver(message=None, **kwargs)

Bases: cinder.exception.BackupDriverException

message = u'Unsupported backup verify driver'
exception BadHTTPResponseStatus(message=None, **kwargs)

Bases: cinder.exception.ZadaraException

message = u'Bad HTTP response status %(status)s'
exception BrocadeZoningCliException(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Fibre Channel Zoning CLI error: %(reason)s'
exception CgSnapshotNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'CgSnapshot %(cgsnapshot_id)s could not be found.'
exception CinderException(message=None, **kwargs)

Bases: exceptions.Exception

Base Cinder 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 = u'An unknown exception occurred.'
safe = False
exception CiscoZoningCliException(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Fibre Channel Zoning CLI error: %(reason)s'
exception ConfigNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'Could not find config at %(path)s'
exception ConsistencyGroupNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'ConsistencyGroup %(consistencygroup_id)s could not be found.'
exception ConvertedException(code=0, title='', explanation='')

Bases: webob.exc.WSGIHTTPException

exception CoraidESMBadCredentials(message=None, **kwargs)

Bases: cinder.exception.CoraidException

message = u'Login on ESM failed.'
exception CoraidESMBadGroup(message=None, **kwargs)

Bases: cinder.exception.CoraidException

message = u'Group with name "%(group_name)s" not found.'
exception CoraidESMConfigureError(message=None, **kwargs)

Bases: cinder.exception.CoraidException

message = u'ESM configure request failed: %(reason)s'
exception CoraidESMNotAvailable(message=None, **kwargs)

Bases: cinder.exception.CoraidException

message = u'Coraid ESM not available with reason: %(reason)s'
exception CoraidESMReloginFailed(message=None, **kwargs)

Bases: cinder.exception.CoraidException

message = u'Relogin on ESM failed.'
exception CoraidException(message=None, **kwargs)

Bases: cinder.exception.VolumeDriverException

message = u'Coraid Cinder Driver exception.'
exception CoraidJsonEncodeFailure(message=None, **kwargs)

Bases: cinder.exception.CoraidException

message = u'Failed to encode json data.'
exception DateraAPIException(message=None, **kwargs)

Bases: cinder.exception.VolumeBackendAPIException

message = u'Bad response from Datera API'
exception DeviceUnavailable(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'The device in the path %(path)s is unavailable: %(reason)s'
exception DriverNotInitialized(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Volume driver not ready.'
exception Duplicate(message=None, **kwargs)

Bases: cinder.exception.CinderException

exception DuplicateSfVolumeNames(message=None, **kwargs)

Bases: cinder.exception.Duplicate

message = u'Detected more than one volume with name %(vol_name)s'
exception EMCVnxCLICmdError(message=None, **kwargs)

Bases: cinder.exception.VolumeBackendAPIException

message = u'EMC VNX Cinder Driver CLI exception: %(cmd)s (Return Code: %(rc)s) (Output: %(out)s).'
exception EncryptedBackupOperationFailed(message=None, **kwargs)

Bases: cinder.exception.BackupDriverException

message = u'Backup operation of an encrypted volume failed.'
exception Error

Bases: exceptions.Exception

exception EvaluatorParseException

Bases: exceptions.Exception

message = u'Error during evaluator parsing: %(reason)s'
exception ExportFailure(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Failed to export for volume: %(reason)s'
exception ExtendVolumeError(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Error extending volume: %(reason)s'
exception FCSanLookupServiceException(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Fibre Channel SAN Lookup failure: %(reason)s'
exception FCZoneDriverException(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Fibre Channel Zone operation failed: %(reason)s'
exception FailedCmdWithDump(message=None, **kwargs)

Bases: cinder.exception.VolumeDriverException

message = u'Operation failed with status=%(status)s. Full dump: %(data)s'
exception FileNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'File %(file_path)s could not be found.'
exception GlanceConnectionFailed(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Connection to glance failed: %(reason)s'
exception GlanceMetadataExists(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Glance metadata cannot be updated, key %(key)s exists for volume id %(volume_id)s'
exception GlanceMetadataNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'Glance metadata for volume/snapshot %(id)s cannot be found.'
exception GlusterfsException(message=None, **kwargs)

Bases: cinder.exception.RemoteFSException

message = u'Unknown Gluster exception'
exception GlusterfsNoSharesMounted(message=None, **kwargs)

Bases: cinder.exception.RemoteFSNoSharesMounted

message = u'No mounted Gluster shares found'
exception GlusterfsNoSuitableShareFound(message=None, **kwargs)

Bases: cinder.exception.RemoteFSNoSuitableShareFound

message = u'There is no share which can host %(volume_size)sG'
exception HBSDBusy(message=None, **kwargs)

Bases: cinder.exception.HBSDError

message = 'Device or resource is busy.'
exception HBSDCmdError(message=None, ret=None, err=None)

Bases: cinder.exception.HBSDError

exception HBSDError(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'HBSD error occurs.'
exception HBSDNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'Storage resource could not be found.'
exception HBSDVolumeIsBusy(message=None, **kwargs)

Bases: cinder.exception.VolumeIsBusy

message = u'Volume %(volume_name)s is busy.'
exception HPMSAConnectionError(message=None, **kwargs)

Bases: cinder.exception.HPMSAVolumeDriverException

message = u'Unable to connect to MSA array'
exception HPMSAInvalidVDisk(message=None, **kwargs)

Bases: cinder.exception.HPMSAVolumeDriverException

message = u"VDisk doesn't exist (%(vdisk)s)"
exception HPMSANotEnoughSpace(message=None, **kwargs)

Bases: cinder.exception.HPMSAVolumeDriverException

message = u'Not enough space on VDisk (%(vdisk)s)'
exception HPMSAVolumeDriverException(message=None, **kwargs)

Bases: cinder.exception.VolumeDriverException

message = u'HP MSA Volume Driver exception'
exception HostBinaryNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

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

Bases: cinder.exception.NotFound

message = u'Host %(host)s could not be found.'
exception ISCSITargetAttachFailed(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Failed to attach iSCSI target for volume %(volume_id)s.'
exception ISCSITargetCreateFailed(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Failed to create iscsi target for volume %(volume_id)s.'
exception ISCSITargetDetachFailed(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Failed to detach iSCSI target for volume %(volume_id)s.'
exception ISCSITargetHelperCommandFailed(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'%(error_message)s'
exception ISCSITargetNotFoundForVolume(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'No target id found for volume %(volume_id)s.'
exception ISCSITargetRemoveFailed(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Failed to remove iscsi target for volume %(volume_id)s.'
exception ImageCopyFailure(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Failed to copy image to volume: %(reason)s'
exception ImageNotAuthorized(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Not authorized for image %(image_id)s.'
exception ImageNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'Image %(image_id)s could not be found.'
exception ImageUnacceptable(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Image %(image_id)s is unacceptable: %(reason)s'
exception IncompatibleObjectVersion(message=None, **kwargs)

Bases: cinder.exception.CinderException

msg_fmt = u'Version %(objver)s of %(objname)s is not supported'
exception Invalid(message=None, **kwargs)

Bases: cinder.exception.CinderException

code = 400
message = u'Unacceptable parameters.'
exception Invalid3PARDomain(message=None, **kwargs)

Bases: cinder.exception.VolumeDriverException

message = u'Invalid 3PAR Domain: %(err)s'
exception InvalidAuthKey(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Invalid auth key: %(reason)s'
exception InvalidBackup(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Invalid backup: %(reason)s'
exception InvalidCgSnapshot(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Invalid CgSnapshot: %(reason)s'
exception InvalidConfigurationValue(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Value "%(value)s" is not valid for configuration option "%(option)s"'
exception InvalidConnectorException(message=None, **kwargs)

Bases: cinder.exception.VolumeDriverException

message = u"Connector doesn't have required information: %(missing)s"
exception InvalidConsistencyGroup(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Invalid ConsistencyGroup: %(reason)s'
exception InvalidContentType(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Invalid content type %(content_type)s.'
exception InvalidHost(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Invalid host: %(reason)s'
exception InvalidImageRef(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Invalid image href %(image_href)s.'
exception InvalidInput(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Invalid input received: %(reason)s'
exception InvalidParameterValue(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'%(err)s'
exception InvalidQoSSpecs(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Invalid qos specs: %(reason)s'
exception InvalidQuotaValue(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Change would make usage less than 0 for the following resources: %(unders)s'
exception InvalidReservationExpiration(message=None, **kwargs)

Bases: cinder.exception.Invalid

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

Bases: cinder.exception.Invalid

message = u'The results are invalid.'
exception InvalidSnapshot(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Invalid snapshot: %(reason)s'
exception InvalidUUID(message=None, **kwargs)

Bases: cinder.exception.Invalid

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

Bases: cinder.exception.Invalid

message = u'Invalid volume: %(reason)s'
exception InvalidVolumeAttachMode(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u"Invalid attaching mode '%(mode)s' for volume %(volume_id)s."
exception InvalidVolumeMetadata(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Invalid metadata: %(reason)s'
exception InvalidVolumeMetadataSize(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Invalid metadata size: %(reason)s'
exception InvalidVolumeType(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Invalid volume type: %(reason)s'
exception KeyManagerError(message=None, **kwargs)

Bases: cinder.exception.CinderException

msg_fmt = u'key manager error: %(reason)s'
exception MalformedRequestBody(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Malformed message body: %(reason)s'
exception MalformedResponse(message=None, **kwargs)

Bases: cinder.exception.VolumeDriverException

message = u'Malformed response to command %(cmd)s: %(reason)s'
exception ManageExistingInvalidReference(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Manage existing volume failed due to invalid backend reference %(existing_ref)s: %(reason)s'
exception ManageExistingVolumeTypeMismatch(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Manage existing volume failed due to volume type mismatch: %(reason)s'
exception MetadataCopyFailure(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Failed to copy metadata to volume: %(reason)s'
exception MetadataCreateFailure(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Failed to create metadata for volume: %(reason)s'
exception MetadataUpdateFailure(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Failed to update metadata for volume: %(reason)s'
exception NetAppDriverException(message=None, **kwargs)

Bases: cinder.exception.VolumeDriverException

message = u'NetApp Cinder Driver exception.'
exception NfsException(message=None, **kwargs)

Bases: cinder.exception.RemoteFSException

message = u'Unknown NFS exception'
exception NfsNoSharesMounted(message=None, **kwargs)

Bases: cinder.exception.RemoteFSNoSharesMounted

message = u'No mounted NFS shares found'
exception NfsNoSuitableShareFound(message=None, **kwargs)

Bases: cinder.exception.RemoteFSNoSuitableShareFound

message = u'There is no share which can host %(volume_size)sG'
exception NoMoreTargets(message=None, **kwargs)

Bases: cinder.exception.CinderException

No more available targets.

exception NoValidHost(message=None, **kwargs)

Bases: cinder.exception.CinderException

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

Bases: cinder.exception.CinderException

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

Bases: cinder.exception.CinderException

code = 404
message = u'Resource could not be found.'
safe = True
exception ObjectActionError(message=None, **kwargs)

Bases: cinder.exception.CinderException

msg_fmt = u'Object action %(action)s failed because: %(reason)s'
exception ObjectFieldInvalid(message=None, **kwargs)

Bases: cinder.exception.CinderException

msg_fmt = u'Field %(field)s of %(objname)s is not an instance of Field'
exception OrphanedObjectError(message=None, **kwargs)

Bases: cinder.exception.CinderException

msg_fmt = u'Cannot call %(method)s on orphaned %(objtype)s object'
exception OverQuota(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Quota exceeded for resources: %(overs)s'
exception ParameterNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'Could not find parameter %(param)s'
exception PasteAppNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

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

Bases: cinder.exception.NotAuthorized

message = u"Policy doesn't allow %(action)s to be performed."
exception ProjectQuotaNotFound(message=None, **kwargs)

Bases: cinder.exception.QuotaNotFound

message = u'Quota for project %(project_id)s could not be found.'
exception PureDriverException(message=None, **kwargs)

Bases: cinder.exception.VolumeDriverException

message = u'Pure Storage Cinder driver failure: %(reason)s'
exception QoSSpecsAssociateFailed(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Failed to associate qos_specs: %(specs_id)s with type %(type_id)s.'
exception QoSSpecsCreateFailed(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Failed to create qos_specs: %(name)s with specs %(qos_specs)s.'
exception QoSSpecsDisassociateFailed(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Failed to disassociate qos_specs: %(specs_id)s with type %(type_id)s.'
exception QoSSpecsExists(message=None, **kwargs)

Bases: cinder.exception.Duplicate

message = u'QoS Specs %(specs_id)s already exists.'
exception QoSSpecsInUse(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'QoS Specs %(specs_id)s is still associated with entities.'
exception QoSSpecsKeyNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'QoS spec %(specs_id)s has no spec with key %(specs_key)s.'
exception QoSSpecsNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'No such QoS spec %(specs_id)s.'
exception QoSSpecsUpdateFailed(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Failed to update qos_specs: %(specs_id)s with specs %(qos_specs)s.'
exception QuotaClassNotFound(message=None, **kwargs)

Bases: cinder.exception.QuotaNotFound

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

Bases: cinder.exception.CinderException

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

Bases: cinder.exception.NotFound

message = u'Quota could not be found'
exception QuotaResourceUnknown(message=None, **kwargs)

Bases: cinder.exception.QuotaNotFound

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

Bases: cinder.exception.QuotaNotFound

message = u'Quota usage for project %(project_id)s could not be found.'
exception ReadOnlyFieldError(message=None, **kwargs)

Bases: cinder.exception.CinderException

msg_fmt = u'Cannot modify readonly field %(field)s'
exception RemoteFSException(message=None, **kwargs)

Bases: cinder.exception.VolumeDriverException

message = u'Unknown RemoteFS exception'
exception RemoteFSNoSharesMounted(message=None, **kwargs)

Bases: cinder.exception.RemoteFSException

message = u'No mounted shares found'
exception RemoteFSNoSuitableShareFound(message=None, **kwargs)

Bases: cinder.exception.RemoteFSException

message = u'There is no share which can host %(volume_size)sG'
exception RemoveExportException(message=None, **kwargs)

Bases: cinder.exception.VolumeDriverException

message = u'Failed to remove export for volume %(volume)s: %(reason)s'
exception ReplicationError(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Volume %(volume_id)s replication error: %(reason)s'
exception ReplicationNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'Volume replication for %(volume_id)s could not be found.'
exception ReservationNotFound(message=None, **kwargs)

Bases: cinder.exception.QuotaNotFound

message = u'Quota reservation %(uuid)s could not be found.'
exception SSHInjectionThreat(message=None, **kwargs)

Bases: cinder.exception.CinderException

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

Bases: cinder.exception.NotFound

message = u'Scheduler Host Filter %(filter_name)s could not be found.'
exception SchedulerHostWeigherNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'Scheduler Host Weigher %(weigher_name)s could not be found.'
exception ServerNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'Instance %(uuid)s could not be found.'
exception ServiceNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'Service %(service_id)s could not be found.'
exception ServiceUnavailable(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Service is unavailable at this time.'
exception SfJsonEncodeFailure(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Failed to load data into json format'
exception SmbfsException(message=None, **kwargs)

Bases: cinder.exception.RemoteFSException

message = u'Unknown SMBFS exception.'
exception SmbfsNoSharesMounted(message=None, **kwargs)

Bases: cinder.exception.RemoteFSNoSharesMounted

message = u'No mounted SMBFS shares found.'
exception SmbfsNoSuitableShareFound(message=None, **kwargs)

Bases: cinder.exception.RemoteFSNoSuitableShareFound

message = u'There is no share which can host %(volume_size)sG.'
exception SnapshotIsBusy(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'deleting snapshot %(snapshot_name)s that has dependent volumes'
exception SnapshotLimitExceeded(message=None, **kwargs)

Bases: cinder.exception.QuotaError

message = u'Maximum number of snapshots allowed (%(allowed)d) exceeded'
exception SnapshotMetadataNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'Snapshot %(snapshot_id)s has no metadata with key %(metadata_key)s.'
exception SnapshotNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'Snapshot %(snapshot_id)s could not be found.'
exception SolidFireAPIDataException(message=None, **kwargs)

Bases: cinder.exception.SolidFireAPIException

message = u'Error in SolidFire API response: data=%(data)s'
exception SolidFireAPIException(message=None, **kwargs)

Bases: cinder.exception.VolumeBackendAPIException

message = u'Bad response from SolidFire API'
exception SolidFireAccountNotFound(message=None, **kwargs)

Bases: cinder.exception.SolidFireDriverException

message = u'Unable to locate account %(account_name)s on Solidfire device'
exception SolidFireDriverException(message=None, **kwargs)

Bases: cinder.exception.VolumeDriverException

message = u'SolidFire Cinder Driver exception'
exception SolidFireRetryableException(message=None, **kwargs)

Bases: cinder.exception.VolumeBackendAPIException

message = u'Retryable SolidFire Exception encountered'
exception SwiftConnectionFailed(message=None, **kwargs)

Bases: cinder.exception.BackupDriverException

message = u'Connection to swift failed: %(reason)s'
exception TransferNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'Transfer %(transfer_id)s could not be found.'
exception UnknownCmd(message=None, **kwargs)

Bases: cinder.exception.VolumeDriverException

message = u'Unknown or unsupported command %(cmd)s'
exception UnsupportedObjectError(message=None, **kwargs)

Bases: cinder.exception.CinderException

msg_fmt = u'Unsupported object type %(objtype)s'
exception ViolinBackendErr(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Backend reports: %(message)s'
exception ViolinBackendErrExists(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Backend reports: item already exists'
exception ViolinBackendErrNotFound(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Backend reports: item not found'
exception ViolinInvalidBackendConfig(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Volume backend config is invalid: %(reason)s'
exception ViolinRequestRetryTimeout(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Backend service retry timeout hit: %(timeout)s sec'
exception VolumeAdminMetadataNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'Volume %(volume_id)s has no administration metadata with key %(metadata_key)s.'
exception VolumeAttached(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Volume %(volume_id)s is still attached, detach volume first.'
exception VolumeAttachmentNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'Volume attachment could not be found with filter: %(filter)s .'
exception VolumeBackendAPIException(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Bad or unexpected response from the storage volume backend API: %(data)s'
exception VolumeBackupSizeExceedsAvailableQuota(message=None, **kwargs)

Bases: cinder.exception.QuotaError

message = u'Requested backup exceeds allowed Backup gigabytes quota. Requested %(requested)sG, quota is %(quota)sG and %(consumed)sG has been consumed.'
exception VolumeDriverException(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Volume driver reported an error: %(message)s'
exception VolumeIsBusy(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'deleting volume %(volume_name)s that has snapshot'
exception VolumeLimitExceeded(message=None, **kwargs)

Bases: cinder.exception.QuotaError

message = u'Maximum number of volumes allowed (%(allowed)d) exceeded'
exception VolumeMetadataBackupExists(message=None, **kwargs)

Bases: cinder.exception.BackupDriverException

message = u'Metadata backup already exists for this volume'
exception VolumeMetadataNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'Volume %(volume_id)s has no metadata with key %(metadata_key)s.'
exception VolumeMigrationFailed(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Volume migration failed: %(reason)s'
exception VolumeNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'Volume %(volume_id)s could not be found.'
exception VolumeSizeExceedsAvailableQuota(message=None, **kwargs)

Bases: cinder.exception.QuotaError

message = u'Requested volume or snapshot exceeds allowed gigabytes quota. Requested %(requested)sG, quota is %(quota)sG and %(consumed)sG has been consumed.'
exception VolumeTypeAccessExists(message=None, **kwargs)

Bases: cinder.exception.Duplicate

message = u'Volume type access for %(volume_type_id)s / %(project_id)s combination already exists.'
exception VolumeTypeAccessNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'Volume type access not found for %(volume_type_id)s / %(project_id)s combination.'
exception VolumeTypeCreateFailed(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Cannot create volume_type with name %(name)s and specs %(extra_specs)s'
exception VolumeTypeEncryptionExists(message=None, **kwargs)

Bases: cinder.exception.Invalid

message = u'Volume type encryption for type %(type_id)s already exists.'
exception VolumeTypeEncryptionNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'Volume type encryption for type %(type_id)s does not exist.'
exception VolumeTypeExists(message=None, **kwargs)

Bases: cinder.exception.Duplicate

message = u'Volume Type %(id)s already exists.'
exception VolumeTypeExtraSpecsNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'Volume Type %(volume_type_id)s has no extra specs with key %(extra_specs_key)s.'
exception VolumeTypeInUse(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Volume Type %(volume_type_id)s deletion is not allowed with volumes present with the type.'
exception VolumeTypeNotFound(message=None, **kwargs)

Bases: cinder.exception.NotFound

message = u'Volume type %(volume_type_id)s could not be found.'
exception VolumeTypeNotFoundByName(message=None, **kwargs)

Bases: cinder.exception.VolumeTypeNotFound

message = u'Volume type with name %(volume_type_name)s could not be found.'
exception VolumeTypeUpdateFailed(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Cannot update volume_type %(id)s'
exception WebDAVClientError(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'The WebDAV request failed. Reason: %(msg)s, Return code/reason: %(code)s, Source Volume: %(src)s, Destination Volume: %(dst)s, Method: %(method)s.'
exception XIODriverException(message=None, **kwargs)

Bases: cinder.exception.VolumeDriverException

message = u'X-IO Volume Driver exception!'
exception XtremIOAlreadyMappedError(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Volume to Initiator Group mapping already exists'
exception ZadaraAttachmentsNotFound(message=None, **kwargs)

Bases: cinder.exception.ZadaraException

message = u'Failed to retrieve attachments for volume %(name)s'
exception ZadaraException(message=None, **kwargs)

Bases: cinder.exception.VolumeDriverException

message = u'Zadara Cinder Driver exception.'
exception ZadaraInvalidAttachmentInfo(message=None, **kwargs)

Bases: cinder.exception.ZadaraException

message = u'Invalid attachment info for volume %(name)s: %(reason)s'
exception ZadaraServerCreateFailure(message=None, **kwargs)

Bases: cinder.exception.ZadaraException

message = u'Unable to create server object for initiator %(name)s'
exception ZadaraServerNotFound(message=None, **kwargs)

Bases: cinder.exception.ZadaraException

message = u'Unable to find server object for initiator %(name)s'
exception ZadaraVPSANoActiveController(message=None, **kwargs)

Bases: cinder.exception.ZadaraException

message = u'Unable to find any active VPSA controller'
exception ZoneManagerException(message=None, **kwargs)

Bases: cinder.exception.CinderException

message = u'Fibre Channel connection control failure: %(reason)s'

The cinder.common.config Module

Command-line flag library.

Emulates gflags by wrapping cfg.ConfigOpts.

The idea is to move fully to cfg eventually, and this wrapper is a stepping stone.

The cinder.process Module

The cinder.rpc Module

init(conf)
cleanup()
set_defaults(control_exchange)
add_extra_exmods(*args)
clear_extra_exmods()
get_allowed_exmods()
class RequestContextSerializer(base)

Bases: oslo_messaging.serializer.Serializer

deserialize_context(context)
deserialize_entity(context, entity)
serialize_context(context)
serialize_entity(context, entity)
get_client(target, version_cap=None, serializer=None)
get_server(target, endpoints, serializer=None)
get_notifier(service=None, host=None, publisher_id=None)

The cinder.server Module

The cinder.test Module

Base classes for our unit tests.

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

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

Bases: fixtures.fixture.Fixture

setUp()
class TestCase(*args, **kwargs)

Bases: testtools.testcase.TestCase

Test case base class for all unit tests.

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.
flags(**kw)

Override CONF variables for a test.

log_level(level)

Set logging level to the specified value.

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)
exception TestingException

Bases: exceptions.Exception

The cinder.utils Module

Utilities and helper functions.

class ProtectedExpatParser(forbid_dtd=True, forbid_entities=True, *args, **kwargs)

Bases: xml.sax.expatreader.ExpatParser

An expat parser which disables DTD’s and entities by default.

entity_decl(entityName, is_parameter_entity, value, base, systemId, publicId, notationName)
reset()
start_doctype_decl(name, sysid, pubid, has_internal_subset)
unparsed_entity_decl(name, base, sysid, pubid, notation_name)
add_visible_admin_metadata(volume)

Add user-visible admin metadata to regular metadata.

Extracts the admin metadata keys that are to be made visible to non-administrators, and adds them to the regular metadata structure for the passed-in volume.

as_int(obj, quiet=True)
brick_get_connector(protocol, driver=None, execute=<function execute at 0x2af0d33e8668>, use_multipath=False, device_scan_attempts=3, *args, **kwargs)

Wrapper to get a brick connector object. This automatically populates the required protocol as well as the root_helper needed to execute commands.

brick_get_connector_properties(multipath=False, enforce_multipath=False)

wrapper for the brick calls to automatically set the root_helper needed for cinder.

Parameters:
  • multipath – A boolean indicating whether the connector can support multipath.
  • enforce_multipath – If True, it raises exception when multipath=True is specified but multipathd is not running. If False, it falls back to multipath=False when multipathd is not running.
check_exclusive_options(**kwargs)

Checks that only one of the provided options is actually not-none.

Iterates over all the kwargs passed in and checks that only one of said arguments is not-none, if more than one is not-none then an exception will be raised with the names of those arguments who were not-none.

check_ssh_injection(cmd_list)
check_string_length(value, name, min_length=0, max_length=None)

Check the length of specified string :param value: the value of the string :param name: the name of the string :param min_length: the min_length of the string :param max_length: the max_length of the string

cinderdir()
convert_version_to_int(version)
convert_version_to_str(version_int)
convert_version_to_tuple(version_str)
create_channel(client, width, height)

Invoke an interactive shell session on server.

execute(*cmd, **kwargs)

Convenience wrapper around oslo’s execute() method.

find_config(config_path)

Find a configuration file using the given hint.

Parameters:config_path – Full or relative path to the config.
Returns:Full path of the config, if it exists.
Raises:cinder.exception.ConfigNotFound
generate_glance_url()

Generate the URL to glance.

get_blkdev_major_minor(path, lookup_for_file=True)

Get the device’s “major:minor” number of a block device to control I/O ratelimit of the specified path. If lookup_for_file is True and the path is a regular file, lookup a disk device which the file lies on and returns the result for the device.

get_file_gid(path)

This primarily exists to make unit testing easier.

get_file_mode(path)

This primarily exists to make unit testing easier.

get_file_size(path)

Returns the file size.

get_from_path(items, path)

Returns a list of items matching the specified path.

Takes an XPath-like expression e.g. prop1/prop2/prop3, and for each item in items, looks up items[prop1][prop2][prop3]. Like XPath, if any of the intermediate results are lists it will treat each list item individually. A ‘None’ in items or any child expressions will be ignored, this function will not throw because of None (anywhere) in items. The returned list will contain no None values.

get_root_helper()
hash_file(file_like_object)

Generate a hash for the contents of a file.

is_blk_device(dev)
is_int_like(val)

Check if a value looks like an int.

is_none_string(val)

Check if a string represents a None value.

is_valid_boolstr(val)

Check if the provided string is a valid bool string or not.

last_completed_audit_period(unit=None)

This method gives you the most recently completed audit period.

arguments:
units: string, one of ‘hour’, ‘day’, ‘month’, ‘year’
Periods normally begin at the beginning (UTC) of the period unit (So a ‘day’ period begins at midnight UTC, a ‘month’ unit on the 1st, a ‘year’ on Jan, 1) unit string may be appended with an optional offset like so: 'day@18‘ This will begin the period at 18:00 UTC. 'month@15‘ starts a monthly period on the 15th, and year@3 begins a yearly one on March 1st.
returns: 2 tuple of datetimes (begin, end)
The begin timestamp of this audit period is the same as the end of the previous.
make_dev_path(dev, partition=None, base='/dev')

Return a path to a particular device.

>>> make_dev_path('xvdc')
/dev/xvdc
>>> make_dev_path('xvdc', 1)
/dev/xvdc1
monkey_patch()

If the CONF.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: ‘cinder.api.ec2.cloud:’ cinder.openstack.common.notifier.api.notify_decorator’

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

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

read_file_as_root(file_path)

Secure helper to read file as root.

remove_invalid_filter_options(context, filters, allowed_search_options)

Remove search options that are not valid for non-admin API/context.

require_driver_initialized(driver)

Verifies if driver is initialized

If the driver is not initialized, an exception will be raised.

Params driver:The driver instance.
Raises:exception.DriverNotInitialized
retry(exceptions, interval=1, retries=3, backoff_rate=2)
safe_minidom_parse_string(xml_string)

Parse an XML string using minidom safely.

sanitize_hostname(hostname)

Return a hostname which conforms to RFC-952 and RFC-1123 specs.

service_is_up(service)

Check whether a service is up based on last heartbeat.

tempdir(*args, **kwds)
temporary_chown(*args, **kwds)

Temporarily chown a path.

Params owner_uid:
 UID of temporary owner (defaults to current user)
walk_class_hierarchy(clazz, encountered=None)

Walk class hierarchy, yielding most derived classes first.

xhtml_escape(value)

Escapes a string so it is valid within XML or XHTML.

The cinder.validate Module

The cinder.wsgi Module

Utility methods for working with WSGI servers.

class Application

Bases: object

Base WSGI application wrapper. Subclasses need to implement __call__.

classmethod factory(global_config, **local_config)

Used for paste app factories in paste.deploy config files.

Any local configuration (that is, values under the [app:APPNAME] section of the paste config) will be passed into the __init__ method as kwargs.

A hypothetical configuration would look like:

[app:wadl] latest_version = 1.3 paste.app_factory = cinder.api.fancy_api:Wadl.factory

which would result in a call to the Wadl class as

import cinder.api.fancy_api fancy_api.Wadl(latest_version=‘1.3’)

You could of course re-implement the factory method in subclasses, but using the kwarg passing it shouldn’t be necessary.

class Debug(application)

Bases: cinder.wsgi.Middleware

Helper class for debugging a WSGI application.

Can be inserted into any WSGI application chain to get information about the request and response.

static print_generator(app_iter)

Iterator that prints the contents of a wrapper string.

class Loader(config_path=None)

Bases: object

Used to load WSGI applications from paste configurations.

load_app(name)

Return the paste URLMap wrapped WSGI application.

Parameters:name – Name of the application to load.
Returns:Paste URLMap object wrapping the requested application.
Raises:cinder.exception.PasteAppNotFound
class Middleware(application)

Bases: cinder.wsgi.Application

Base WSGI middleware.

These classes require an application to be initialized that will be called next. By default the middleware will simply call its wrapped app, or you can override __call__ to customize its behavior.

classmethod factory(global_config, **local_config)

Used for paste app factories in paste.deploy config files.

Any local configuration (that is, values under the [filter:APPNAME] section of the paste config) will be passed into the __init__ method as kwargs.

A hypothetical configuration would look like:

[filter:analytics] redis_host = 127.0.0.1 paste.filter_factory = cinder.api.analytics:Analytics.factory

which would result in a call to the Analytics class as

import cinder.api.analytics analytics.Analytics(app_from_paste, redis_host=‘127.0.0.1’)

You could of course re-implement the factory method in subclasses, but using the kwarg passing it shouldn’t be necessary.

process_request(req)

Called on each request.

If this returns None, the next application down the stack will be executed. If it returns a response then that response will be returned and execution will stop here.

process_response(response)

Do whatever you’d like to the response.

class Request(environ, charset=None, unicode_errors=None, decode_param_names=None, **kw)

Bases: webob.request.Request

class Router(mapper)

Bases: object

WSGI middleware that maps incoming requests to WSGI apps.

class Server(name, app, host=None, port=None, pool_size=None, protocol=<class eventlet.wsgi.HttpProtocol at 0x2af0d409cc80>, backlog=128)

Bases: object

Server class to manage a WSGI server, serving a WSGI application.

default_pool_size = 1000
host
port
reset()

Reset server greenpool size to default.

Returns:None
start()

Start serving a WSGI application.

Returns:None
Raises:cinder.exception.InvalidInput
stop()

Stop this server.

This is not a very nice action, as currently the method by which a server is stopped is by killing its eventlet.

Returns:None
wait()

Block, until the server has stopped.

Waits on the server’s eventlet to finish, then returns.

Returns:None

Tests

The declare_conf Module

The conf_fixture Module

set_defaults(conf)

The process_unittest Module

The rpc_unittest Module

The runtime_conf Module

The validator_unittest Module