class documentation

class RADOSBlockDevice(base.BlockDev):

View In Hierarchy

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.

Class Method Create Create a new rbd device.
Method __init__ Attaches to an rbd device.
Method Assemble Assemble the device.
Method Attach Attach to an existing rbd device.
Method Close Notifies that the device will no longer be used for I/O.
Method Export Builds the shell command for exporting data from device.
Method GetUserspaceAccessUri Generate KVM userspace URIs to be used as `-drive file` settings.
Method Grow Grow the Volume.
Method Import Builds the shell command for importing data to device.
Method Open Make the device ready for I/O.
Method Remove Remove the rbd device.
Method Rename Rename this device.
Method Shutdown Shutdown the device.
Instance Variable attached Undocumented
Instance Variable dev_path Undocumented
Instance Variable driver Undocumented
Instance Variable major Undocumented
Instance Variable minor Undocumented
Instance Variable rbd_name Undocumented
Instance Variable rbd_pool Undocumented
Class Method _VolumeToBlockdev Do the 'volume name'-to-'rbd block device' resolving.
Static Method _ParseRbdShowmappedJson Parse the json output of `rbd showmapped'.
Static Method _ParseRbdShowmappedPlain Parse the (plain / text) output of `rbd showmapped'.
Method _MapVolumeToBlockdev Maps existing rbd volumes to block devices.
Method _UnmapVolumeFromBlockdev Unmaps the rbd device from the Volume it is mapped.

Inherited from BlockDev:

Method __eq__ Undocumented
Method __repr__ Undocumented
Method CombinedSyncStatus Calculate the mirror status recursively for our children.
Method GetActualDimensions Return the actual disk size and number of spindles used.
Method GetActualSize Return the actual disk size.
Method GetActualSpindles Return the actual number of spindles used.
Method GetSyncStatus Returns the sync status of the device.
Method PauseResumeSync Pause/Resume the sync of the mirror.
Method SetInfo Update metadata with info text.
Method SetSyncParams Adjust the synchronization parameters of the mirror.
Method Snapshot Creates a snapshot of the block device.
Instance Variable dyn_params Undocumented
Instance Variable params Undocumented
Instance Variable size Undocumented
Instance Variable unique_id Undocumented
Instance Variable _children Undocumented
@classmethod
def Create(cls, unique_id, children, size, spindles, params, excl_stor, dyn_params, **kwargs):

Create a new rbd device.

Provision a new rbd volume inside a RADOS pool.

def __init__(self, unique_id, children, size, params, dyn_params, **kwargs):

Attaches to an rbd device.

def Assemble(self):

Assemble the device.

def Attach(self):

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.

def Close(self):

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

def Export(self):

Builds the shell command for exporting data from device.

See Also
BlockDev.Export for details
def GetUserspaceAccessUri(self, hypervisor):

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

See Also
BlockDev.GetUserspaceAccessUri
def Grow(self, amount, dryrun, backingstore, excl_stor):

Grow the Volume.

Parameters
amount:integerthe amount (in mebibytes) to grow with
dryrun:booleanwhether to execute the operation in simulation mode only, without actually increasing the size
backingstoreUndocumented
excl_storUndocumented
def Import(self):

Builds the shell command for importing data to device.

See Also
BlockDev.Import for details
def Open(self, force=False, exclusive=True):

Make the device ready for I/O.

def Remove(self):

Remove the rbd device.

def Rename(self, new_id):

Rename this device.

def Shutdown(self):

Shutdown the device.

attached: bool =

Undocumented

dev_path =

Undocumented

driver =

Undocumented

major =

Undocumented

minor =

Undocumented

rbd_name =

Undocumented

rbd_pool =

Undocumented

@classmethod
def _VolumeToBlockdev(cls, pool, volume_name):

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

Parameters
pool:stringRADOS pool to use
volume_name:stringthe name of the volume whose device we search for
Returns
string or Noneblock device path if the volume is mapped, else None
@staticmethod
def _ParseRbdShowmappedJson(output, volume_pool, volume_name):

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:stringthe json output of `rbd showmapped'
volume_pool:stringname of the volume whose device we search for
volume_name:stringname of the pool in which we search
Returns
string or Noneblock device path if the volume is mapped, else None
@staticmethod
def _ParseRbdShowmappedPlain(output, volume_name):

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:stringthe plain text output of `rbd showmapped'
volume_name:stringthe name of the volume whose device we search for
Returns
string or Noneblock device path if the volume is mapped, else None
def _MapVolumeToBlockdev(self, unique_id):

Maps existing rbd volumes to block devices.

This method should be idempotent if the mapping already exists.

Returns
stringthe block device path that corresponds to the volume
def _UnmapVolumeFromBlockdev(self, unique_id):

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.