dmsetup commands - Command dmsetup

Parsers for parsing and extracting data from output of commands related to dmsetup. Parsers contained in this module are:

DmsetupInfo - command dmsetup info -C

DmsetupStatus - command dmsetup status

class insights.parsers.dmsetup.DmsetupInfo(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser

dmsetup info -C command output

Example input:

Name               Maj Min Stat Open Targ Event  UUID
VG00-tmp           253   8 L--w    1    1      0 LVM-gy9uAwD7LuTIApplr2sogbOx5iS0FTax6lLmBji2ueSbX49gxcV76M29cmukQiw4
VG00-home          253   3 L--w    1    1      0 LVM-gy9uAwD7LuTIApplr2sogbOx5iS0FTaxCqXOnbGe2zjhX923dFiIdl1oi7mO9tXp
VG00-var           253   6 L--w    1    2      0 LVM-gy9uAwD7LuTIApplr2sogbOx5iS0FTaxicvyvt67113nTb8vMlGfgdEjDx0LKT2O
VG00-swap          253   1 L--w    2    1      0 LVM-gy9uAwD7LuTIApplr2sogbOx5iS0FTax3Ll2XhOYZkylx1CjOQi7G4yHgrIOsyqG
VG00-root          253   0 L--w    1    1      0 LVM-gy9uAwD7LuTIApplr2sogbOx5iS0FTaxKpnAKYhrYMYMNMwjegkW965bUgtJFTRY
VG00-var_log_audit 253   5 L--w    1    1      0 LVM-gy9uAwD7LuTIApplr2sogbOx5iS0FTaxwQ8R0XWJRm86QX3befq1cHRy47Von6ZW

Example data structure produced:

data = [
  {
    'Stat': 'L--w',
    'Name': 'VG00-tmp',
    'Min': '8',
    'Targ': '1',
    'Maj': '253',
    'Open': '1',
    'Event': '0',
    'UUID': 'LVM-gy9uAwD7LuTIApplr2sogbOx5iS0FTax6lLmBji2ueSbX49gxcV76M29cmukQiw4'
  },...
]
data

List of devices found, in order

Type

list

names

Device names, in order found

Type

list

uuids

UUID

Type

list

by_name

Access to each device by devicename

Type

dict

by_uuid

Access to each device by uuid

Type

dict

info

List of devices found, in order using SetupInfo structure

Type

list

Example

>>> len(setup_info)
6
>>> setup_info.names[0]
'VG00-tmp'
>>> setup_info[1]['Maj']
'253'
>>> setup_info[1]['Stat']
'L--w'
>>> setup_info.info[-1].name
'VG00-var_log_audit'
>>> setup_info.info[-1].major
253
>>> setup_info.info[-1].live_table
True
>>> setup_info.info[-1].readonly
False
parse_content(content)[source]

This method must be implemented by classes based on this class.

class insights.parsers.dmsetup.DmsetupStatus(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser, list

dmsetup status -C command output

Example input:

rootvg-tanlv: 0 6291456 linear
rootvg-ssnap: 0 16384000 snapshot 1560768/5120000 6088
rootvg-optvolapp: 0 8192000 snapshot-origin
docker-253:10-1234567-0df13579: 0 20971520 thin 1922048 20971519
docker-253:10-4254621-0496628a: 0 20971520 thin 1951744 20971519
docker-253:10-4254621-d392682f: 0 20971520 thin 7106560 20971519
rootvg-docker--pool: 0 129548288 thin-pool 1 20/49152 38/126512 - rw no_discard_passdown queue_if_no_space -
rootvg-tmpvol: 0 2048000 linear
rootvg-varvol: 0 18874368 snapshot Invalid
rootvg-optvol: 0 8192000 snapshot 616408/5120000 2408
rootvg-varvol-cow: 0 5120000 linear
appsvg-lvapps_docker: 0 104857600 thin-pool 441 697/2048 20663/102400 - rw no_discard_passdown queue_if_no_space -

Example data structure produced:

[
    SetupStatus(
        device_name='rootvg-tanlv', start_sector='0',
        num_sectors='6291456', target_type='linear',
        target_args=None, parsed_args=None,
    ), ...
]
names

Device names, in order found

Type

list

by_name

Access to each device by devicename

Type

dict

unparseable_lines

Unparseable raw lines

Type

list

Example

>>> len(dmsetup_status)
12
>>> dmsetup_status.names[0]
'rootvg-tanlv'
>>> dmsetup_status[1].target_type
'snapshot'
>>> dmsetup_status[1].start_sector
'0'
>>> len(dmsetup_status.by_name)
12
>>> dmsetup_status[-1].parsed_args['used_metadata_blocks']
'697'
>>> dmsetup_status[-1].parsed_args['total_metadata_blocks']
'2048'
>>> dmsetup_status[-1].parsed_args['opts']
['rw', 'no_discard_passdown', 'queue_if_no_space', '-']
parse_content(content)[source]

This method must be implemented by classes based on this class.

class insights.parsers.dmsetup.SetupInfo(name, major, minor, open, segments, events, live_table, inactive_table, suspended, readonly, uuid)

Bases: tuple

Data structure to represent dmsetup information

property events
property inactive_table
property live_table
property major
property minor
property name
property open
property readonly
property segments
property suspended
property uuid
class insights.parsers.dmsetup.SetupStatus(device_name, start_sector, num_sectors, target_type, target_args, parsed_args)

Bases: tuple

Data structure to represent dmsetup status

property device_name
property num_sectors
property parsed_args
property start_sector
property target_args
property target_type