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

Class RADOSBlockDevice

source code


A RADOS Block Device (rbd).

This class implements the RADOS Block Device for the backend. You need the rbd kernel driver, the RADOS Tools and a working RADOS cluster for this to be functional.

Instance Methods [hide private]
 
__init__(self, unique_id, children, size, params, dyn_params, *args)
Attaches to an rbd device.
source code
 
Remove(self)
Remove the rbd device.
source code
 
Rename(self, new_id)
Rename this device.
source code
 
Attach(self)
Attach to an existing rbd device.
source code
string
_MapVolumeToBlockdev(self, unique_id)
Maps existing rbd volumes to block devices.
source code
 
Assemble(self)
Assemble the device.
source code
 
Shutdown(self)
Shutdown the device.
source code
 
_UnmapVolumeFromBlockdev(self, unique_id)
Unmaps the rbd device from the Volume it is mapped.
source code
 
Open(self, force=False, exclusive=True)
Make the device ready for I/O.
source code
 
Close(self)
Notifies that the device will no longer be used for I/O.
source code
 
Grow(self, amount, dryrun, backingstore, excl_stor)
Grow the Volume.
source code
list of strings
Import(self)
Builds the shell command for importing data to device.
source code
list of strings
Export(self)
Builds the shell command for exporting data from device.
source code
string
GetUserspaceAccessUri(self, hypervisor)
Generate KVM userspace URIs to be used as `-drive file` settings.
source code

Inherited from base.BlockDev: CombinedSyncStatus, GetActualDimensions, GetActualSize, GetActualSpindles, GetSyncStatus, PauseResumeSync, SetInfo, SetSyncParams, Snapshot, __repr__

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

Class Methods [hide private]
BlockDev
Create(cls, unique_id, children, size, spindles, params, excl_stor, dyn_params, *args)
Create a new rbd device.
source code
string or None
_VolumeToBlockdev(cls, pool, volume_name)
Do the 'volume name'-to-'rbd block device' resolving.
source code
Static Methods [hide private]
string or None
_ParseRbdShowmappedJson(output, volume_name)
Parse the json output of `rbd showmapped'.
source code
string or None
_ParseRbdShowmappedPlain(output, volume_name)
Parse the (plain / text) output of `rbd showmapped'.
source code
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, unique_id, children, size, params, dyn_params, *args)
(Constructor)

source code 

Attaches to an rbd device.

Overrides: object.__init__

Create(cls, unique_id, children, size, spindles, params, excl_stor, dyn_params, *args)
Class Method

source code 

Create a new rbd device.

Provision a new rbd volume inside a RADOS pool.

Parameters:
  • unique_id - unique identifier; the details depend on the actual device type
  • children - for hierarchical devices, the child devices
  • size - size in MiB
  • spindles - number of physical disk to dedicate to the device
  • params - device-specific options/parameters
  • excl_stor - whether exclusive_storage is active
  • dyn_params - dynamic parameters of the disk only valid for this node. As set by objects.Disk.UpdateDynamicDiskParams.
Returns: BlockDev
the created device, or None in case of an error
Overrides: base.BlockDev.Create

Remove(self)

source code 

Remove the rbd device.

Overrides: base.BlockDev.Remove

Rename(self, new_id)

source code 

Rename this device.

Overrides: base.BlockDev.Rename

Attach(self)

source code 

Attach to an existing rbd device.

This method maps the rbd volume that matches our name with an rbd device and then attaches to this device.

Overrides: base.BlockDev.Attach

_MapVolumeToBlockdev(self, unique_id)

source code 

Maps existing rbd volumes to block devices.

This method should be idempotent if the mapping already exists.

Returns: string
the block device path that corresponds to the volume

_VolumeToBlockdev(cls, pool, volume_name)
Class Method

source code 

Do the 'volume name'-to-'rbd block device' resolving.

Parameters:
  • pool (string) - RADOS pool to use
  • volume_name (string) - the name of the volume whose device we search for
Returns: string or None
block device path if the volume is mapped, else None

_ParseRbdShowmappedJson(output, volume_name)
Static Method

source code 

Parse the json output of `rbd showmapped'.

This method parses the json output of `rbd showmapped' and returns the rbd block device path (e.g. /dev/rbd0) that matches the given rbd volume.

Parameters:
  • output (string) - the json output of `rbd showmapped'
  • volume_name (string) - the name of the volume whose device we search for
Returns: string or None
block device path if the volume is mapped, else None

_ParseRbdShowmappedPlain(output, volume_name)
Static Method

source code 

Parse the (plain / text) output of `rbd showmapped'.

This method parses the output of `rbd showmapped' and returns the rbd block device path (e.g. /dev/rbd0) that matches the given rbd volume.

Parameters:
  • output (string) - the plain text output of `rbd showmapped'
  • volume_name (string) - the name of the volume whose device we search for
Returns: string or None
block device path if the volume is mapped, else None

Assemble(self)

source code 

Assemble the device.

Overrides: base.BlockDev.Assemble

Shutdown(self)

source code 

Shutdown the device.

Overrides: base.BlockDev.Shutdown

_UnmapVolumeFromBlockdev(self, unique_id)

source code 

Unmaps the rbd device from the Volume it is mapped.

Unmaps the rbd device from the Volume it was previously mapped to. This method should be idempotent if the Volume isn't mapped.

Open(self, force=False, exclusive=True)

source code 

Make the device ready for I/O.

Overrides: base.BlockDev.Open

Close(self)

source code 

Notifies that the device will no longer be used for I/O.

Overrides: base.BlockDev.Close

Grow(self, amount, dryrun, backingstore, excl_stor)

source code 

Grow the Volume.

Parameters:
  • amount (integer) - the amount (in mebibytes) to grow with
  • dryrun (boolean) - whether to execute the operation in simulation mode only, without actually increasing the size
Overrides: base.BlockDev.Grow

Import(self)

source code 

Builds the shell command for importing data to device.

Returns: list of strings
List containing the import command for device
Overrides: base.BlockDev.Import

See Also: BlockDev.Import for details

Export(self)

source code 

Builds the shell command for exporting data from device.

Returns: list of strings
List containing the export command for device
Overrides: base.BlockDev.Export

See Also: BlockDev.Export for details

GetUserspaceAccessUri(self, hypervisor)

source code 

Generate KVM userspace URIs to be used as `-drive file` settings.

Returns: string
userspace device URI
Raises:
Overrides: base.BlockDev.GetUserspaceAccessUri