multipath.conf file content

The base class is the MultipathConfParser class, which reads the multipath daemon’s /etc/multipath.conf configuration file. This is in a pseudo-JSON format.

MultipathConf - file /etc/multipath.conf

MultipathConfInitramfs - command lsinitrd -f /etc/multipath.conf

class insights.parsers.multipath_conf.MultipathConf(context)[source]

Bases: insights.parsers.multipath_conf.MultipathConfParser

Parser for the file /etc/multipath.conf.

Examples

>>> conf = shared[MultipathConf]
>>> conf.data['blacklist']['devnode']  # Access via data property
'^hd[a-z]'
>>> conf['defaults']['user_friendly_names']  # Pseudo-dict access
'yes'
>>> len(conf['multipaths'])
2
>>> conf['multipaths'][0]['alias']
'yellow'
class insights.parsers.multipath_conf.MultipathConfInitramfs(context)[source]

Bases: insights.parsers.multipath_conf.MultipathConfParser

Parser for the output of lsinitrd -f /etc/multipath.conf applied to /boot/initramfs-<kernel-version>.img.

Examples

>>> conf = shared[MultipathConfInitramfs]
>>> conf.data['blacklist']['devnode']  # Access via data property
'^hd[a-z]'
>>> conf['defaults']['user_friendly_names']  # Pseudo-dict access
'yes'
>>> len(conf['multipaths'])
2
>>> conf['multipaths'][0]['alias']
'yellow'
class insights.parsers.multipath_conf.MultipathConfParser(context)[source]

Bases: insights.core.Parser, insights.core.LegacyItemAccess

Shared parser for the file /etc/multipath.conf and output of lsinitrd -f /etc/multipath.conf applied to /boot/initramfs-<kernel-version>.img.

Return a dict where the keys are the name of sections in multipath configuraion file. If there are subsections, the value is a list of dictionaries with parameters as key and value. Otherwise the value is just a single dictionary.

Configuration File Example:

defaults {
       path_selector           "round-robin 0"
       user_friendly_names      yes
}

multipaths {
       multipath {
               alias                   yellow
               path_grouping_policy    multibus
      }
       multipath {
               wwid                    1DEC_____321816758474
               alias                   red
      }
}

devices {
       device {
               path_selector           "round-robin 0"
               no_path_retry            queue
      }
       device {
               vendor                  1DEC_____321816758474
               path_grouping_policy    red
      }
}

blacklist {
      wwid 26353900f02796769
      devnode "^hd[a-z]"
}

Parse Result:

data = {
  "blacklist": {
    "devnode": "^hd[a-z]",
    "wwid": "26353900f02796769"
  },
  "devices": [
    {
      "path_selector": "round-robin 0",
      "no_path_retry": "queue"
    },
    {
      "path_grouping_policy": "red",
      "vendor": "1DEC_____321816758474"
    }
  ],
  "defaults": {
    "path_selector": "round-robin 0",
    "user_friendly_names": "yes"
  },
  "multipaths": [
    {
      "alias": "yellow",
      "path_grouping_policy": "multibus"
    },
    {
      "alias": "red",
      "wwid": "1DEC_____321816758474"
    }
  ]
}
parse_content(content)[source]

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

class insights.parsers.multipath_conf.MultipathConfTree(context)[source]

Bases: insights.core.ConfigParser

Exposes multipath configuration through the parsr query interface.

See the insights.core.ConfigComponent class for example usage.

class insights.parsers.multipath_conf.MultipathConfTreeInitramfs(context)[source]

Bases: insights.core.ConfigParser

Exposes the multipath configuration from initramfs image through the parsr query interface.

See the insights.core.ConfigComponent class for example usage.

insights.parsers.multipath_conf.get_tree(root=None)[source]

This is a helper function to get a multipath configuration component for your local machine or an archive. It’s for use in interactive sessions.

insights.parsers.multipath_conf.get_tree_from_initramfs(root=None)[source]

This is a helper function to get a multipath configuration(from initramfs image) component for your local machine or an archive. It’s for use in interactive sessions.