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

Class BaseDRBD

source code


Base DRBD class.

This class contains a few bits of common functionality between the 0.7 and 8.x versions of DRBD.

Instance Methods [hide private]
 
_SetFromMinor(self, minor)
Set our parameters based on the given minor.
source code
 
Rename(self, new_id)
Rename a device.
source code

Inherited from BlockDev: Assemble, Attach, Close, CombinedSyncStatus, GetActualSize, GetSyncStatus, Grow, Open, Remove, SetInfo, SetSyncSpeed, Shutdown, __init__, __repr__

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

Class Methods [hide private]
 
_MassageProcData(cls, data)
Transform the output of _GetProdData into a nicer form.
source code
 
_GetVersion(cls, proc_data)
Return the DRBD version.
source code
 
GetUsedDevs(cls)
Compute the list of used DRBD devices.
source code

Inherited from BlockDev: Create

Static Methods [hide private]
 
_GetProcData(filename=_STATUS_FILE)
Return data from /proc/drbd.
source code
 
GetUsermodeHelper(filename=_USERMODE_HELPER_FILE)
Returns DRBD usermode_helper currently set.
source code
 
_DevPath(minor)
Return the path to a drbd device for a given minor.
source code
 
_CheckMetaSize(meta_device)
Check if the given meta device looks like a valid one.
source code
Class Variables [hide private]
  _VERSION_RE = re.compile(r"^version: (\d+)\.(\d+)\.(\d+)(?:\.\...
  _VALID_LINE_RE = re.compile("^ *([0-9]+): cs:([^ ]+).*$")
  _UNUSED_LINE_RE = re.compile("^ *([0-9]+): cs:Unconfigured$")
  _DRBD_MAJOR = 147
  _ST_UNCONFIGURED = "Unconfigured"
  _ST_WFCONNECTION = "WFConnection"
  _ST_CONNECTED = "Connected"
  _STATUS_FILE = "/proc/drbd"
  _USERMODE_HELPER_FILE = "/sys/module/drbd/parameters/usermode_...
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

_MassageProcData(cls, data)
Class Method

source code 

Transform the output of _GetProdData into a nicer form.

Returns:
a dictionary of minor: joined lines from /proc/drbd for that minor

_GetVersion(cls, proc_data)
Class Method

source code 

Return the DRBD version.

This will return a dict with keys:

  • k_major
  • k_minor
  • k_point
  • api
  • proto
  • proto2 (only on drbd > 8.2.X)

_SetFromMinor(self, minor)

source code 

Set our parameters based on the given minor.

This sets our minor variable and our dev_path.

_CheckMetaSize(meta_device)
Static Method

source code 

Check if the given meta device looks like a valid one.

This currently only check the size, which must be around 128MiB.

Rename(self, new_id)

source code 

Rename a device.

This is not supported for drbd devices.

Overrides: BlockDev.Rename

Class Variable Details [hide private]

_VERSION_RE

Value:
re.compile(r"^version: (\d+)\.(\d+)\.(\d+)(?:\.\d+)?" r" \(api:(\d+)/p\
roto:(\d+)(?:-(\d+))?\)")

_USERMODE_HELPER_FILE

Value:
"/sys/module/drbd/parameters/usermode_helper"