dissect.volume.vinum.config

Module Contents

Classes

Volume

The representation of a Vinum Volume.

Plex

The representation of a Vinum Plex.

SD

The representation of a Vinum SD.

BytesDefaultEnum

bytes(iterable_of_ints) -> bytes

VolumeState

bytes(iterable_of_ints) -> bytes

PlexState

bytes(iterable_of_ints) -> bytes

PlexOrg

bytes(iterable_of_ints) -> bytes

SDState

bytes(iterable_of_ints) -> bytes

VinumConfigs

Vinum configurations.

Functions

get_char

Return a single byte bytestring at index idx in line.

tokenize

Yield individual tokens from a vinum config line.

parse_vinum_config

Parse the on-disk vinum configuration.

Attributes

dissect.volume.vinum.config.log
class dissect.volume.vinum.config.Volume

The representation of a Vinum Volume.

A Vinum Volume defines a single RAID set. One or more Vinum Plexes can be part of a Volume.

timestamp: datetime.datetime
name: bytes
state: VolumeState | None = None
class dissect.volume.vinum.config.Plex

The representation of a Vinum Plex.

A Vinum Plex can be thought of as one of the individual disks in a mirrored array. One or more Vinum SDs can be part of a Plex. The Plex defines the type of RAID in which these SDs are organized.

timestamp: datetime.datetime
name: bytes | None = None
org: PlexOrg | None = None
stripesize: int | None = None
volume: bytes | None = None
state: PlexState | None = None
class dissect.volume.vinum.config.SD

The representation of a Vinum SD.

A Vinum SD contains information about the actual physical disk and points to the device of this disk.

timestamp: datetime.datetime
drive: bytes
name: bytes | None = None
length: int | None = None
driveoffset: int | None = None
plex: bytes | None = None
plexoffset: int | None = None
state: SDState | None = None
exception dissect.volume.vinum.config.ParseError

Bases: Exception

Common base class for all non-exit exceptions.

class dissect.volume.vinum.config.BytesDefaultEnum

Bases: bytes, enum.Enum

bytes(iterable_of_ints) -> bytes bytes(string, encoding[, errors]) -> bytes bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer bytes(int) -> bytes object of size given by the parameter initialized with null bytes bytes() -> empty bytes object

Construct an immutable array of bytes from:
  • an iterable yielding integers in range(256)

  • a text string encoded using the specified encoding

  • any object implementing the buffer API.

  • an integer

class dissect.volume.vinum.config.VolumeState

Bases: BytesDefaultEnum

bytes(iterable_of_ints) -> bytes bytes(string, encoding[, errors]) -> bytes bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer bytes(int) -> bytes object of size given by the parameter initialized with null bytes bytes() -> empty bytes object

Construct an immutable array of bytes from:
  • an iterable yielding integers in range(256)

  • a text string encoded using the specified encoding

  • any object implementing the buffer API.

  • an integer

DOWN
UP = b'up'
class dissect.volume.vinum.config.PlexState

Bases: BytesDefaultEnum

bytes(iterable_of_ints) -> bytes bytes(string, encoding[, errors]) -> bytes bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer bytes(int) -> bytes object of size given by the parameter initialized with null bytes bytes() -> empty bytes object

Construct an immutable array of bytes from:
  • an iterable yielding integers in range(256)

  • a text string encoded using the specified encoding

  • any object implementing the buffer API.

  • an integer

DOWN
UP = b'up'
INITIALIZING = b'initializing'
DEGRADED = b'degraded'
GROWABLE = b'growable'
class dissect.volume.vinum.config.PlexOrg

Bases: BytesDefaultEnum

bytes(iterable_of_ints) -> bytes bytes(string, encoding[, errors]) -> bytes bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer bytes(int) -> bytes object of size given by the parameter initialized with null bytes bytes() -> empty bytes object

Construct an immutable array of bytes from:
  • an iterable yielding integers in range(256)

  • a text string encoded using the specified encoding

  • any object implementing the buffer API.

  • an integer

DISORG
CONCAT = b'concat'
STRIPED = b'striped'
RAID5 = b'raid5'
class dissect.volume.vinum.config.SDState

Bases: BytesDefaultEnum

bytes(iterable_of_ints) -> bytes bytes(string, encoding[, errors]) -> bytes bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer bytes(int) -> bytes object of size given by the parameter initialized with null bytes bytes() -> empty bytes object

Construct an immutable array of bytes from:
  • an iterable yielding integers in range(256)

  • a text string encoded using the specified encoding

  • any object implementing the buffer API.

  • an integer

DOWN
UP = b'up'
INITIALIZING = b'initializing'
DEGRADED = b'degraded'
GROWABLE = b'growable'
dissect.volume.vinum.config.get_char(line: bytes, idx: int) bytes

Return a single byte bytestring at index idx in line.

If the index is outside of the bounaries of line, an empty bytestring will be returned.

exception dissect.volume.vinum.config.TokenizeError

Bases: Exception

Common base class for all non-exit exceptions.

dissect.volume.vinum.config.tokenize(line: bytes) iter[bytes]

Yield individual tokens from a vinum config line.

This token parser is constructed to be equivalent to the token parser used in the FreeBSD kernel code. There are a few caveats though:

  • it expects lines to be pre-splitted on newline and null-byte characters

  • it does not attempt to parse quoted tokens, as the code in the kernel parser is buggy and will always lead to an error condition (it will mimick the error condition though).

class dissect.volume.vinum.config.VinumConfigs

Bases: TypedDict

Vinum configurations.

volumes: list[Volume]
plexes: list[Plex]
sds: list[SD]
dissect.volume.vinum.config.RE_CONFIG_EOL
dissect.volume.vinum.config.TOKEN_CONFIG_MAP
dissect.volume.vinum.config.parse_vinum_config(config_time: datetime.datetime, config: bytes) VinumConfigs

Parse the on-disk vinum configuration.

Parsing forgiveness and strictness is implemented in the same way as in the vinum kernel code:

Lines with an unknown configuration type (not volume, plex or sd), are ignored.

Lines that fail to parse due to:
  • no name present

  • no value present for a token

  • unknown token name

  • a tokenization error

will fail that line and the subsequent lines (rest of the config) to not being parsed.