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: object

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)
read_deleted
tenant
to_dict()
update_store()
user
generate_request_id()
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 AdminRequired(message=None, **kwargs)

Bases: manila.exception.NotAuthorized

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

Bases: manila.exception.ManilaException

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

Bases: manila.exception.NotFound

message = 'Could not find config at %(path)s.'
exception ConvertedException(code=0, title='', explanation='')

Bases: webob.exc.WSGIHTTPException

exception EMCVnxXMLAPIError(message=None, **kwargs)

Bases: manila.exception.Invalid

message = '%(err)s'
exception Error

Bases: exceptions.Exception

exception FileNotFound(message=None, **kwargs)

Bases: manila.exception.NotFound

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

Bases: manila.exception.ManilaException

message = 'Unknown Gluster exception.'
exception HostBinaryNotFound(message=None, **kwargs)

Bases: manila.exception.NotFound

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

Bases: manila.exception.NotFound

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

Bases: manila.exception.ManilaException

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

Bases: manila.exception.NotFound

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

Bases: manila.exception.ManilaException

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

Bases: manila.exception.Invalid

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

Bases: manila.exception.Invalid

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

Bases: manila.exception.Invalid

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

Bases: manila.exception.Invalid

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

Bases: manila.exception.Invalid

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

Bases: manila.exception.Invalid

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

Bases: manila.exception.Invalid

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

Bases: manila.exception.Invalid

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

Bases: manila.exception.Invalid

message = 'Invalid access_rule: %(reason)s.'
exception InvalidShareMetadata(message=None, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid metadata.'
exception InvalidShareMetadataSize(message=None, **kwargs)

Bases: manila.exception.Invalid

message = 'Invalid metadata size.'
exception InvalidShareSnapshot(message=None, **kwargs)

Bases: manila.exception.Invalid

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

Bases: manila.exception.Invalid

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

Bases: manila.exception.Invalid

message = 'Invalid volume.'
exception InvalidVolumeType(message=None, **kwargs)

Bases: manila.exception.Invalid

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

Bases: manila.exception.ManilaException

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

Bases: exceptions.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 MigrationError(message=None, **kwargs)

Bases: manila.exception.ManilaException

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

Bases: manila.exception.NotFound

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

Bases: manila.exception.MigrationNotFound

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

Bases: manila.exception.ManilaException

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

Bases: manila.exception.NetworkException

message = 'Bad network configuration: %(reason)s.'
exception NetworkException(message=None, **kwargs)

Bases: manila.exception.ManilaException

message = 'Exception due to network failure.'
exception NoValidHost(message=None, **kwargs)

Bases: manila.exception.ManilaException

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

Bases: manila.exception.ManilaException

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

Bases: manila.exception.ManilaException

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

Bases: manila.exception.ManilaException

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

Bases: manila.exception.NotFound

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

Bases: manila.exception.NotAuthorized

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

Bases: manila.exception.QuotaError

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

Bases: manila.exception.QuotaNotFound

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

Bases: manila.exception.QuotaNotFound

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

Bases: manila.exception.QuotaNotFound

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

Bases: manila.exception.ManilaException

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

Bases: manila.exception.ManilaException

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

Bases: manila.exception.NotFound

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

Bases: manila.exception.QuotaNotFound

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

Bases: manila.exception.QuotaNotFound

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

Bases: manila.exception.QuotaNotFound

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

Bases: manila.exception.NotFound

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

Bases: manila.exception.NotFound

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

Bases: manila.exception.NotFound

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

Bases: manila.exception.ManilaException

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

Bases: manila.exception.ServiceInstanceException

message = 'Service Instance is not available.'
exception ServiceNotFound(message=None, **kwargs)

Bases: manila.exception.NotFound

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

Bases: manila.exception.ManilaException

message = 'Share access %(access_type)s:%(access)s exists.'
exception ShareBackendException(message=None, **kwargs)

Bases: manila.exception.ManilaException

message = 'Share backend error: %(msg)s.'
exception ShareIsBusy(message=None, **kwargs)

Bases: manila.exception.ManilaException

message = 'Deleting $(share_name) share that used.'
exception ShareLimitExceeded(message=None, **kwargs)

Bases: manila.exception.QuotaError

message = 'Maximum number of shares allowed (%(allowed)d) exceeded.'
exception ShareMetadataNotFound(message=None, **kwargs)

Bases: manila.exception.NotFound

message = 'Metadata item is not found.'
exception ShareNetworkNotFound(message=None, **kwargs)

Bases: manila.exception.NotFound

message = 'Network %(share_network_id)s could not be found.'
exception ShareNetworkSecurityServiceAssociationError(message=None, **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, **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, **kwargs)

Bases: manila.exception.QuotaError

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

Bases: manila.exception.InUse

message = 'Share Server %(share_server_id)s is in use.'
exception ShareServerNotCreated(message=None, **kwargs)

Bases: manila.exception.ManilaException

message = 'Share Server %(share_server_id)s failed on creation.'
exception ShareServerNotFound(message=None, **kwargs)

Bases: manila.exception.NotFound

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

Bases: manila.exception.ShareServerNotFound

message = 'Share Server could not be found by filters: %(filters_description)s.'
exception ShareSizeExceedsAvailableQuota(message=None, **kwargs)

Bases: manila.exception.QuotaError

message = 'Requested share or snapshot exceeds allowed Gigabytes quota.'
exception ShareSnapshotIsBusy(message=None, **kwargs)

Bases: manila.exception.ManilaException

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

Bases: manila.exception.NotFound

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

Bases: manila.exception.QuotaError

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

Bases: manila.exception.NotFound

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

Bases: manila.exception.NotFound

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

Bases: manila.exception.ManilaException

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

Bases: manila.exception.ManilaException

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

Bases: manila.exception.NotFound

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

Bases: manila.exception.ManilaException

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

Bases: manila.exception.NotFound

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

Bases: manila.exception.VolumeTypeNotFound

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

Bases: manila.exception.NetAppException

message = 'Vserver %(vserver)s is not available.'
exception WillNotSchedule(message=None, **kwargs)

Bases: manila.exception.ManilaException

message = "Host %(host)s is not up or doesn't exist."

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()
setup_sqlite(db_migrate)
class StubOutForTesting(parent)

Bases: object

Set(obj, attr_name, new_attr)
class TestCase(*args, **kwargs)

Bases: testtools.testcase.TestCase

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.

flags(**kw)

Override flag variables for a test.

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 IsAMatcher(expected_value=None)

Bases: object

class LazyPluggable(pivot, **backends)

Bases: object

A pluggable backend loaded lazily based on some value.

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)
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()
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.

