ok
Direktori : /proc/self/root/proc/thread-self/root/lib/python2.7/site-packages/tuned/plugins/ |
Current File : //proc/self/root/proc/thread-self/root/lib/python2.7/site-packages/tuned/plugins/plugin_mounts.pyc |
� ��\c @ s� d d l j Z d d l m Z d d l Td d l m Z m Z d d l Z d d l m Z d d l Z e j j � Z e � Z d e j f d � � YZ d S( i����Ni ( t base( t *( t Popent PIPE( t commandst MountsPluginc B s� e Z d Z e d � � Z d � Z e d � � Z d � Z d � Z d � Z d � Z d � Z d � Z e d d e �d � � Z RS( s. Plugin for tuning options of mount-points. c C s� i } d } t d d d g d t d t d t d t �j � \ } } x-g | j � D] } | j � ^ qU D]} t | � d k r� qk n | d \ } } } t | � d k r� | d n d } t | � d k r� | d n d } | d k r� | } qk n | d k sk | d k rqk n | d k sk | d k r4qk n | j | i t � d 6| d 6| d 6� | | d j | � qk W| | _ d S( s� Gets the information about disks, partitions and mountpoints. Stores information about used filesystem and creates a list of all underlying devices (in case of LVM) for each mountpoint. t lsblks -rnos TYPE,RM,KNAME,FSTYPE,MOUNTPOINTt stdoutt stderrt close_fdst universal_newlinesi i t diskt 1t partt lvms [SWAP]t diskst device_namet filesystemN( R R ( t NoneR R t Truet communicatet splitlinest splitt lent setdefaultt sett addt _mountpoint_topology( t clst mountpoint_topologyt current_diskR R t linet columnst device_typet device_removableR R t mountpoint( ( s? /usr/lib/python2.7/site-packages/tuned/plugins/plugin_mounts.pyt _generate_mountpoint_topology s, ,""(c C s; | j � t | _ t | j j � � | _ t � | _ d S( N( R$ R t _devices_supportedR R t keyst _free_devicest _assigned_devices( t self( ( s? /usr/lib/python2.7/site-packages/tuned/plugins/plugin_mounts.pyt _init_devices5 s c C s i d d 6S( Nt disable_barriers( R ( R) ( ( s? /usr/lib/python2.7/site-packages/tuned/plugins/plugin_mounts.pyt _get_config_options; s c C s t | _ t | _ d S( N( t Falset _has_dynamic_tuningR t _has_static_tuning( R) t instance( ( s? /usr/lib/python2.7/site-packages/tuned/plugins/plugin_mounts.pyt _instance_initA s c C s d S( N( ( R) R0 ( ( s? /usr/lib/python2.7/site-packages/tuned/plugins/plugin_mounts.pyt _instance_cleanupE s c C s8 t j d | � } x | D] } t j | � j � SWd S( sV Get device cache type. This will work only for devices on SCSI kernel subsystem. s+ /sys/block/%s/device/scsi_disk/*/cache_typeN( t globt cmdt read_filet stripR ( R) t devicet source_filenamest source_filename( ( s? /usr/lib/python2.7/site-packages/tuned/plugins/plugin_mounts.pyt _get_device_cache_typeH s c C s9 x2 | j | d D] } | j | � d k r t Sq Wt S( sr Checks if the device has 'write back' cache. If the cache type cannot be determined, asume some other cache. R s write back( R R: R R- ( R) R# R7 ( ( s? /usr/lib/python2.7/site-packages/tuned/plugins/plugin_mounts.pyt _mountpoint_has_writeback_cacheQ s c C s� t d � �` } xV | D]J } | j � } | d d d k rB q n | d | k r | d } Pq q Wd SWd QX| j d � } xb | D]V } | j d � \ } } } | d k s� | d k r� | d k r� t S| d k r� t Sq� Wt Sd S( sP Checks if a given mountpoint is mounted with barriers enabled or disabled. s /proc/mountsi t /i i Nt ,t =t nobarriert barriert 0( t openR R t partitionR- R ( R) R# t mounts_fileR R t option_listt optionst optiont namet sept value( ( s? /usr/lib/python2.7/site-packages/tuned/plugins/plugin_mounts.pyt _mountpoint_has_barriersZ s"