Your IP : 13.58.211.135
3
�<�e� � @ sp d dl jZddlmZ ddlT d dlmZmZ d dlZ d dl
mZ d dlZe j
j� Ze� ZG dd� dej�ZdS ) � N� )�base)�*)�Popen�PIPE)�commandsc @ st e Zd ZdZedd� �Zdd� Zedd� �Zdd � Zd
d� Z dd
� Z
dd� Zdd� Zdd� Z
eddd�dd� �ZdS )�MountsPluginaP
`mounts`::
Enables or disables barriers for mounts according to the value of the
[option]`disable_barriers` option. The [option]`disable_barriers`
option has an optional value `force` which disables barriers even
on mountpoints with write back caches. Note that only extended file
systems (ext) are supported by this plug-in.
c C s� i }d}t dddgttddd�j� \}}x�dd� |j� D �D ]�}t|�d k rNq<|dd � \}}}t|�d krt|d nd} t|�d
kr�|d
nd}
|dkr�|}q<|dks<|dkr�q<|
dks<|
dkr�q<|j|
t� || d�� ||
d j|� q<W || _dS )z�
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.
NZlsblkz-rnozTYPE,RM,KNAME,FSTYPE,MOUNTPOINTT)�stdout�stderrZ close_fdsZuniversal_newlinesc S s g | ]}|j � �qS � )�split)�.0�liner r �#/usr/lib/python3.6/plugin_mounts.py�
<listcomp>$ s z>MountsPlugin._generate_mountpoint_topology.<locals>.<listcomp>� � Zdisk�1�part�lvmz[SWAP])�disks�device_name�
filesystemr )r r ) r r Zcommunicate�
splitlines�len�
setdefault�set�add�_mountpoint_topology)�clsZmountpoint_topologyZcurrent_diskr r
�columnsZdevice_typeZdevice_removabler r �
mountpointr r r �_generate_mountpoint_topology s, z*MountsPlugin._generate_mountpoint_topologyc C s* | j � d| _t| jj� �| _t� | _d S )NT)r"