class UndoManager

Bases: object

Provides a mechanism to facilitate rolling back a series of actions.

This can be used when an exception is raised.

rollback_and_reraise(msg=None, **kwargs)

Rollback a series of actions then re-raise the exception.

Note

(sirp) This should only be called within an exception handler.

undo_with(undo_func)
cidr_to_netmask(cidr)

Convert cidr to netmask.

create_channel(client, width, height)

Invoke an interactive shell session on server.

debug(arg)
delete_if_exists(pathname)

Delete a file, but ignore file not found error.

ensure_tree(path)

Create a directory (and any ancestor directories required)

Parameters:path – Directory to create
execute(*cmd, **kwargs)

Convenience wrapper around oslo’s execute() function.

fetchfile(url, target)
file_open(*args, **kwargs)

Open file

see built-in file() 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)
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:manila.exception.ConfigNotFound
generate_mac_address()

Generate an Ethernet MAC address.

generate_password(length=20, symbolgroups=('23456789', 'ABCDEFGHJKLMNPQRSTUVWXYZ', 'abcdefghijkmnopqrstuvwxyz'))

Generate a random password from the supplied symbol groups.

At least one symbol from each group will be included. Unpredictable results if length is less than the number of symbol groups.

Believed to be reasonably secure (with a reasonable password length!)

generate_uid(topic, size=8)
generate_username(length=20, symbolgroups=('23456789', 'ABCDEFGHJKLMNPQRSTUVWXYZ', 'abcdefghijkmnopqrstuvwxyz'))
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_my_linklocal(interface)
hash_file(file_like_object)

Generate a hash for the contents of a file.

is_eventlet_bug105()

Check if eventlet support IPv6 addresses.

See https://bitbucket.org/eventlet/eventlet/issue/105

Return type:bool
is_ipv6_configured()

Check if system contain IPv6 capable network interface.

Return type:bool
Raises:IOError
is_valid_boolstr(val)

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

is_valid_ipv4(address)

Validate IPv4 address.

Valid the address strictly as per format xxx.xxx.xxx.xxx. where xxx is a value between 0 and 255.

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.
last_octet(address)
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
maniladir()
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

parse_mailmap(mailmap='.mailmap')
read_cached_file(filename, cache_info, reload_func=None)

Read from a file if it has been modified.

Parameters:
  • cache_info – dictionary to hold opaque cache.
  • reload_func – optional function to be called with data when file is reloaded due to a modification.
Returns:

data from file

read_file_as_root(file_path)

Secure helper to read file as root.

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.

strcmp_const_time(s1, s2)

Constant-time string comparison.

Params s1:the first string
Params s2:the second string
Returns:True if the strings are equal.

This function takes two strings and compares them. It is intended to be used when doing a comparison for authentication purposes to help guard against timing attacks.

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

Temporarily chown a path.

Params owner_uid:
 UID of temporary owner (defaults to current user)
temporary_mutation(*args, **kwds)

Temporarily set the attr on a particular object.

Temporarily set the attr on a particular object to a given value then revert when finished.

One use of this is to temporarily set the read_deleted flag on a context object:

with temporary_mutation(context, read_deleted=”yes”):
do_something_that_needed_deleted_objects()
to_bytes(text, default=0)

Try to turn a string into a number of bytes.

Looks at the last characters of the text to determine what conversion is needed to turn the input text into a byte number.

Supports: B/b, K/k, M/m, G/g, T/t (or the same with b/B on the end).

trycmd(*args, **kwargs)

Convenience wrapper around oslo’s trycmd() function.

utf8(value)

Try to turn a string into utf-8 if possible.

Code is directly from the utf8 function in http://github.com/facebook/tornado/blob/master/tornado/escape.py

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 manila.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 = manila.api.fancy_api:Wadl.factory

which would result in a call to the Wadl class as

import manila.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: manila.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:manila.exception.PasteAppNotFound
class Middleware(application)

Bases: manila.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 = manila.api.analytics:Analytics.factory

which would result in a call to the Analytics class as

import manila.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 0x40069671f0>)

Bases: object

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

default_pool_size = 1000
host
port
start(backlog=128)

Start serving a WSGI application.

Parameters:backlog – Maximum number of queued connections.
Returns:None
Raises:manila.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 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, **kwargs)

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_uuid()
test_invalid_volume()
test_invalid_volume_type()
class ManilaExceptionResponseCode403(*args, **kwargs)

Bases: manila.test.TestCase

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

Bases: manila.test.TestCase

test_config_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_server_not_found()
test_share_server_not_found_by_filters()
test_share_snapshot_not_found()
test_volume_not_found()
test_volume_snapshot_not_found()
test_volume_type_extra_specs_not_found()
test_volume_type_not_found()
test_volume_type_not_found_by_name()
class ManilaExceptionResponseCode413(*args, **kwargs)

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, **kwargs)

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()