Libraries common throughout Cinder or just ones that haven’t been categorized very well yet.
RequestContext: context for requests that persist through all of cinder.
Bases: oslo_context.context.RequestContext
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.
Build and return the Cinder internal tenant context object
This request context will only work for internal Cinder operations. It will not be able to make requests to remote services. To do so it will need to use the keystone client to get an auth_token.
Cinder base exception handling.
Includes decorator for re-raising Cinder-type exceptions.
SHOULD include dedicated exception logging.
Bases: cinder.exception.CinderException
Bases: cinder.exception.APIException
Bases: cinder.exception.NotAuthorized
Bases: cinder.exception.CinderException
Bases: cinder.exception.NotFound
Bases: cinder.exception.BackupDriverException
Bases: cinder.exception.QuotaError
Bases: cinder.exception.BackupDriverException
Bases: cinder.exception.NotFound
Bases: cinder.exception.Invalid
Bases: cinder.exception.BackupDriverException
Bases: cinder.exception.BackupDriverException
Bases: cinder.exception.VolumeDriverException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.NotFound
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.
Bases: cinder.exception.CinderException
Bases: cinder.exception.Duplicate
Bases: cinder.exception.Invalid
Bases: cinder.exception.NotFound
Bases: cinder.exception.VolumeDriverException
Bases: cinder.exception.NotFound
Bases: cinder.exception.NotFound
Bases: webob.exc.WSGIHTTPException
Bases: cinder.exception.VolumeBackendAPIException
Bases: cinder.exception.VolumeBackendAPIException
Bases: cinder.exception.Invalid
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.Duplicate
Bases: cinder.exception.EMCVnxCLICmdError
Bases: cinder.exception.VolumeBackendAPIException
Bases: cinder.exception.BackupDriverException
Bases: exceptions.Exception
Bases: exceptions.Exception
Bases: cinder.exception.Invalid
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.VolumeDriverException
Bases: cinder.exception.NotFound
Bases: cinder.exception.BackupDriverException
Bases: cinder.exception.BackupDriverException
Bases: cinder.exception.BackupDriverException
Bases: cinder.exception.CinderException
Bases: cinder.exception.Invalid
Bases: cinder.exception.NotFound
Bases: cinder.exception.RemoteFSException
Bases: cinder.exception.RemoteFSNoSharesMounted
Bases: cinder.exception.RemoteFSNoSuitableShareFound
Bases: cinder.exception.NotFound
Bases: cinder.exception.NotFound
Bases: cinder.exception.Duplicate
Bases: cinder.exception.NotFound
Bases: cinder.exception.CinderException
Bases: cinder.exception.Invalid
Bases: cinder.exception.NotFound
Bases: cinder.exception.Duplicate
Bases: cinder.exception.CinderException
Bases: cinder.exception.NotFound
Bases: cinder.exception.GroupTypeNotFound
Bases: cinder.exception.NotFound
Bases: cinder.exception.CinderException
Bases: cinder.exception.Duplicate
Bases: cinder.exception.HBSDError
Bases: cinder.exception.HBSDError
Bases: cinder.exception.CinderException
Bases: cinder.exception.NotFound
Bases: cinder.exception.VolumeIsBusy
Bases: cinder.exception.CinderException
Bases: cinder.exception.NotFound
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.NotFound
Bases: cinder.exception.CinderException
Bases: cinder.exception.Invalid
Bases: cinder.exception.QuotaError
Bases: cinder.exception.CinderException
Bases: cinder.exception.NotFound
Bases: cinder.exception.Invalid
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.VolumeDriverException
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.VolumeDriverException
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.CinderException
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.VolumeDriverException
Bases: cinder.exception.VolumeDriverException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.VolumeDriverException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.NotFound
Bases: cinder.exception.CinderException
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.VolumeDriverException
Bases: cinder.exception.VolumeDriverException
Bases: cinder.exception.RemoteFSException
Bases: cinder.exception.RemoteFSNoSharesMounted
Bases: cinder.exception.RemoteFSNoSuitableShareFound
Bases: cinder.exception.CinderException
No more available targets.
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.Invalid
Bases: cinder.exception.CinderException
Bases: cinder.exception.NotFound
Bases: cinder.exception.NotFound
Bases: cinder.exception.NotAuthorized
Bases: cinder.exception.CinderException
Bases: cinder.exception.QuotaNotFound
Bases: cinder.exception.VolumeDriverException
Bases: cinder.exception.VolumeBackendAPIException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.Duplicate
Bases: cinder.exception.CinderException
Bases: cinder.exception.NotFound
Bases: cinder.exception.NotFound
Bases: cinder.exception.CinderException
Bases: cinder.exception.QuotaNotFound
Bases: cinder.exception.CinderException
Bases: cinder.exception.NotFound
Bases: cinder.exception.QuotaNotFound
Bases: cinder.exception.QuotaNotFound
Bases: cinder.exception.CinderException
Bases: cinder.exception.RemoteFSException
Bases: cinder.exception.VolumeDriverException
Bases: cinder.exception.RemoteFSException
Bases: cinder.exception.RemoteFSException
Bases: cinder.exception.VolumeDriverException
Bases: cinder.exception.CinderException
Bases: cinder.exception.NotFound
Bases: cinder.exception.QuotaNotFound
Bases: cinder.exception.CinderException
Bases: cinder.exception.NotFound
Bases: cinder.exception.NotFound
Bases: cinder.exception.NotFound
Bases: cinder.exception.NotFound
Bases: cinder.exception.Invalid
Bases: cinder.exception.Invalid
Bases: cinder.exception.SheepdogError
Bases: cinder.exception.VolumeBackendAPIException
Bases: cinder.exception.RemoteFSException
Bases: cinder.exception.RemoteFSNoSharesMounted
Bases: cinder.exception.RemoteFSNoSuitableShareFound
Bases: cinder.exception.CinderException
Bases: cinder.exception.QuotaError
Bases: cinder.exception.NotFound
Bases: cinder.exception.NotFound
Bases: cinder.exception.VolumeBackendAPIException
Bases: cinder.exception.SolidFireAPIException
Bases: cinder.exception.VolumeBackendAPIException
Bases: cinder.exception.SolidFireDriverException
Bases: cinder.exception.VolumeDriverException
Bases: cinder.exception.VolumeBackendAPIException
Bases: cinder.exception.BackupDriverException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.VolumeBackendAPIException
Bases: cinder.exception.NotFound
Bases: cinder.exception.CinderException
Bases: cinder.exception.QuotaError
Bases: cinder.exception.VolumeDriverException
Bases: cinder.exception.Invalid
Bases: cinder.exception.VolumeBackendAPIException
Bases: cinder.exception.VolumeBackendAPIException
Bases: cinder.exception.NotFound
Bases: cinder.exception.VolumeDriverException
Bases: cinder.exception.VolumeDriverException
Bases: cinder.exception.NotFound
Bases: cinder.exception.NotFound
Bases: cinder.exception.Invalid
Bases: cinder.exception.NotFound
Bases: cinder.exception.CinderException
Bases: cinder.exception.QuotaError
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.QuotaError
Bases: cinder.exception.BackupDriverException
Bases: cinder.exception.NotFound
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.NotFound
Bases: cinder.exception.QuotaError
Bases: cinder.exception.QuotaError
Bases: cinder.exception.Duplicate
Bases: cinder.exception.NotFound
Bases: cinder.exception.CinderException
Bases: cinder.exception.Invalid
Bases: cinder.exception.NotFound
Bases: cinder.exception.Duplicate
Bases: cinder.exception.NotFound
Bases: cinder.exception.CinderException
Bases: cinder.exception.NotFound
Bases: cinder.exception.VolumeTypeNotFound
Bases: cinder.exception.CinderException
Bases: cinder.exception.RemoteFSException
Bases: cinder.exception.RemoteFSNoSharesMounted
Bases: cinder.exception.RemoteFSNoSuitableShareFound
Bases: cinder.exception.CinderException
Bases: cinder.exception.Duplicate
Bases: cinder.exception.NotFound
Bases: cinder.exception.VolumeDriverException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
Bases: cinder.exception.NotFound
Bases: cinder.exception.Invalid
Bases: cinder.exception.VolumeDriverException
Bases: cinder.exception.NotFound
Bases: cinder.exception.VolumeDriverException
Bases: cinder.exception.VolumeDriverException
Bases: cinder.exception.CinderException
Bases: cinder.exception.CinderException
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.
Update default configuration options for oslo.middleware.
Bases: oslo_messaging.serializer.Serializer
Base classes for our unit tests.
Allows overriding of CONF 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 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.
Override CONF variables for a test.
Use python mock to mock an object attribute
Mocks the specified objects attribute with the given value. Automatically performs ‘addCleanup’ for the mock.
Cleanly override CONF variables.
Use python mock to mock a path with automatic cleanup.
Run before each test method to initialize test environment.
Bases: exceptions.Exception
Utilities and helper functions.
Bases: object
Bases: type
Metaclass that wraps all methods of a class with trace_method.
This metaclass will cause every function inside of the class to be decorated with the trace_method decorator.
To use the metaclass you define a class like so: @six.add_metaclass(utils.TraceWrapperMetaclass) class MyClass(object):
Bases: abc.ABCMeta, cinder.utils.TraceWrapperMetaclass
Metaclass that wraps all methods of a class with trace.
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.
Attach encryption layer.
Detach encryption layer.
Wrapper to get a brick connector object.
This automatically populates the required protocol as well as the root_helper needed to execute commands.
Wrapper to automatically set root_helper in brick calls.
Parameters: |
|
---|
Wrapper to get a brick encryptor object.
Builds a string of elements joined by ‘or’.
Will join strings with the ‘or’ word and if a str_format is provided it will be used to format the resulted joined string. If there are no elements an empty string will be returned.
Parameters: |
|
---|
Calculate the virtual free capacity based on thin provisioning support.
Parameters: |
|
---|---|
Returns: | the calculated virtual free capacity. |
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.
Checks that the volume metadata properties are valid.
Check the length of specified string.
Parameters: |
|
---|
Convert to native string.
Convert bytes and Unicode strings to native strings:
Convenience wrapper around oslo’s execute() method.
Get ‘major:minor’ number of block device.
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.
This primarily exists to make unit testing easier.
This primarily exists to make unit testing easier.
Returns the file size.
Check if a string represents a None value.
Check if the provided string is a valid bool string or not.
This method gives you the most recently completed audit period.
Annoy the log about unsupported drivers.
Return a path to a particular device.
>>> make_dev_path('xvdc')
/dev/xvdc
>>> make_dev_path('xvdc', 1)
/dev/xvdc1
Patches decorators for all functions in a specified module.
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)
Parameters: |
|
---|
Secure helper to read file as root.
Remove search options that are not valid for non-admin API/context.
Verifies if driver is initialized
If the driver is not initialized, an exception will be raised.
Params driver: | The driver instance. |
---|---|
Raises: | exception.DriverNotInitialized |
Resolves host name to IP address.
Resolves a host name (my.data.point.com) to an IP address (10.12.143.11). This routine also works if the data passed in hostname is already an IP. In this case, the same IP address will be returned.
Parameters: | hostname – Host name to resolve. |
---|---|
Returns: | IP Address for Host name. |
Robust file write.
Use “write to temp file and rename” model for writing the persistence file.
Parameters: |
|
---|
Return a hostname which conforms to RFC-952 and RFC-1123 specs.
Check whether a service is up based on last heartbeat.
Set global variables for each trace flag.
Sets variables TRACE_METHOD and TRACE_API, which represent whether to log method and api traces.
Parameters: | trace_flags – a list of strings |
---|
Temporarily chown a path.
Params owner_uid: | |
---|---|
UID of temporary owner (defaults to current user) |
Trace calls to the decorated function.
This decorator should always be defined as the outermost decorator so it is defined last. This is important so it does not interfere with other decorators.
Using this decorator on a function will cause its execution to be logged at DEBUG level with arguments, return values, and exceptions.
Returns: | a function decorator |
---|
Decorates a function if TRACE_API is true.
Decorates a function if TRACE_METHOD is true.
Check the length of each key and value of dictionary.
Make sure that value is a valid integer, potentially within range.
Parameters: |
|
---|---|
Returns: | integer |
Walk class hierarchy, yielding most derived classes first.
Bases: cinder.rpc.RPCAPI
Bases: cinder.test.TestCase
Tests RPCAPI mixin aggregating stuff related to RPC compatibility.
Test that with no service latest versions are selected.