�
.�t_c@sjdZddlmZmZddlmZmZmZddlZddl Z defd��YZ
dS(s�
KernelModuleService - manages the kvdo kernel module
$Id: //eng/vdo-releases/magnesium/src/python/vdo/vdomgmnt/KernelModuleService.py#3 $
i(tDefaultstServicei����(tCommandtCommandErrort
runCommandNtKernelModuleServicecBsPeZdZed�Zd�Zd�Zd�Zd�Zd�Z d�Z
RS(s>KernelModuleService manages a kernel module on the local node.cCs�|rdnd}yXttjd|jd�dtd|�ttjdtj�dtd|�tSWntk
r~tSXdS( s@Returns True if the module is loaded and DM target is available.iislsmod | grep -q 't'tshelltretriessdmsetup targets | grep -q N( Rtstringtsplitt_nametTrueRt
vdoTargetNameRtFalse(tselftwaitR((sD/usr/lib/python2.7/site-packages/vdo/vdomgmnt/KernelModuleService.pytrunning%s
cCstd|jg�dS(sLoads the module if necessary.tmodprobeN(RR(R((sD/usr/lib/python2.7/site-packages/vdo/vdomgmnt/KernelModuleService.pytstart3scCsFi|jtd�6|jt�td�6tj|j��td�6S(sAReturns a dictionary representing the status of this object.
tNametLoadedsVersion information(Rt_RRtyamlt safe_loadtversion(R((sD/usr/lib/python2.7/site-packages/vdo/vdomgmnt/KernelModuleService.pytstatus8scCstdd|jg�dS(sRemoves the module.Rs-rN(RR(R((sD/usr/lib/python2.7/site-packages/vdo/vdomgmnt/KernelModuleService.pytstop@scCs_|jd}xKtd|jgdt�j�D](}|jd�dkr/||7}q/q/W|S(s'Returns the module version as a string.t tmodinfotnoThrowRi(RRRt
splitlinestfind(Rtstline((sD/usr/lib/python2.7/site-packages/vdo/vdomgmnt/KernelModuleService.pyREs
(cCstt|�j|�dS(N(tsuperRt__init__(Rtname((sD/usr/lib/python2.7/site-packages/vdo/vdomgmnt/KernelModuleService.pyR$PscCstS(sgKernelModuleService does not exclude any of its __dict__ contents
from its __repr__ result.
(R(Rtkey((sD/usr/lib/python2.7/site-packages/vdo/vdomgmnt/KernelModuleService.pyt_reprAttributeVs(t__name__t
__module__t__doc__RRRRRRR$R'(((sD/usr/lib/python2.7/site-packages/vdo/vdomgmnt/KernelModuleService.pyR s (R*tRRtutilsRRRR RR(((sD/usr/lib/python2.7/site-packages/vdo/vdomgmnt/KernelModuleService.pyt<module>s
|