MultipathDevices - command multipath -v4 -ll

This function converts the output of the multipath -v4 -ll command and stores the data around each multipath device given.

Examples

>>> type(mpaths)
<class 'insights.parsers.multipath_v4_ll.MultipathDevices'>
>>> len(mpaths)  # Can treat the object as a list to iterate through
3
>>> mpaths[0]['alias']
'mpathg'
>>> mpaths[0]['size']
'54T'
>>> mpaths[0]['dm_name']
'dm-2'
>>> mpaths[0]['wwid']
'36f01faf000da360b0000033c528fea6d'
>>> groups = mpaths[0]['path_group']  # List of path groups for this device
>>> groups[0]['status']
'active'
>>> len(groups[0]['path'])
4
>>> path0 = groups[0]['path'][0]  # Each path group has an array of paths
>>> path0[1]  # Paths are stored as a list of items
'sdc'
>>> path0[-1]
'running'
>>> mpaths.dms  # List of device names found
['dm-2', 'dm-4', 'dm-5']
>>> mpaths.by_dm['dm-2']['alias']  # Access by device name
'mpathg'
>>> mpaths.aliases  # Aliases found (again, in order)
['mpathg', 'mpathe']
>>> mpaths.by_alias['mpathg']['dm_name']  # Access by alias
'dm-2'
>>> mpaths.by_wwid['36f01faf000da360b0000033c528fea6d']['dm_name']
'dm-2'
class insights.parsers.multipath_v4_ll.MultipathDevices(context, extra_bad_lines=None)[source]

Bases: CommandParser

multipath_-v4_ll command output

Example input:

===== paths list =====
uuid hcil    dev dev_t pri dm_st chk_st vend/prod/rev       dev_st
     0:0:0:0 sda 8:0   -1  undef ready  VMware,Virtual disk running
     3:0:0:1 sdb 8:16  -1  undef ready  IET,VIRTUAL-DISK    running
     4:0:0:1 sdc 8:32  -1  undef ready  IET,VIRTUAL-DISK    running
Oct 28 14:02:44 | *word = 0, len = 1
Oct 28 14:02:44 | *word = E, len = 1
Oct 28 14:02:44 | *word = 1, len = 1
Oct 28 14:02:44 | *word = 0, len = 1
Oct 28 14:02:44 | *word = A, len = 1
Oct 28 14:02:44 | *word = 0, len = 1
mpathg (36f01faf000da360b0000033c528fea6d) dm-2 DELL,MD36xxi
size=54T features='3 queue_if_no_path pg_init_retries 50' hwhandler='1 rdac' wp=rw
|-+- policy='round-robin 0' prio=0 status=active
| |- 12:0:0:1 sdc 8:32   active ready running
| |- 11:0:0:1 sdi 8:128  active ready running
| |- 15:0:0:1 sdo 8:224  active ready running
| `- 17:0:0:1 sdv 65:80  active ready running
`-+- policy='round-robin 0' prio=0 status=enabled
  |- 13:0:0:1 sdf 8:80   active ready running
  |- 14:0:0:1 sdl 8:176  active ready running
  |- 16:0:0:1 sdr 65:16  active ready running
  `- 18:0:0:1 sdx 65:112 active ready running
mpathe (36f01faf000da3761000004323aa6fbce) dm-4 DELL,MD36xxi
size=54T features='3 queue_if_no_path pg_init_retries 55' hwhandler='1 rdac' wp=rw
|-+- policy='round-robin 0' prio=0 status=active
| |- 13:0:0:2 sdg 8:96   active faulty running
| |- 14:0:0:2 sdm 8:192  active faulty running
| |- 16:0:0:2 sds 65:32  active faulty running
| `- 18:0:0:2 sdy 65:128 active faulty running
`-+- policy='round-robin 0' prio=0 status=enabled
  |- 12:0:0:2 sdd 8:48   active faulty running
  |- 11:0:0:2 sdj 8:144  active faulty running
  |- 15:0:0:2 sdp 8:240  active faulty running
  `- 17:0:0:2 sdw 65:96  active faulty running
36001405b1629f80d52a4c898f8856e43 dm-5 LIO-ORG ,block0_sdb
size=2.0G features='0' hwhandler='0' wp=rw
|-+- policy='service-time 0' prio=1 status=active
| `- 3:0:0:0 sdc 8:32 active ready running
`-+- policy='service-time 0' prio=1 status=enabled
  `- 4:0:0:0 sdb 8:16 active ready running

Example data structure produced:

devices = [
  {
    "alias": "mpathg",
    "wwid": "36f01faf000da360b0000033c528fea6d",
    "dm_name": "dm-2",
    "venprod": "DELL,MD36xxi",
    "size": "54T",
    "features": "3 queue_if_no_path pg_init_retries 50",
    "hwhandler": "1 rdac",
    "wp": "rw",
    "path_group": [
         {
            "policy": "round-robin 0",
            "prio": "0"
            "status": "active"
            "path": [
                ['12:0:0:1', 'sdc', '8:32', 'active', 'ready', 'running'],
                ['11:0:0:1', 'sdi', '8:128', 'active', 'ready', 'running'],
                ['15:0:0:1', 'sdo', '8:224', 'active', 'ready', 'running'],
                ['17:0:0:1', 'sdv', '65:80', 'active', 'ready', 'running']
            ]
         }, {
            "policy": "round-robin 0",
            "prio": "0"
            "status": "enabled"
            "path": [
                ['13:0:0:1', 'sdf', '8:80', 'active', 'ready', 'running'],
                ['14:0:0:1', 'sdl', '8:176', 'active', 'ready', 'running'],
                ['16:0:0:1', 'sdr', '65:16', 'active', 'ready', 'running'],
                ['18:0:0:1', 'sdx', '65:112','active', 'ready', 'running']
            ]
        }
    ]
  },...
]

raw_info_lines = [
    "===== paths list =====",
    "uuid hcil    dev dev_t pri dm_st chk_st vend/prod/rev       dev_st",
    "     0:0:0:0 sda 8:0   -1  undef ready  VMware,Virtual disk running",
    "     3:0:0:1 sdb 8:16  -1  undef ready  IET,VIRTUAL-DISK    running",
    "     4:0:0:1 sdc 8:32  -1  undef ready  IET,VIRTUAL-DISK    running",
    "Oct 28 14:02:44 | *word = 0, len = 1",
    ...
]
devices

List of devices found, in order

Type:

list

dms

Device mapper names of each device, in order found

Type:

list

aliases

Alias of each device, in order found

Type:

list

wwids

World Wide ID

Type:

list

by_dm

Access to each device by device mapper name

Type:

dict

by_alias

Access to each device by alias

Type:

dict

by_wwid

Access to each device by World Wide ID

Type:

dict

raw_info_lines

List of raw info lines found, in order

Type:

list

parse_content(content)[source]

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