module documentation

ExtStorage Interface related functionality

Class ExtStorageDevice A block device provided by an ExtStorage Provider.
Function ExtStorageFromDisk Create an ExtStorage instance from disk.
Function _CheckExtStorageFile Check prereqs for an ExtStorage file.
Function _ExtStorageAction Take an External Storage action.
Function _ExtStorageEnvironment Calculate the environment for an External Storage script.
Function _VolumeLogName Compute the ExtStorage log filename for a given Volume and operation.
def ExtStorageFromDisk(name, base_dir=None):

Create an ExtStorage instance from disk.

This function will return an ExtStorage instance if the given name is a valid ExtStorage name.

Parameters
nameUndocumented
base_dir:stringBase directory containing ExtStorage installations. Defaults to a search in all the ES_SEARCH_PATH dirs.
Returns
tupleTrue and the ExtStorage instance if we find a valid one, or False and the diagnose message on error
def _CheckExtStorageFile(base_dir, filename, required):

Check prereqs for an ExtStorage file.

Check if file exists, if it is a regular file and in case it is one of extstorage scripts if it is executable.

Parameters
base_dir:stringBase directory containing ExtStorage installations.
filename:stringThe basename of the ExtStorage file.
required:boolWhether the file is required or not.
Returns
StringThe file path if the file is found and is valid, None if the file is not found and not required.
Raises
BlockDeviceErrorIn case prereqs are not met (found and not valid/executable, not found and required)
def _ExtStorageAction(action, unique_id, ext_params, size=None, grow=None, metadata=None, name=None, uuid=None, snap_name=None, snap_size=None, exclusive=None):

Take an External Storage action.

Take an External Storage action concerning or affecting a specific Volume inside the External Storage.

Parameters
action:stringwhich action to perform. One of: create / remove / grow / attach / detach / snapshot
unique_id:tuple (driver, vol_name)a tuple containing the type of ExtStorage (driver) and the Volume name
ext_params:dictExtStorage parameters
size:integerthe size of the Volume in mebibytes
grow:integerthe new size in mebibytes (after grow)
metadata:stringmetadata info of the Volume, for use by the provider
name:stringname of the Volume (objects.Disk.name)
uuid:stringuuid of the Volume (objects.Disk.uuid)
snap_name:stringthe name of the snapshot
snap_size:integerthe size of the snapshot
exclusive:booleanWhether the Volume will be opened exclusively or not
Returns
None or a block device path (during attach)Undocumented
def _ExtStorageEnvironment(unique_id, ext_params, size=None, grow=None, metadata=None, name=None, uuid=None, snap_name=None, snap_size=None, exclusive=None):

Calculate the environment for an External Storage script.

Parameters
unique_id:tuple (driver, vol_name)ExtStorage pool and name of the Volume
ext_params:dictthe EXT parameters
size:integersize of the Volume (in mebibytes)
grow:integernew size of Volume after grow (in mebibytes)
metadata:stringmetadata info of the Volume
name:stringname of the Volume (objects.Disk.name)
uuid:stringuuid of the Volume (objects.Disk.uuid)
snap_name:stringthe name of the snapshot
snap_size:integerthe size of the snapshot
exclusive:booleanWhether the Volume will be opened exclusively or not
Returns
dictdict of environment variables
def _VolumeLogName(kind, es_name, volume):

Compute the ExtStorage log filename for a given Volume and operation.

Parameters
kind:stringthe operation type (e.g. create, remove etc.)
es_name:stringthe ExtStorage name
volume:stringthe name of the Volume inside the External Storage