The bareon.utils.hardware
Module¶
-
bareon.utils.hardware.
blockdevreport
(blockdev)¶ Builds device blockdev report.
Parameters: blockdev – A block device file, e.g. /dev/sda. Returns: A dict of blockdev properties.
-
bareon.utils.hardware.
extrareport
(dev)¶ Builds device report using some additional sources.
Parameters: dev – A device file, e.g. /dev/sda. Returns: A dict of properties.
-
bareon.utils.hardware.
get_block_data_from_udev
(devtype, vg=False)¶
-
bareon.utils.hardware.
get_block_devices_from_udev_db
()¶
-
bareon.utils.hardware.
get_device_ids
(device)¶
-
bareon.utils.hardware.
get_device_info
(device, disks=True)¶
-
bareon.utils.hardware.
get_partitions_from_udev_db
()¶
-
bareon.utils.hardware.
get_vg_devices_from_udev_db
()¶
-
bareon.utils.hardware.
is_block_device
(filepath)¶ Check whether filepath is a block device.
-
bareon.utils.hardware.
is_disk
(dev, bspec=None, uspec=None)¶ Checks if given device is a disk.
Parameters: - dev – A device file, e.g. /dev/sda.
- bspec – A dict of properties which we get from blockdev.
- uspec – A dict of properties which we get from udevadm.
Returns: True if device is disk else False.
-
bareon.utils.hardware.
list_block_devices
(disks=True)¶ Gets list of block devices
Tries to guess which of them are disks and returns list of dicts representing those disks.
Returns: A list of dict representing disks available on a node.
-
bareon.utils.hardware.
match_device
(uspec1, uspec2)¶ Tries to find out if uspec1 and uspec2 are uspecs from the same device
It compares only some fields in uspecs (not all of them) which, we believe, is enough to say exactly whether uspecs belong to the same device or not.
Parameters: - uspec1 – A dict of properties which we get from udevadm.
- uspec1 – A dict of properties which we get from udevadm.
Returns: True if uspecs match each other else False.
-
bareon.utils.hardware.
parse_dmidecode
(type)¶ Parses dmidecode output.
Parameters: type – A string with type of entity to display. Returns: A list with dictionaries of entities for specified type.
-
bareon.utils.hardware.
parse_lspci
()¶ Parses lspci output.
Returns: A list of dicts containing PCI devices information
-
bareon.utils.hardware.
parse_simple_kv
(*command)¶ Parses simple key:value output from specified command.
Parameters: command – A command to execute Returns: A dict of parsed key-value data
-
bareon.utils.hardware.
scsi_address
(dev)¶
-
bareon.utils.hardware.
scsi_address_list
()¶
-
bareon.utils.hardware.
udevreport
(dev)¶ Builds device udevadm report.
Parameters: dev – A device file, e.g. /dev/sda. Returns: A dict of udev device properties.