Package ganeti :: Package storage :: Module extstorage
[hide private]
[frames] | no frames]

Module extstorage

source code

ExtStorage Interface related functionality

Classes [hide private]
  ExtStorageDevice
A block device provided by an ExtStorage Provider.
Functions [hide private]
None or a block device path (during attach)
_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.
source code
String
_CheckExtStorageFile(base_dir, filename, required)
Check prereqs for an ExtStorage file.
source code
tuple
ExtStorageFromDisk(name, base_dir=None)
Create an ExtStorage instance from disk.
source code
dict
_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.
source code
 
_VolumeLogName(kind, es_name, volume)
Compute the ExtStorage log filename for a given Volume and operation.
source code

Imports: re, stat, os, logging, utils, errors, constants, objects, pathutils, base


Function Details [hide private]

_ExtStorageAction(action, unique_id, ext_params, size=None, grow=None, metadata=None, name=None, uuid=None, snap_name=None, snap_size=None, exclusive=None)

source code 

Take an External Storage action.

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

Parameters:
  • action (string) - which 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 (dict) - ExtStorage parameters
  • size (integer) - the size of the Volume in mebibytes
  • grow (integer) - the new size in mebibytes (after grow)
  • metadata (string) - metadata info of the Volume, for use by the provider
  • name (string) - name of the Volume (objects.Disk.name)
  • snap_size (integer) - the size of the snapshot
  • snap_name (string) - the name of the snapshot
  • exclusive (boolean) - Whether the Volume will be opened exclusively or not
  • uuid (string) - uuid of the Volume (objects.Disk.uuid)
Returns: None or a block device path (during attach)

_CheckExtStorageFile(base_dir, filename, required)

source code 

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 (string) - Base directory containing ExtStorage installations.
  • filename (string) - The basename of the ExtStorage file.
  • required (bool) - Whether the file is required or not.
Returns: String
The file path if the file is found and is valid, None if the file is not found and not required.
Raises:
  • BlockDeviceError - In case prereqs are not met (found and not valid/executable, not found and required)

ExtStorageFromDisk(name, base_dir=None)

source code 

Create an ExtStorage instance from disk.

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

Parameters:
  • base_dir (string) - Base directory containing ExtStorage installations. Defaults to a search in all the ES_SEARCH_PATH dirs.
Returns: tuple
True and the ExtStorage instance if we find a valid one, or False and the diagnose message on error

_ExtStorageEnvironment(unique_id, ext_params, size=None, grow=None, metadata=None, name=None, uuid=None, snap_name=None, snap_size=None, exclusive=None)

source code 

Calculate the environment for an External Storage script.

Parameters:
  • unique_id (tuple (driver, vol_name)) - ExtStorage pool and name of the Volume
  • ext_params (dict) - the EXT parameters
  • size (integer) - size of the Volume (in mebibytes)
  • grow (integer) - new size of Volume after grow (in mebibytes)
  • metadata (string) - metadata info of the Volume
  • name (string) - name of the Volume (objects.Disk.name)
  • uuid (string) - uuid of the Volume (objects.Disk.uuid)
  • snap_size (integer) - the size of the snapshot
  • snap_name (string) - the name of the snapshot
  • exclusive (boolean) - Whether the Volume will be opened exclusively or not
Returns: dict
dict of environment variables

_VolumeLogName(kind, es_name, volume)

source code 

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

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