Package ganeti :: 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)
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)
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)
Grow the Volume.
source code

Inherited from BlockDev: CombinedSyncStatus, GetActualSize, GetSyncStatus, PauseResumeSync, SetInfo, SetSyncParams, __repr__

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

Class Methods [hide private]
 
Create(cls, unique_id, children, size, params, excl_stor)
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)
(Constructor)

source code 

Attaches to an rbd device.

Overrides: object.__init__

Create(cls, unique_id, children, size, params, excl_stor)
Class Method

source code 

Create a new rbd device.

Provision a new rbd volume inside a RADOS pool.

Overrides: BlockDev.Create

Remove(self)

source code 

Remove the rbd device.

Overrides: BlockDev.Remove

Rename(self, new_id)

source code 

Rename this device.

Overrides: 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: 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: BlockDev.Assemble

Shutdown(self)

source code 

Shutdown the device.

Overrides: 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)

source code 

Make the device ready for I/O.

Overrides: BlockDev.Open

Close(self)

source code 

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

Overrides: BlockDev.Close

Grow(self, amount, dryrun, backingstore)

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: BlockDev.Grow