Sindbad~EG File Manager

Current Path : /lib/python3.6/site-packages/vdo/vdomgmnt/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/vdo/vdomgmnt/__pycache__/KernelModuleService.cpython-36.pyc

3

x?agY�@s|dZddlmZddlmZddlmZddlmZddlmZmZddl	m
Z
mZmZdd	l
Z
dd	lZGd
d�de�Zd	S)z�
  KernelModuleService - manages the kvdo kernel module

  $Id: //eng/vdo-releases/aluminum/src/python/vdo/vdomgmnt/KernelModuleService.py#3 $

�)�absolute_import)�division)�print_function)�unicode_literals�)�Defaults�Service)�Command�CommandError�
runCommandNcsZeZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	�fdd�Z
dd�Z�ZS)�KernelModuleServicez>KernelModuleService manages a kernel module on the local node.Tc
Csh|rdnd}yBtddddd|jdgd|d	�td
ddddtjgd|d	�dStk
rbdSXd
S)z@Returns True if the module is loaded and DM target is available.�rZlsmod�|Zgrepz-q�'T)�shell�retries�dmsetup�targetsFN)r�_namer�
vdoTargetNamer
)�self�waitr�r�)/usr/lib/python3.6/KernelModuleService.py�running)s
zKernelModuleService.runningcCstd|jg�dS)zLoads the module if necessary.�modprobeN)rr)rrrr�start6szKernelModuleService.startcCs.td�|jtd�|jd�td�tj|j��iS)zAReturns a dictionary representing the status of this object.
    �NameZLoadedFzVersion information)�_rr�yamlZ	safe_load�version)rrrr�status;s
zKernelModuleService.statuscCstdd|jg�dS)zRemoves the module.rz-rN)rr)rrrr�stopCszKernelModuleService.stopcCsD|jd}x4td|jgdd�j�D]}|jd�dkr"||7}q"W|S)z'Returns the module version as a string.� ZmodinfoT)�noThrowr r)rr�
splitlines�find)r�s�linerrrr Hs

zKernelModuleService.versioncCs`xZtddgdd�j�D]B}tjtj�d}tj||�}|dk	rttt	|j
d�jd���SqWd
S)z/Returns the dmsetup targets version as a numberrrT)r$z\s+v(\d+\.\d+\.\d+)Nr�.r)rrr)rr%�re�escaperr�match�tuple�map�int�group�split)rr(ZversionMatchr rrr�
targetVersionQsz!KernelModuleService.targetVersioncstt|�j|�dS)N)�superr�__init__)r�name)�	__class__rrr4^szKernelModuleService.__init__cCsdS)zgKernelModuleService does not exclude any of its __dict__ contents
       from its __repr__ result.
    Tr)r�keyrrr�_reprAttributedsz"KernelModuleService._reprAttribute)T)
�__name__�
__module__�__qualname__�__doc__rrr!r"r r2r4r8�
__classcell__rr)r6rr$s

	
r)r<Z
__future__rrrr�rrZ	vdo.utilsr	r
rr*rrrrrr�<module>s

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists