distrax.devices.brd_device class#

This holds the BRDDevice Class, which allows for the creation and removal of the BRD Device

class distrax.devices.brd_device.BRDDevice[source]#

BRDDevice class this allows for the creation and removal of the RAM block device.

It is important to note that this device uses system memory and the block devices will be found at /dev/ram{number}

Examples

>>> device = BRDDevice()
static create_device(size, number=1)[source]#

Create BRD Block Device.

Parameters:
  • size (int) – number representing a GiB, i.e 4 would mean 4GiB

  • number (int) – Number of block devices to create, i.e. 4 will create 4 devices of the size stated

Raises:
  • NotEnoughMemoryError() – If the amount of memory requested is higher than the memory available

  • DeviceCreationError() – If the creation device fails this either to existing device or another reason.

Return type:

None

Returns:

Creates n blocks devices of the size stated.

Examples

>>> device.create_device(1, 10)
# Creates 10 1Gib block devices using system memory
static get_paths(number)[source]#

Get the paths of the devices created.

Parameters:

number (int) – number of devices created

Return type:

List[str]

Returns:

List of Device Paths, i.e. /dev/ram0,/dev/ram1

static remove_device()[source]#

Removes the BRD device from the systems.

Return type:

None

Examples

>>> device.remove_device()
# Removes the BRD block device from the system.