parameters: (line)
return_statement: return parsed
docstring: Parses the output from ``dmsetup splitname``, that should contain prefixes
      (--nameprefixes) and set the separator to ";"
  
      Output for /dev/mapper/vg-lv will usually look like::
  
          DM_VG_NAME='/dev/mapper/vg';DM_LV_NAME='lv';DM_LV_LAYER=''
  
  
      The ``VG_NAME`` will usually not be what other callers need (e.g. just 'vg'
      in the example), so this utility will split ``/dev/mapper/`` out, so that
      the actual volume group name is kept
  
      :returns: dictionary with stripped prefixes
docstring_summary: Parses the output from ``dmsetup splitname``, that should contain prefixes
      (--nameprefixes) and set the separator to ";"
docstring_tokens: Parses the output from dmsetup splitname that should contain prefixes ( -- nameprefixes ) and set the separator to ;
function: def _splitname_parser(line):
      """
      Parses the output from ``dmsetup splitname``, that should contain prefixes
      (--nameprefixes) and set the separator to ";"
  
      Output for /dev/mapper/vg-lv will usually look like::
  
          DM_VG_NAME='/dev/mapper/vg';DM_LV_NAME='lv';DM_LV_LAYER=''
  
  
      The ``VG_NAME`` will usually not be what other callers need (e.g. just 'vg'
      in the example), so this utility will split ``/dev/mapper/`` out, so that
      the actual volume group name is kept
  
      :returns: dictionary with stripped prefixes
      """
      parsed = {}
      try:
          parts = line[0].split(';')
      except IndexError:
          logger.exception('Unable to parse mapper device: %s', line)
          return parsed
  
      for part in parts:
          part = part.replace("'", '')
          key, value = part.split('=')
          if 'DM_VG_NAME' in key:
              value = value.split('/dev/mapper/')[-1]
          key = key.split('DM_')[-1]
          parsed[key] = value
  
      return parsed
function_tokens: def _splitname_parser ( line ) : parsed = { } try : parts = line [ 0 ] . split ( ';' ) except IndexError : logger . exception ( 'Unable to parse mapper device: %s' , line ) return parsed for part in parts : part = part . replace ( "'" , '' ) key , value = part . split ( '=' ) if 'DM_VG_NAME' in key : value = value . split ( '/dev/mapper/' ) [ - 1 ] key = key . split ( 'DM_' ) [ - 1 ] parsed [ key ] = value return parsed