Package ganeti :: Module backend :: Class DevCacheManager
[hide private]
[frames] | no frames]

Class DevCacheManager

source code


Simple class for managing a cache of block device information.

Instance Methods [hide private]

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]
str
_ConvertPath(cls, dev_path)
Converts a /dev/name path to the cache file name.
source code
None
UpdateCache(cls, dev_path, owner, on_primary, iv_name)
Updates the cache information for a given device.
source code
None
RemoveCache(cls, dev_path)
Remove data for a dev_path.
source code
Class Variables [hide private]
  _DEV_PREFIX = "/dev/"
  _ROOT_DIR = RUN_DIR+ "/bdev-cache"
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

_ConvertPath(cls, dev_path)
Class Method

source code 

Converts a /dev/name path to the cache file name.

This replaces slashes with underscores and strips the /dev prefix. It then returns the full path to the cache file.

Parameters:
  • dev_path (str) - the /dev/ path name
Returns: str
the converted path name

UpdateCache(cls, dev_path, owner, on_primary, iv_name)
Class Method

source code 

Updates the cache information for a given device.

Parameters:
  • dev_path (str) - the pathname of the device
  • owner (str) - the owner (instance name) of the device
  • on_primary (bool) - whether this is the primary node nor not
  • iv_name (str) - the instance-visible name of the device, as in objects.Disk.iv_name
Returns: None

RemoveCache(cls, dev_path)
Class Method

source code 

Remove data for a dev_path.

This is just a wrapper over utils.io.RemoveFile with a converted path name and logging.

Parameters:
  • dev_path (str) - the pathname of the device
Returns: None