ó .Å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ÿÿÿÿ(tCommandt CommandErrort runCommandNtKernelModuleServicecBsPeZdZed„Zd„Zd„Zd„Zd„Zd„Z d„Z RS(s>KernelModuleService manages a kernel module on the local node.cCsƒ|r dnd}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(R t_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(R RR t 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__R RRRRRR$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.pyts