Libraries common throughout Manila or just ones that haven’t yet been categorized in depth.
RequestContext: context for requests that persist through all of manila.
Bases: object
Security context and request information.
Represents the user taking a given action within the system.
Return a version of this context with admin flag set.
Manila base exception handling.
Includes decorator for re-raising Manila-type exceptions.
SHOULD include dedicated exception logging.
Bases: manila.exception.NotAuthorized
Bases: manila.exception.ManilaException
Bases: manila.exception.NotFound
Bases: webob.exc.WSGIHTTPException
Bases: manila.exception.Invalid
Bases: exceptions.Exception
Bases: manila.exception.NotFound
Bases: manila.exception.ManilaException
Bases: manila.exception.NotFound
Bases: manila.exception.NotFound
Bases: manila.exception.ManilaException
Bases: manila.exception.NotFound
Bases: manila.exception.ManilaException
Bases: manila.exception.Invalid
Bases: manila.exception.Invalid
Bases: manila.exception.Invalid
Bases: manila.exception.Invalid
Bases: manila.exception.Invalid
Bases: manila.exception.Invalid
Bases: manila.exception.Invalid
Bases: manila.exception.Invalid
Bases: manila.exception.Invalid
Bases: manila.exception.Invalid
Bases: manila.exception.Invalid
Bases: manila.exception.Invalid
Bases: manila.exception.Invalid
Bases: manila.exception.Invalid
Bases: manila.exception.Invalid
Bases: manila.exception.ManilaException
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.
Bases: manila.exception.ManilaException
Bases: manila.exception.NotFound
Bases: manila.exception.MigrationNotFound
Bases: manila.exception.ManilaException
Bases: manila.exception.NetworkException
Bases: manila.exception.ManilaException
Bases: manila.exception.ManilaException
Bases: manila.exception.ManilaException
Bases: manila.exception.ManilaException
Bases: manila.exception.ManilaException
Bases: manila.exception.NotFound
Bases: manila.exception.NotAuthorized
Bases: manila.exception.QuotaError
Bases: manila.exception.QuotaNotFound
Bases: manila.exception.QuotaNotFound
Bases: manila.exception.QuotaNotFound
Bases: manila.exception.ManilaException
Bases: manila.exception.ManilaException
Bases: manila.exception.NotFound
Bases: manila.exception.QuotaNotFound
Bases: manila.exception.QuotaNotFound
Bases: manila.exception.QuotaNotFound
Bases: manila.exception.NotFound
Bases: manila.exception.NotFound
Bases: manila.exception.NotFound
Bases: manila.exception.ManilaException
Bases: manila.exception.ServiceInstanceException
Bases: manila.exception.NotFound
Bases: manila.exception.ManilaException
Bases: manila.exception.ManilaException
Bases: manila.exception.ManilaException
Bases: manila.exception.QuotaError
Bases: manila.exception.NotFound
Bases: manila.exception.NotFound
Bases: manila.exception.ManilaException
Bases: manila.exception.ManilaException
Bases: manila.exception.QuotaError
Bases: manila.exception.InUse
Bases: manila.exception.ManilaException
Bases: manila.exception.NotFound
Bases: manila.exception.ShareServerNotFound
Bases: manila.exception.QuotaError
Bases: manila.exception.ManilaException
Bases: manila.exception.NotFound
Bases: manila.exception.QuotaError
Bases: manila.exception.NotFound
Bases: manila.exception.NotFound
Bases: manila.exception.ManilaException
Bases: manila.exception.ManilaException
Bases: manila.exception.NotFound
Bases: manila.exception.ManilaException
Bases: manila.exception.NotFound
Bases: manila.exception.VolumeTypeNotFound
Bases: manila.exception.NetAppException
Bases: manila.exception.ManilaException
Base classes for our unit tests.
Allows overriding of flags for use of fakes, and some black magic for inline callbacks.
Bases: fixtures.fixture.Fixture
Bases: object
Bases: testtools.testcase.TestCase
Test case base class for all unit tests.
Assert a list of dicts are equivalent.
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.
Python < v2.7 compatibility. Assert ‘a’ in ‘b’.
Python < v2.7 compatibility.
Python < v2.7 compatibility.
Python < v2.7 compatibility. Assert ‘a’ NOT in ‘b’.
Assert a sub_dict is subset of super_dict.
Override flag variables for a test.
Run before each test method to initialize test environment.
Runs after each test method to tear down test environment.
Utilities and helper functions.
Bases: object
Bases: object
A pluggable backend loaded lazily based on some value.
Bases: xml.sax.expatreader.ExpatParser
An expat parser which disables DTD’s and entities by default.
Bases: eventlet.pools.Pool
A simple eventlet pool to hold ssh connections.
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.
Close an ssh client and remove it from free_items.
Bases: object
Provides a mechanism to facilitate rolling back a series of actions.
This can be used when an exception is raised.
Rollback a series of actions then re-raise the exception.
Note
(sirp) This should only be called within an exception handler.
Convert cidr to netmask.
Invoke an interactive shell session on server.
Delete a file, but ignore file not found error.
Create a directory (and any ancestor directories required)
Parameters: | path – Directory to create |
---|
Convenience wrapper around oslo’s execute() function.
Open file
see built-in file() documentation for more details
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 an Ethernet MAC address.
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!)
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.
Generate a hash for the contents of a file.
Check if eventlet support IPv6 addresses.
See https://bitbucket.org/eventlet/eventlet/issue/105
Return type: | bool |
---|
Check if system contain IPv6 capable network interface.
Return type: | bool |
---|---|
Raises : | IOError |
Check if the provided string is a valid bool string or not.
Validate IPv4 address.
Valid the address strictly as per format xxx.xxx.xxx.xxx. where xxx is a value between 0 and 255.
This method gives you the most recently completed audit period.
Return a path to a particular device.
>>> make_dev_path('xvdc')
/dev/xvdc
>>> make_dev_path('xvdc', 1)
/dev/xvdc1
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
Read from a file if it has been modified.
Parameters: |
|
---|---|
Returns: | data from file |
Secure helper to read file as root.
Parse an XML string using minidom safely.
Return a hostname which conforms to RFC-952 and RFC-1123 specs.
Check whether a service is up based on last heartbeat.
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.
Temporarily chown a path.
Params owner_uid: | |
---|---|
UID of temporary owner (defaults to current user) |
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()
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).
Convenience wrapper around oslo’s trycmd() function.
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, yielding most derived classes first.
Escapes a string so it is valid within XML or XHTML.
Utility methods for working with WSGI servers.
Bases: object
Base WSGI application wrapper. Subclasses need to implement __call__.
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.
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.
Iterator that prints the contents of a wrapper string.
Bases: object
Used to load WSGI applications from paste configurations.
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 |
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.
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.
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.
Do whatever you’d like to the response.
Bases: webob.request.Request
Bases: object
WSGI middleware that maps incoming requests to WSGI apps.
Bases: object
Server class to manage a WSGI server, serving a WSGI application.
Start serving a WSGI application.
Parameters: | backlog – Maximum number of queued connections. |
---|---|
Returns: | None |
Raises : | manila.exception.InvalidInput |
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 |
---|
Block, until the server has stopped.
Waits on the server’s eventlet to finish, then returns.
Returns: | None |
---|
Bases: object
Acts like the manila.openstack.common.notifier.api module.
Bases: manila.test.TestCase
Bases: manila.test.TestCase
Bases: manila.test.TestCase
Bases: manila.test.TestCase
Bases: manila.test.TestCase