def match_xfs_options(dev, needed_options):
 tmp_mount_dir = tempfile.mkdtemp()
 cmd = ('mount %s %s' % (dev, tmp_mount_dir))
 utils.system_output(cmd)
 xfs_growfs = os.path.join(os.environ['AUTODIR'], 'tools', 'xfs_growfs')
 cmd = ('%s -n %s' % (xfs_growfs, dev))
 try:
  current_option = utils.system_output(cmd)
 finally:
  cmd = ('umount %s' % dev)
  utils.system_output(cmd, ignore_status=True)
  os.rmdir(tmp_mount_dir)
 cmd = ('mkfs.xfs %s -N -f %s' % (needed_options, dev))
 needed_out = utils.system_output(cmd)
 needed_out = re.sub('internal log', 'internal    ', needed_out)
 if (current_option == needed_out):
  return True
 else:
  return False

def match_xfs_options ( dev , needed_options ) : tmp_mount_dir = tempfile . mkdtemp ( ) cmd = ( 'mount %s %s' % ( dev , tmp_mount_dir ) ) utils . system_output ( cmd ) xfs_growfs = os . path . join ( os . environ [ 'AUTODIR' ] , 'tools' , 'xfs_growfs' ) cmd = ( '%s -n %s' % ( xfs_growfs , dev ) ) try : current_option = utils . system_output ( cmd ) finally : cmd = ( 'umount %s' % dev ) utils . system_output ( cmd , ignore_status = True ) os . rmdir ( tmp_mount_dir ) cmd = ( 'mkfs.xfs %s -N -f %s' % ( needed_options , dev ) ) needed_out = utils . system_output ( cmd ) needed_out = re . sub ( 'internal log' , 'internal    ' , needed_out ) if ( current_option == needed_out ) : return True else : return False
compare the current ext* filesystem tunables with needed ones .