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

Module bdev

source code

Block device abstraction.

Classes [hide private]
  RbdShowmappedJsonError
`rbd showmmapped' JSON formatting error Exception class.
  LogicalVolume
Logical Volume block device.
  PersistentBlockDevice
A block device with persistent node
  RADOSBlockDevice
A RADOS Block Device (rbd).
Functions [hide private]
 
_CheckResult(result)
Throws an error if the given result is a failed one.
source code
 
_VerifyDiskType(dev_type) source code
 
_VerifyDiskParams(disk)
Verifies if all disk parameters are set.
source code
 
FindDevice(disk, children)
Search for an existing, assembled device.
source code
 
Assemble(disk, children)
Try to attach or assemble an existing device.
source code
bdev.BlockDev
Create(disk, children, excl_stor)
Create a device.
source code
Variables [hide private]
  DEV_MAP = {constants.DT_PLAIN: LogicalVolume, constants.DT_DRB...
Map disk types to disk type classes.

Imports: re, stat, os, logging, math, utils, errors, constants, objects, compat, serializer, base, drbd, FileStorage, GlusterStorage, ExtStorageDevice


Function Details [hide private]

_CheckResult(result)

source code 

Throws an error if the given result is a failed one.

Parameters:
  • result - result from RunCmd

FindDevice(disk, children)

source code 

Search for an existing, assembled device.

This will succeed only if the device exists and is assembled, but it does not do any actions in order to activate the device.

Parameters:
  • disk (objects.Disk) - the disk object to find
  • children (list of bdev.BlockDev) - the list of block devices that are children of the device represented by the disk parameter

Assemble(disk, children)

source code 

Try to attach or assemble an existing device.

This will attach to assemble the device, as needed, to bring it fully up. It must be safe to run on already-assembled devices.

Parameters:
  • disk (objects.Disk) - the disk object to assemble
  • children (list of bdev.BlockDev) - the list of block devices that are children of the device represented by the disk parameter

Create(disk, children, excl_stor)

source code 

Create a device.

Parameters:
  • disk (objects.Disk) - the disk object to create
  • children (list of bdev.BlockDev) - the list of block devices that are children of the device represented by the disk parameter
  • excl_stor (boolean) - Whether exclusive_storage is active
Returns: bdev.BlockDev
the created device, or None in case of an error

Variables Details [hide private]

DEV_MAP

Map disk types to disk type classes.

See Also: Assemble, FindDevice, Create.

Value:
{constants.DT_PLAIN: LogicalVolume, constants.DT_DRBD8: drbd.DRBD8Dev,\
 constants.DT_BLOCK: PersistentBlockDevice, constants.DT_RBD: RADOSBlo\
ckDevice, constants.DT_EXT: ExtStorageDevice, constants.DT_FILE: FileS\
torage, constants.DT_SHARED_FILE: FileStorage, constants.DT_GLUSTER: G\
lusterStorage,}