Utilities and helper functions.
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.
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.
Wrapper to get a brick connector object. This automatically populates the required protocol as well as the root_helper needed to execute commands.
wrapper for the brick calls to automatically set the root_helper needed for cinder.
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 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
Invoke an interactive shell session on server.
Convenience wrapper around oslo’s execute() method.
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 the URL to glance.
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!)
This primarily exists to make unit testing easier.
This primarily exists to make unit testing easier.
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 the provided string is a valid bool string or not.
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
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 from a file if it has been modified.
Parameters: |
|
---|---|
Returns: | data from file |
Secure helper to read file as root.
Verifies if driver is initialized
If the driver is not initialized, an exception will be raised.
Params driver: | The driver instance. |
---|---|
Raises: | exception.DriverNotInitialized |
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.
Temporarily chown a path.
Params owner_uid: | |
---|---|
UID of temporary owner (defaults to current user) |
Local total_seconds implementation for compatibility with python 2.6.
Walk class hierarchy, yielding most derived classes first.
Escapes a string so it is valid within XML or XHTML.