system.storage.RAID.block_assignment module¶
RAID block-assignment strategies (RAID 0/1/4/5) mapping logical to physical block positions.
- class system.storage.RAID.block_assignment.PhysicalBlockPosition(disk_ID: int, internal_block_ID: int, is_parity: bool)[source]¶
Bases:
objectData class to store the physical position of a block in the disk subsystem. Note that (disk_ID, internal_block_ID) is a unique identifier for a block in the disk subsystem.
- disk_ID: int¶
- internal_block_ID: int¶
- is_parity: bool¶
- class system.storage.RAID.block_assignment.RAID_Level[source]¶
Bases:
ABCAbstract base for RAID data/parity block-placement strategies.
Each subclass (RAID_0, RAID_1, RAID_4, RAID_5) implements
logical_id_to_physical_positions(), mapping a logical block ID onto the physical block position(s) it occupies for that RAID level.- abstractmethod logical_id_to_physical_positions(logical_block_ID: int, number_of_disks: int) list[PhysicalBlockPosition][source]¶
Given a logical block ID and the number of disks, returns a list of the physical block positions of the block in the underlying disk/SSD/whatever subsystem.
- Parameters:
logical_block_ID – The logical block ID
number_of_disks – The number of available disks
- Returns:
A list of BlockPositionInformation instances containing the disk ID where to find this logical block, the internal block ID on that disk, as well as a flag indicating if the block is a parity block.
- class system.storage.RAID.block_assignment.RAID_0[source]¶
Bases:
RAID_LevelRAID 0: Striping without parity
- logical_id_to_physical_positions(logical_block_ID: int, number_of_disks: int) list[PhysicalBlockPosition][source]¶
See
RAID_Level.logical_id_to_physical_positions().Striping without parity: the logical block is placed round-robin on a single disk. Returns exactly one data position and no parity block.
- class system.storage.RAID.block_assignment.RAID_1[source]¶
Bases:
RAID_LevelRAID 1: Mirroring
- logical_id_to_physical_positions(logical_block_ID: int, number_of_disks: int) list[PhysicalBlockPosition][source]¶
See
RAID_Level.logical_id_to_physical_positions().Mirroring: the logical block is replicated on every disk at the same internal position. Returns one data position per disk and no parity.
- class system.storage.RAID.block_assignment.RAID_4[source]¶
Bases:
RAID_LevelRAID 4: Striping with dedicated parity disk
- logical_id_to_physical_positions(logical_block_ID: int, number_of_disks: int) list[PhysicalBlockPosition][source]¶
See
RAID_Level.logical_id_to_physical_positions().Striping with a dedicated parity disk (always the last disk): the data block is striped round-robin over the remaining disks. Returns one data position plus one parity position (on the last disk) for its row. Requires at least three disks.
- class system.storage.RAID.block_assignment.RAID_5[source]¶
Bases:
RAID_LevelRAID 5: Striping with distributed (round-robin) parity
- logical_id_to_physical_positions(logical_block_ID: int, number_of_disks: int) list[PhysicalBlockPosition][source]¶
See
RAID_Level.logical_id_to_physical_positions().Striping with distributed (round-robin) parity: the parity disk rotates per row (the diagonal pattern) instead of being fixed, and the data-disk index is shifted right by one whenever it is greater than or equal to the parity-disk index, so the round-robin skips over the parity disk. Returns one data position plus one parity position for its row. Requires at least three disks.
- system.storage.RAID.block_assignment.compute_assignment(rows: int = 7, number_of_disks: int = 3, RAID_level: int = 0) list[str][source]¶
Computes the assignment of logical block IDs to physical block IDs for a given RAID level.
- Parameters:
rows – The number of rows in the disk subsystem, i.e. the number of internal blocks per disk tom compute for all disks
number_of_disks – The number of disks in the disk subsystem
RAID_level – The RAID level to compute the assignment for, possible values: 0, 1, 4, 5
- Returns:
A list of strings representing the assignment of logical block IDs to physical block IDs