def ext_tunables(dev):
 cmd = ('tune2fs -l %s' % dev)
 try:
  out = utils.system_output(cmd)
 except error.CmdError:
  tools_dir = os.path.join(os.environ['AUTODIR'], 'tools')
  cmd = ('%s/tune2fs.ext4dev -l %s' % (tools_dir, dev))
  out = utils.system_output(cmd)
 tune2fs_dict = {}
 for line in out.splitlines():
  components = line.split(':', 1)
  if (len(components) == 2):
   value = components[1].strip()
   option = components[0]
   if value.isdigit():
    tune2fs_dict[option] = int(value)
   else:
    tune2fs_dict[option] = value
 return tune2fs_dict

def ext_tunables ( dev ) : cmd = ( 'tune2fs -l %s' % dev ) try : out = utils . system_output ( cmd ) except error . CmdError : tools_dir = os . path . join ( os . environ [ 'AUTODIR' ] , 'tools' ) cmd = ( '%s/tune2fs.ext4dev -l %s' % ( tools_dir , dev ) ) out = utils . system_output ( cmd ) tune2fs_dict = { } for line in out . splitlines ( ) : components = line . split ( ':' , 1 ) if ( len ( components ) == 2 ) : value = components [ 1 ] . strip ( ) option = components [ 0 ] if value . isdigit ( ) : tune2fs_dict [ option ] = int ( value ) else : tune2fs_dict [ option ] = value return tune2fs_dict
call tune2fs -l and parse the result .