Current File : //lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyc
�
.�t_c@s�dZddlmZddlmZddlmZddlmZmZddlmZmZddlm	Z	ddlm
Z
dd	lmZmZdd
lm
Z
mZddlmZmZmZdd
lmZmZddlZddlZddlZddlZddlZddlmZddlZddlZddlZdefd��YZdeefd��YZ deefd��YZ!deefd��YZ"deefd��YZ#defd��YZ$dS(s�
  VDOService - manages the VDO service on the local node

  $Id: //eng/vdo-releases/magnesium/src/python/vdo/vdomgmnt/VDOService.py#35 $

i(t
ArgumentError(t	Constants(tDefaults(tMgmntLoggert
MgmntUtils(tServicetServiceError(t
SizeString(tVDOKernelModuleService(tDeveloperExitStatustStateExitStatus(tSystemExitStatustUserExitStatusi����(tCommandtCommandErrort
runCommand(tTransactiont
transactionalN(t
gethostbynametVDOServiceErrorcBs eZdZed�d�ZRS(s)Base class for VDO service exceptions.
  sVDO volume errorcOs tt|�j|||�dS(N(tsuperRt__init__(tselftmsgtargstkwargs((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR8s(t__name__t
__module__t__doc__t_R(((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR2stVDODeviceAlreadyConfiguredErrorcBs eZdZed�d�ZRS(s8The specified device is already configured for a VDO.
  sDevice already configuredcOs tt|�j|||�dS(N(RRR(RRRR((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyRBs(RRRRR(((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR<stVDOServiceExistsErrorcBs eZdZed�d�ZRS(s VDO service exists exception.
  sVDO volume existscOs tt|�j|||�dS(N(RRR(RRRR((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyRLs(RRRRR(((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyRFstVDOMissingDeviceErrorcBs eZdZed�d�ZRS(s2VDO underlying device does not exist exception.
  s Underlying device does not existcOs tt|�j|||�dS(N(RR R(RRRR((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyRVs(RRRRR(((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR Pst VDOServicePreviousOperationErrorcBs eZdZed�d�ZRS(s3VDO volume previous operation was not completed.
  s+VDO volume previous operation is incompletecOs tt|�j|||�dS(N(RR!R(RRRR((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyRas(RRRRR(((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR![st
VDOServicecBszeZdZejejd�ZdZdZe	d�Z
e	d�Ze	d�Ze	d�Z
e	d�Ze	d	�Ze	d
�Ze	d�Ze	d�Ze	d
�Ze	d�Ze	d�Ze	d�Ze	d�Ze	d�Ze	d�Ze	d�Ze	d�ZdgZidd6dd6dd6dd6dd6dd6dd 6d!d"6d#d$6d%d&6d'd(6Zd)efd*��YZe d+��Z!d,�Z"e#d-�Z$d.�Z%e&e'd/��Z(d0�Z)d1�Z*d2�Z+d3�Z,e&d4��Z-e&d5��Z.d6�Z/e'dwd7�Z1d8�Z2e'd9�Z3d:�Z4e'dwd;�Z5d<�Z6d=�Z7d>�Z8d?�Z9d@�Z:e;dA��Z<e dB��Z=e>dC��Z?dD�Z@e>dE��ZAdF�ZBdG�ZCdH�ZDe;dI��ZEdJ�ZFdK�ZGdL�ZHdM�ZIdN�ZJdO�ZKdP�ZLdQ�ZMdR�ZNdS�ZOdT�ZPe'dU�ZQdV�ZRdW�ZSdX�ZTdY�ZUdZ�ZVd[�ZWd\d]�ZXd^�ZYd_�ZZd`�Z[da�Z\db�Z]dc�Z^dd�Z_de�Z`dwdf�Zadg�Zbe&dh��Zcdi�Zddj�Zedk�Zfdl�Zgdm�Zhe#dn�Zido�Zjdp�Zkdq�Zldr�Zmds�Zndt�Zodu�Zpdv�ZqRS(xs	VDOService manages a vdo device mapper target on the local node.

  Attributes:
    ackThreads (int): Number of threads dedicated to performing I/O
      operation acknowledgement calls.
    activated (bool): If True, should be started by the `start` method.
    bioRotationInterval (int): Number of I/O operations to enqueue for
      one bio submission thread in a batch before moving on to enqueue for
      the next.
    bioThreads (int): Number of threads used to submit I/O operations to
      the storage device.
    blockMapCacheSize (sizeString): Memory allocated for block map pages.
    blockMapPeriod (int): Block map period.
    cpuThreads (int): Number of threads used for various CPU-intensive tasks
      such as hashing.
    device (path): The device used for storage for this VDO volume.
    enableCompression (bool): If True, compression should be
      enabled on this volume the next time the `start` method is run.
    enableDeduplication (bool): If True, deduplication should be
      enabled on this volume the next time the `start` method is run.
    enableReadCache (bool): If True, enables the VDO device's read cache.
    hashZoneThreads (int): Number of threads across which to subdivide parts
      of VDO processing based on the hash value computed from the block data
    indexCfreq (int): The Index checkpoint frequency.
    indexMemory (str): The Index memory setting.
    indexSparse (bool): If True, creates a sparse Index.
    indexThreads (int): The Index thread count. If 0, use a thread per core
    logicalSize (SizeString): The logical size of this VDO volume.
    logicalThreads (int): Number of threads across which to subdivide parts
      of the VDO processing based on logical block addresses.
    physicalSize (SizeString): The physical size of this VDO volume.
    physicalThreads (int): Number of threads across which to subdivide parts
      of the VDO processing based on physical block addresses.
    readCacheSize (SizeString): The size of the read cache, in addition
      to a minimum set by the VDO software.
    slabSize (SizeString): The size increment by which a VDO is grown. Using
      a smaller size constrains the maximum physical size that can be
      accomodated. Must be a power of two between 128M and 32G.
    writePolicy (str): sync, async or auto.
  s.Service.VDOServiceu!VDOServicetVDOss
Read cachesRead cache sizesAcknowledgement threadssBio submission threadssBlock map cache sizesBlock map periods
Block sizetCompressionsCPU-work threadst
DeduplicationsHash zone threadssLogical sizesLogical threadss
MD RAID5 modes
Physical sizesPhysical threadssVDO statisticssWrite policytdevicetblockMapCacheSizetblockMapPeriodt	readCachet
readCacheSizet
ackThreadst
vdoAckThreadstbioRotationIntervaltvdoBioRotationIntervalt
bioThreadst
vdoBioThreadst
cpuThreadst
vdoCpuThreadsthashZoneThreadstvdoHashZoneThreadstlogicalThreadstvdoLogicalThreadstphysicalThreadstvdoPhysicalThreadstOperationStatecBs;eZdZdZdZdZdZdZed��Z	RS(tbeginCreatetbeginGrowLogicaltbeginGrowPhysicaltbeginRunningSetWritePolicytfinishedtunknowncCs"|j|j|j|j|jgS(s�Return a list of the possible specific operation states.

      "Specific operation state" means a state that is specifically set
      via normal processing.
      (R:R;R<R=R>(tcls((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pytspecificOperationStates�s(
RRR:R;R<R=R>R?tclassmethodRA(((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR9�scCsZxS|jD]H}t||d�dk	r
td�j|�}t|dt��q
q
WdS(s�Validates that any options specified in the arguments are solely
    those which are modifiable.

    Argument:
      args  - arguments passed from the user
    s+Cannot change option {0} after VDO creationt
exitStatusN(tfixedOptionstgetattrtNoneRtformatRR(R@RtoptionR((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pytvalidateModifiableOptions�s
	cCs�|j�|jrBtd�j|j��}|jj|�dS|jjtd�j|j���t|_|jj	|j�|t�dS(sCMarks the VDO device as activated, updating the configuration.
    s{0} already activatedNsActivating VDO {0}(
t_handlePreviousOperationFailuret	activatedRRGtgetNametlogtannouncetTruetconfigtaddVdo(RR((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pytactivate�s
	%	cCs�|j�r=|jjtd�j|j�|j���nP|rk|jjtd�j|j���n"|js�|jjtd��ndS(s.Logs the VDO volume state during create/start.s'VDO instance {0} volume is ready at {1}sVDO volume created at {0}s,VDO volume cannot be started (not activated)N(trunningRMRNRRGtgetInstanceNumbertgetPathRK(Rt
wasCreated((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyt
announceReady�s(	cCsw|jjtd�j|j���|j�tdd|j�ddg�|jjtd�j|j���dS(sConnect to index.s Attempting to get {0} to connecttdmsetuptmessaget0sindex-enables{0} connect succeededN(RMRNRRGRLRJR(R((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pytconnects

c
s�|jjtd�j|j���|jjdj|jj��|j�|j	r�td�j|j��}t
|��n|jj|j�r�td�j|j�}t
|��n|j�r�td�j|j��}t|dt��n|j|j�|j|j|j|j�|s8|j�ntjj|j�}d�g}tjj��r&g�fd�tj��D�D]$}tjj|�|kr�|^q�}|dk	r&|j|�}|dk	r#|jjd	jd
|��g|D]}||kr�|^q�}q#q&nt|�dkr�|jjdjd
|d|��g|D]$}t j!d|�dk	ra|^qa}t|�dkr�|}n|j"�|d|_|jjdjd|j��n"|jjdjd
|d���|j#|j$�|j%|j&j'�t(j)�}	|	j*|jj+�|	j*t,j-|jj.|j���|j/|�|j0�|j%|j&j1�dS(s Creates and starts a VDO target.sCreating VDO {0}sconfFile is {0}sVDO volume {0} already existss)Device {0} already configured for VDO uses2Name conflict with extant device mapper target {0}RCs/dev/disk/by-idc3s$|]}tjj�|�VqdS(N(tostpathtjoin(t.0tname(tidDir(s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pys	<genexpr>9sspruning {uuid} from aliasestuuidis'found aliases for {original}: {aliases}toriginaltaliasess.*/[dm][dm]-uuid-susing {new}tnews+no aliases for {original} found in {idDir}!RaN(2RMRNRRGRLtdebugRPtfilepathRJt
isConstructedRtisDeviceConfiguredR&Rt_mapperDeviceExistsRR
t_validateAvailableMemorytindexMemoryt_validateModifiableThreadCountsR3R5R7t_createCheckCleanDeviceR\R]trealpathtisdirtlistdirRFt_getDeviceUUIDtlentretmatchtsortt_installKernelModuletvdoLogLevelt_setOperationStateR9R:RttransactiontaddUndoStagetpersistt	functoolstpartialt	removeVdot_constructVdoFormatt_constructServiceStartR>(
RtforceRRoRdtabsnamet
deviceUUIDtatuuidAliasesRz((Ras;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pytcreate
sp%
	

$
.

$	

"

cCs�|j�|jsBtd�j|j��}|jj|�dS|jjtd�j|j���t|_|jj	|j�|t
�dS(sGMarks the VDO device as not activated, updating the configuration.
    s{0} already deactivatedNsDeactivating VDO {0}(RJRKRRGRLRMRNtFalseRPRQRO(RR((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyt
deactivateos
	%	cCsm|j�y#tdd|j�ddg�Wn9tk
rh|jjtd�j|j����nXdS(s*Disables deduplication on this VDO device.RXRYRZs
index-disables$Cannot stop deduplication on VDO {0}N(RJRRLt	ExceptionRMterrorRRG(R((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyt
disconnect~s
#
cCs4|j�|jr-|j�r-|j�n|jS(s9Returns the instance number of a vdo if running, or zero.(RJtinstanceNumberRSt_determineInstanceNumber(R((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyRT�s

cCstjjd|j��S(s)Returns the full path to this VDO device.s/dev/mapper(R\R]R^RL(R((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyRU�scCsx|j�|j�sFtd�j|j��}t|dt��n|j�||jkr�td�j|j�}t|dt	��n<||jkr�td�jt
j�}t|dt	��n|j|j
j�|jjtd�j|j���tj�}|j|jjtd�j|j���tdd|j�d	d
t|j��g�|jd�|j�|j|j�|jjtd�j|j���|j|jjtd�j|j���|j�}|jd
t|��}tdd|jd|g�|jd�|jjtd�j|j���||_|j�|j|j
j�dS(spGrows the logical size of this VDO volume.

    Arguments:
      newLogicalSize (SizeString): The new size.
    sVDO volume {0} must be runningRCs(Can't shrink a VDO volume (old size {0})s.Can't grow a VDO volume by less than {0} bytess-Preparing to increase logical size of VDO {0}s)Cannot prepare to grow logical on VDO {0}RXRYRZtprepareToGrowLogicals)Increasing logical size of VDO volume {0}sDevice {0} could not be changedt
numSectorstreloads--tables(Increased logical size of VDO volume {0}N( RJRSRRGRLRR
troundToBlocktlogicalSizeRRtVDO_BLOCK_SIZERyR9R;RMtinfoRRzt
setMessageR�RtstrttoBlocksRFt_suspendR{t_resumet	toSectorst_generateModifiedDmTablet_nameR>(RtnewLogicalSizeRRzR�tvdoConf((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pytgrowLogical�sN




	
cCs�|j�|j�sFtd�j|j��}t|dt��n|j|jj	�|j
jtd�j|j���tj
�}|j|j
jtd�j|j���tdd|j�ddg�|jd�|j�|j|j�|j|j
jtd	�j|j���tdd|j�dd
g�|jd�|j�}|dtj}|d|}td
j|��|_|j�|j|jj�dS(s�Grows the physical size of this VDO volume.

    Arguments:
      newPhysicalSize (SizeString): The new size. If None, use all the
                                    remaining free space in the volume
                                    group.
    sVDO volume {0} must be runningRCs.Preparing to increase physical size of VDO {0}s*Cannot prepare to grow physical on VDO {0}RXRYRZtprepareToGrowPhysicalsCannot grow physical on VDO {0}tgrowPhysicalt	blockSizetphysicalBlockss{0}sN(RJRSRRGRLRR
RyR9R<RMR�RRzR�R�RRFR�R{R�t_getConfigFromVDORtSECTOR_SIZERtphysicalSizeR>(RRRzt	vdoConfigtsectorsPerBlockR�((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR��s8	






cCsm|j�y#tdd|j�ddg�Wn9tk
rh|jjtd�j|j����nXdS(s)Enables deduplication on this VDO device.RXRYRZsindex-enables%Cannot start deduplication on VDO {0}N(RJRRLR�RMR�RRG(R((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyt	reconnects
#
cCs]|jjtd�j|j���ytj|j�Wn>tk
ry|sztd�j|j�}t	|��qznXg}y'|j
||�|s�|j�nWn�tk
r)|dk	r#t|�dkr#|jtd�j|j���|jg|D]}dj|�^q�n�nX|jj|j��|j�sY|j�ndS(s%Removes a VDO target.

    If removeSteps is not None it as an empty list to which the processing
    commands for removal will be appended.

    If force was not specified and the instance previous operation failure
    is not recoverable VDOServicePreviousOperationError will be raised.
    sRemoving VDO {0}s.Device {0} not found. Remove VDO with --force.isSteps to clean up VDO {0}:s    {0}N(RMRNRRGRLR\tstatR&tOSErrorR tstopRJR!RFRstappendtextendRPRt_hasHolderst_clearMetadata(RR�tremoveStepsRtlocalRemoveStepsts((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pytremoves,	%

,cCsQy8tdddtj|j�g�}|j�dkSWntk
rLtSXdS(s-Returns True if the VDO service is available.RXtstatuss--targettN(RRt
vdoTargetNameRLtstripR�R�(Rtresult((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyRSIs
c	Cs[|jjtd�j|j���|j�|jsa|jjtd�j|j���dS|j�r�t	j
�r�|jjtd�j|j���dS|j|j�|j
�|j�yT|ry|j�Wqtk
r|jjtd�j|j����qXntdd|jd|j�d	|j�g�|jsyy|j�Wqytk
ruqyXn|j�|jr�|jjtd
�j|j�|j��ny|jr�|j�nWn9tk
r|jjtd�j|j����nX|j�Wn9tk
rV|jjtd�j|j����nXdS(
s�Starts the VDO target mapper. In noRun mode, we always assume
    the service is not yet running.

    Raises:
      ServiceError
    sStarting VDO {0}sVDO service {0} not activatedNsVDO service {0} already startedsDevice {0} not read-onlyRXR�s--uuids--tables$started VDO service {0} instance {1}s$Could not enable compression for {0}s&Could not set up device mapper for {0}(RMRNRRGRLRJRKR�RSR
t	noRunModeRkRlRwt_checkConfigurationt
_forceRebuildR�R�RR�t_getUUIDt_generateDeviceMapperTabletenableDeduplicationR�R�R�tenableCompressiont_startCompressiont_startFullnessMonitoring(RtforceRebuild((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pytstartVsT%
	%


%
	

		

cCs�|j�i}|j|td�<t|j�||j<|j||j<tj	||j
<tj|jdk�|td�<tj|j
�|td�<tj|j�||j<t|j�||j<tj|j�||j<tj|j�||j<t|j�||j<t|j�||j<|j||j<|j||j<|j|td�<|j||j <|j!||j"<|j#||j$<|j%||j&<t|j'�|td�<|j(|td�<|j)|td�<|j*|td	�<|j+|td
�<tj|j,�|td�<|j-�|td�<t.j/�d
kr�t0j1dd|j2�g�|td�<y5t3dd|j4�g�}t5j6|�||j7<Wq�t8k
r�td�||j7<q�Xn|S(sAReturns a dictionary representing the status of this object.
    sStorage deviceisEmulate 512 bytetActivatesBio rotation intervals	Slab sizesConfigured write policysIndex checkpoint frequencysIndex memory settingsIndex parallel factorsIndex sparsesIndex statusiRXR�sDevice mapper statustvdostatss	--verboses
not available(9RJR&RR�R'tvdoBlockMapCacheSizeKeyR(tvdoBlockMapPeriodKeyRR�tvdoBlockSizeKeytenableStringtlogicalBlockSizeRKtenableReadCachetreadCacheKeyR*treadCacheSizeKeyR�tvdoCompressionEnabledKeyR�tvdoDeduplicationEnabledKeyR�tvdoLogicalSizeKeyR�tvdoPhysicalSizeKeyR+tvdoAckThreadsKeyR/tvdoBioSubmitThreadsKeyR-R1tvdoCpuThreadsKeyR3tvdoHashZoneThreadsKeyR5tvdoLogicalThreadsKeyR7tvdoPhysicalThreadsKeytslabSizetwritePolicyt
indexCfreqRltindexThreadstindexSparset_getDeduplicationStatusR\tgetuidRtstatusHelperRLRRUtyamlt	safe_loadtvdoStatisticsKeyR�(RR�R�((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR��sR

c

Cs<|jjtd�j|j���|}|s\y|j�t}Wq\tk
rXq\Xn|r�|j�r�t	j
�r�|jr�|jjtd�j|j���dSn|j�}|r|j
�rtd�j|j��}t|dt��n|r|j�s|r�dd|j�g}|dk	rS|jdj|��n|r�|rrt|d	t�q�td
�j|j��}t|dt��q�nddg}|dk	r�|jdj|��n|r�|r�t|d	t�n|r|j||�nd
d|j�g}|dk	rH|jdj|��nt}|r�|r�xhtd�D]W}yt|�dSWn/tk
r�}	dt|	�kr�t}Pq�nXtjd�qgWn|s�|j�n|j�r8|rtd�j|j��}ntd�j|j��}t|dt��ndS(s�Stops the VDO target mapper. In noRun mode, assumes the service
    is already running.

    If removeSteps is not None it is a list to which the processing
    commands will be appended.

    If force was not specified and the instance previous operation failed
    VDOServicePreviousOperationError will be raised.

    Raises:
      ServiceError
      VDOServicePreviousOperationError
    sStopping VDO {0}sVDO service {0} already stoppedNs"cannot stop VDO volume {0}: in useRCtumounts-ft tnoThrows&cannot stop VDO volume with mounts {0}tudevadmtsettleRXR�i
sDevice or resource busyis*cannot stop VDO service {0}: device in usescannot stop VDO service {0}(RMRNRRGRLRJROR!RSR
R�tpreviousOperationFailureR�R�RR
t
_hasMountsRURFR�R^Rt_stopFullnessMonitoringtrangeR�R�R�ttimetsleept)_generatePreviousOperationFailureResponseR(
RR�R�texecuteRSRtcommandtinUsetunused_itex((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR��sr%





cCs�|j|rdndd�|j�|r5|jsF|r�|jr�dj|rXdnd�}|jjt|�|j��dS||_|jj	|j�|t
�|jr�|j�n
|j�dS(soChanges the compression setting on a VDO.  If the VDO is running
    the setting takes effect immediately.
    tEnablingt	Disablingtcompressionscompression already {0} on VDO tenabledtdisabledN(
t	_announceRJR�RGRMR�RRLRPRQROR�t_stopCompression(RtenableRY((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pytsetCompression"s
 		
cCs||_t|_dS(s3Sets the configuration reference and other attributes dependent on
    the configuration.

    This method must tolerate the possibility that the configuration is None
    to handle instantiation from YAML representation.  At present, there is
    nothing for which we attempt to use the configuration.
    N(t_configR�t_configUpgraded(RRP((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyt	setConfig9s		cCs�|j|rdndd�|j�|r5|jsF|r�|jr�dj|rXdnd�}|jjt|�|j��dS||_|jj	|j�|t
�|j�r�|jr�|j�d}xCttj�D]2}|j�}|tjkrtjd�q�Pq�W|tjkr'q�|tjkr`ttd	�j|j��d
t��q�|tjkr�td�j|j��}|jj|�q�td�j||j��}t|d
t��q�|j�ndS(
sqChanges the deduplication setting on a VDO.  If the VDO is running
    the setting takes effect immediately.
    R�R�t
deduplications!deduplication already {0} on VDO R�R�Nis$Error enabling deduplication for {0}RCs2Timeout enabling deduplication for {0}, continuings;Unexpected kernel status {0} enabling deduplication for {0}(R�RJR�RGRMR�RRLRPRQRORSR�RFR�RtDEDUPLICATION_TIMEOUTR�tdeduplicationStatusOpeningR�R�tdeduplicationStatusOnlinetdeduplicationStatusErrorRRtwarnR�(RR�RYR�t_i((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pytsetDeduplicationFsB
 		
cCs�|j�|jt|d|j�t|d|j�t|d|j��t}xO|jD]D}t||d�}|dk	rZt	||j||�t
}qZqZW|r�|jj|j
�|t
�|j�r�|jjtd�j|j
���q�ndS(s�Sets any of the modifiable options that are specified in the arguments.

    Argument:
      args  - arguments passed from the user

    Raises:
      ArgumentError
    R4R6R8s7Note: Changes will not apply until VDO {0} is restartedN(RJRmRER3R5R7R�tmodifiableOptionsRFtsetattrRORPRQRLRSRMRNRRG(RRtmodifiedRHtvalue((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pytsetModifiableOptionsss&	
				

	cCs�|j�||jkr�||_|j�sM|jj|j�|t�q�|j|jj	�|j
�|j|jj�ndS(saChanges the write policy on a VDO.  If the VDO is running it is
    restarted with the new policyN(RJR�RSRPRQRLRORyR9R=t_performRunningSetWritePolicyR>(Rtpolicy((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pytsetWritePolicy�s
	
cCsOddddddddd	d
ddd
ddddddddddddgS(s8Returns the list of standard attributes for this object.R+RKR-R/R'R(R1R�RR&R3R�RlR�R�R�R�R5t_operationStateR�R7R)R*R�R�((((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pytgetKeys�s2cCs
|dd�S(NtYAMLInstance(RF(R@((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyt_yamlMakeInstance�scCs�tt|�j}tj|j�|d<t|j�|d<tj|j�|d<tj|j	�|d<tj|j
�|d<t|j�|d<t|j�|d<tj|j
�|d<t|j�|d	<t|j�|d
<|j|d<|S(NRKR'R�RR�R�R�R)R*R�R�(RR"t	_yamlDataRR�RKR�R'R�R�R�R�R�R�R*R�R�(Rtdata((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR�s
cCs�tt|�j|�|j|dtj|j��tjk|_t|j|d|j	j
��|_	|j|dtj|j��tjk|_|j|dtj|j��tjk|_|j|dtj|j
��tjk|_
t|j|d|jj
��|_t|j|d|jj
��|_|j|dtj|j��tjk|_t|j|d	|jj
��|_t|j|d
|jj
��|_d|kr�|d|_ndS(NRKR'R�RR�R�R�R)R*R�R�(RR"t_yamlSetAttributest_defaultIfNoneRR�RKR�RR'ttoBytesR�R�R�R�R�R�R*R�R�(Rt
attributes((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR�s>!!cCsDtt|�j}|jddddddddd	d
dg�|S(NRKR'R�RR�R�R�R)R*R�R�(RR"t_yamlSpeciallyHandledAttributesR�(Rtspecials((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyRs	
cCs�|dkr|j�S|dkr,|j�S|dkrB|j�S|dkrX|j�S|dkrztt|�j|�S|dkr�|j�S|dkr�|j�St	dj
d	t|�jd
|���dS(NRPRhtoperationStateR�Rlt%unrecoverablePreviousOperationFailureR�s('{obj}' object has no attribute '{attr}'tobjtattr(
t_computedConfigt_computedIsConstructedt_computedOperationStatet!_computedPreviousOperationFailureRR"t__getattr__t._computedUnrecoverablePreviousOperationFailuret_computedWritePolicytAttributeErrorRGttypeR(RR`((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR&-s 





c
KsUtt|�j|�|j|�|jj|_d|_|j	d�|_
|j|dtj
�|_
|j|dtj�|_|j|dtj�|_|j|dtj�|_|j|dtj�|_|j|dtj�|_tj|_|j|dtj�}|tjkr.d	|_n|j|d
tj�}|tjk|_|j|dtj�}|tjk|_|j|dtj�}|tjk|_|j|d
tj�|_|j	dtd��|_ |j|dtj!�|_!tj"|_"td�|_#|j|dtj$�|_$|j|dtj%�}|tjk|_&|j|dtj'�|_'|j|dtj(�|_(|j|dtj)�|_*t+|_,d|_-|j	d�|_.|j|dtj/�|_0|j1|j|dtj2��|j|dtj3�}	|	tjk|_4|j|dtj5�|_6dS(NR&R,R.R0R'R(R2t
emulate512iR�RRRR4tvdoLogicalSizeRZR6R8R)R*tvdoSlabSizeR�iRxtcfreqtindexMemtsparseIndextudsParallelFactor(7RR"RRR9R?RRFt_previousOperationFailuretgetR&RRR+R-R/R'R(R1RR�R�R+R�R�R�RR�RRRKR3RR�R5tmdRaid5ModeR�R7R)R�R*R�R�t_writePolicyR�t_writePolicySetR�RxR.R�t_setMemoryAttrR/R0R�R1R�(
RR`tconftkwR+R�RRRR)tsparse((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyRDsr
			
cCs�|dkr!|tjk|_ne|dkr=|j|�nI|dkr^||_t|_n(|dkrmntt|�j	||�|dkr�t
||�j�ndS(NR)RlR�t
identifierR�R�(slogicalSizesphysicalSize(RR�R�R7R5ROR6RR"t__setattr__RER�(RR`R
((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR<�s	cCs#|j|�}|dkr|S|S(N(R3RF(RR`tdefaultR
((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR�scCs6dj||�}|jjt|�|j��dS(Ns{0} {1} on VDO (RGRMRNRRL(RtactionRHRY((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR��scCs�|jj�}|d|jkrRtd�j|j��}t|dt��nt|j	t
j�|_	t|j	t
j
�|_	dS(sQCheck and fix the configuration of this VDO.

    Raises:
      ServiceError
    iis$Insufficient block map cache for {0}RCNi(R'R�R5RRGRLRRtmaxR(RtblockMapPeriodMintmintblockMapPeriodMax(Rt
cachePagesR((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR��scCs�yKtj|j�j}tj|�sJ|jjdjd|j��dSWn9tk
r�}|jjdjd|jd|��dSXdddjd|j�d	d
dg}t	|�dS(s.Clear the VDO metadata from the storage devices-Not clearing {devicePath}, not a block devicet
devicePathNs,Not clearing {devicePath}, cannot stat: {ex}R�tddsif=/dev/zerosof={devicePath}soflag=directsbs=4096scount=1(
R\R�R&tst_modetS_ISBLKRMRfRGR�R(RtmodeR�R�((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR��s"
	cCs�ddlm}|js�d}y|jj|j��}Wntk
rNn2X|j|j	j
kr�|j|j	jdt
�nt|_n|jS(s[Update the instance properties as necessary and return the
    configuration instance.
    i(t
ConfigurationR|N(R�RIRRFR�tgetVdoRLRRR9R?RyR>R�RO(RRItservice((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR"�s	
	
cCs|j|jjkS(sYReturns a boolean indicating if the instance represents a fully
    constructed vdo.
    (RR9R>(R((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR#�scCs=|}y|jj|j��}Wntk
r5nX|jS(s�Return the operation state of the instance.

    If there is an instance in the configuration the state reported is from
    that instance else it's from this instance.
    (RPRJRLRR(RRK((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR$�s
cCsF|jdkr?|j|jjko6|j|jjk|_n|jS(sCReturns a boolean indicating if the instance operation failed.
    N(R2RFRR9R?R>(R((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR%scCs|jo|j|jjkS(shReturns a boolean indicating if a previous operation failure cannot be
    automatically recovered.
    (R�RR9R:(R((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR's	cCsI|}|jsBy|jj|j��}WqBtk
r>qBXn|jS(s�Return the write policy of the instance.

    If this instance's write policy was not explicitly set and there is an
    instance in the configuration the write policy reported is from that
    instance else it's from this instance.
    (R6RPRJRLRR5(RRK((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR(#s	
cCs)|jj�}ttj|d�d�S(sCCompute the --slab-bits parameter value for the slabSize attribute.ig�������?(R�R�tinttmathRM(Rtblocks((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyt_computeSlabBits4scCsI|jjdj|j���tj�}|j�|j|j�dS(Ns construction - starting; vdo {0}(	RMRfRGRLRRzR�R{R�(RRz((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR�;s
cCs�|jjdj|j���tj�}|j|�|j|j�|j	�}|dt
j}|d|}tdj|��|_
|d|}tdj|��|_dS(Ns1construction - formatting logical volume; vdo {0}R�R�s{0}st
logicalBlocks(RMRfRGRLRRzt
_formatTargetR{R�R�RR�RR�R�(RR�RzR�R�R�R�((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR�Cs
cCs�y#tddddd|jg�Wntk
r*}g|j�j�D]}|j�^qH}t|�}|dkr!x�t|�D]�}tj	d||�dk	r�x[||dD]K}tj	d	|�}|dk	r�td
j|j
d��dt��q�q�WPq�q�W|j|d�n|�nXytd
d|jg�Wn)tk
rp}|j�dkrqdSnXtdddt��dS(s�Performs a verification for create that the storage device doesn't
    already have something on it.

    Raises:
      VDOServiceError
    tpvcreates--configsdevices/scan_lvs=1s-qqs--testis
^TEST MODEis'WARNING: (.* detected .*)\.\s+Wipe it\?s{0}; use --force to overrideRCi����tblkids-piNsdevice is a physical volume;s use --force to override(RR&RtgetStandardErrort
splitlinesR�RsR�RtRuRFRRGtgroupR
R�tgetExitCode(Rtetlinetlinest	lineCounttitdetectionMatch((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyRnSs6
+			
cCs�dj|j��}y7t|d��"}t|j�j��|_WdQXWn;tk
r�}|jj	t
d�j|j�|��nXdS(s;Determine the instance number of a running VDO using sysfs.s/sys/kvdo/{0}/instancetrNs8unable to determine VDO service {0} instance number: {1}(RGRLtopenRLtreadR�R�R�RMtwarningR(RR]tfterr((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR��s%	cCstd|jg�dS(saCalls vdoforcerebuild to exit read-only mode and force a metadata
    rebuild at next start.
    tvdoforcerebuildN(RR&(R((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR��scCs$dg}|jdt|j��|j}|dkrDtj}n|js\tj|_n|jdt|��|jr�|jd�n|jj	�dkr�|jd|jj
��n|jtjkr�|jdt|j���n|r|jd	�n|j|j�t
|�d
S(sFormats the VDO target.t	vdoformats--uds-checkpoint-frequency=gs--uds-memory-size=s--uds-sparseis--logical-size=s--slab-bits=s--forceN(R�R�R�RlRR/R�R�R�Rt	asLvmTextROR&R(RR�tcommandLinetmemVal((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyRQ�s$				 cCs|jj�}|jj�}djdt|j�dt|j�dt|j�dt|j	�dt|j
�dt|j�dt|j�g�}d	jd
t|�t
j|jt|j�tj|j�t|jj��t|�t|j�|j|j|j|g
�}|S(sRGenerate the device mapper table line from the properties of this
    object.
    t,sack=sbio=sbioRotationInterval=scpu=shash=slogical=s	physical=R�RZ(R�R�R'R�R^R�R+R/R-R1R3R5R7RR�R&R�RR�R�R*R(R4R�R�(RR�RCtthreadCountConfigR�((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR��s(
cKs�tdd|jg�j�}|jj|�dddd}tt|jd�|jd���}x$|j�D]\}}|||<qtWdj	g|jd�D]}||^q��S(s�Changes the specified parameters in the dmsetup table to the specified
    values.

    Raises:
      CommandError if the current table cannot be obtained

    Returns:
      a valid new dmsetup table.
    RXttables8logicalStart numSectors targetName storagePath blockSizes5 readCache readCacheBlocks cacheBlocks blockMapPeriods! mdRaid5Mode writePolicy poolNames threadCountConfigR�(
RR�trstripRMR�tdicttziptsplitt	iteritemsR^(RRRkt
tableOrdertdmTabletkeytval((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR��s
'R�cCsCtd�j|j�||dkr*dnd�}t|��dS(s�Generates the required response to a previous operation failure.

    Logs a message indicating that the previous operation failed and raises the
    VDOServicePreviousOperationError exception with the same message.

    Arguments:
      operation (str) - the operation that failed; default to "create" as that
                        is currently the only operation that is not
                        automatically recovered

    Raises:
      VDOServicePreviousOperationError
    s8VDO volume {0} previous operation ({1}) is incomplete{2}R�s(; recover by performing 'remove --force'R�N(RRGRLR!(Rt	operationR((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR��scCs?|js2|jjtd�j|j���dS|j|jj�kr�td�j|j�|j�}t	|dt
��n�|j|jjkr�|j�n�|j|jj
kr�|j�nn|j|jjkr�|j�nL|j|jjkr|j�n*td�j|j�}t	|dt
��t|_dS(sBHandles a previous operation failure.

    If the failure can be corrected automatically it is.
    If not, the method logs a message indicating that the previous operation
    failed and raises the VDOServicePreviousOperationError exception with
    the same message.

    Raises:
      VDOServicePreviousOperationError if the previous operation failure
      is a non-recoverable error.

      VDOServiceError if unexpected/unhandled operation state is
      encountered.  Excepting corruption or incorrect setting of state this
      indicates that the developer augmented the code with an operation (new or
      old) which can experience a catastrophic failure requiring some form of
      recovery but failed to update specificOperationStates() and/or failed to
      add a clause to this method to address the new failure.
    s0No failure requiring recovery for VDO volume {0}Ns.VDO volume {0} in unknown operation state: {1}RCs5Missing handler for recover from operation state: {0}(R�RMRfRRGRLRR9RARR	R:R�R;t_recoverGrowLogicalR<t_recoverGrowPhysicalR=t_recoverRunningSetWritePolicyR�R2(RR((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyRJ�s,		



cCs�|}tj|tj�s<ttd�jd|���ntjtj|�j	�r�t
dd|g�}|j�j�}n|dkr�ttd�jd|���n|S(s�Take the server name and convert it to a device name that
    can be opened from the kernel

    Arguments:
      devicePath (path): path to a device.

    Raises:
      ArgumentError
    s{path} does not existR]treadlinks-fR�s{path} could not be resolved(
R\taccesstF_OKRRRGR�tS_ISLNKtlstatRFR
trunR�(RRDtresolvedPathtcmd((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyt_getBaseDevice,s
cCs&tjtd|jg��}|dS(sbReturns a dictionary of the configuration values as reported from
    the actual vdo storage.
    t
vdodumpconfigt	VDOConfig(R�R�RR&(RRP((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR�CscCs*tjtd|jg��}d|dS(s>Returns the uuid as reported from the actual vdo storage.
    R�sVDO-tUUID(R�R�RR&(RRP((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR�LscCsbtd�}y>tdd|j�g�}|jd�}|tjj}Wntk
r]nX|S(Ns
not availableRXR�R�(RRRLRoRtdmsetupStatusFieldstdeduplicationStatusR�(RR�toutputtfields((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR�Ts
cCsqy(tddddd|g�j�}Wn.tk
rX}|jjdt|��dSX|dkridS|SdS(	s�Get the UUID of the device passed in,

    Arguments:
      devicePath (path): path to a device.

    Returns:
      UUID as a string, or None if none found
    RSs-sR�s-oR
sblkid failed: R�N(RR�RRMR�R�RF(RRDR�R�((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyRras	cCs�y=tj|j��}tj|j�}tj|j�}Wntk
rQtSXdjd|d|�}tj	j
|�r�tj|�}t|�dkr�|j
jdjd|j�ddj|���tSntS(	s�Tests whether other devices are holding the VDO device open. This
    handles the case where there are LVM entities stacked on top of us.

    Returns:
      True iff the VDO device has something holding it open.
    s&/sys/dev/block/{major}:{minor}/holderstmajortminoris&{path} is being held open by {holders}R]tholdersR�(R\R�RUR�tst_rdevR�R�R�RGR]RpRqRsRMR�R^RO(RtstR�R�tholdersDirectoryR�((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR�vs
	cCsrtdgdt�}|rntjdtj|j��d�}x*|j�D]}|j|�rNtSqNWntS(s�Tests whether filesystems are mounted on the VDO device.

    Returns:
      True iff the VDO device has something mounted on it.
    tmountR�s(\A|\s+)s\s+(	RRORttcompiletescapeRURUtsearchR�(Rt	mountListtmatcherRY((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR��s&cCsst�}y|j�Wn9tk
rR|jjtd�j|j����nX|dk	ro|j	|�ndS(s�Install the kernel module providing VDO support.

    Arguments:
      logLevel: the level of logging to use; if None, do not set level
    sKernel module {0} not installedN(
RR�R�RMR�RRGRLRFtsetLogLevel(RtlogLeveltkms((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyRw�s	
cCs4ytj|j��tSWntk
r/tSXdS(sOReturns True if there already exists a dm target with the name of
    this VDO.N(R\R�RUROR�R�(R((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyRj�s

cCs�tj�}|j�|j|j�|j|jjtd�j	|j
���|jd|j�}|j|jjtd�j	|j
���t
dd|jd|g�|jd�|j�dS(sHPeforms the changing of the write policy on a running vdo instance.
    sDevice {0} could not be readR�sDevice {0} could not be changedRXR�s--tableN(RRzR�R{R�R�RMR�RRGRLR�R�RR�RF(RRzR�((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR�s

cCs�|js1|jjtd�j|j���n�|j|jjkrvtd�j|j��}t	|dt
��ni|j�}|d|dtj
}tdj|��|_|j�r�|j�n|j|jj�dS(scRecovers a VDO target from a previous grow logical failure.

    Raises:
      VDOServiceError
    s5No grow logical recovery necessary for VDO volume {0}sCPrevious operation failure for VDO volume {0} not from grow logicalRCRPR�s{0}sN(R�RMRfRRGRLRR9R;RR	R�RR�RR�RSR�RyR>(RRR�R�((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyRv�s		
cCs�|js1|jjtd�j|j���n�|j|jjkrvtd�j|j��}t	|dt
��ni|j�}|d|dtj
}tdj|��|_|j�r�|j�n|j|jj�dS(sdRecovers a VDO target from a previous grow physical failure.

    Raises:
      VDOServiceError
    s6No grow physical recovery necessary for VDO volume {0}sDPrevious operation failure for VDO volume {0} not from grow physicalRCR�R�s{0}sN(R�RMRfRRGRLRR9R<RR	R�RR�RR�RSR�RyR>(RRR�R�((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyRw�s		
cCs�|js1|jjtd�j|j���nq|j|jjkrvtd�j|j��}t	|dt
��n,|j�r�|j�n|j
|jj�dS(s�Recovers a VDO target from a previous setting of write policy against
    a running VDO.

    Raises:
      VDOServiceError
    s9No set write policy recovery necessary for VDO volume {0}sGPrevious operation failure for VDO volume {0} not from set write policyRCN(R�RMRfRRGRLRR9R=RR	RSRRyR>(RR((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyRxs		
cCs�|jjtd�j|j���ytdd|j�g�Wn>tk
r�}|jjtd�j|j�|���nX|j�|jjtd�j|j���dS(sResumes a suspended VDO.sResuming VDO volume {0}RXtresumes"Can't resume VDO volume {0}; {1!s}sResumed VDO volume {0}N(	RMR�RRGRLRR�R�R�(RR�((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR�,s%
cCsDt|�}|dkr't|�}ntt|�jd|�dS(Ng�?Rl(tfloatRLRR"R<(RR
tmemory((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR79scCsB||_|r>|jj|j�|dt�|jj�ndS(Ntreplace(RRPRQRLROR|(RtstateR|((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyRyBs	cCs|jt�dS(s9Starts compression on a VDO volume if it is running.
    N(t_toggleCompressionRO(R((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR�IscCsZytdd|j�g�Wn6tk
rU|jjtd�j|j���nXdS(Ntvdodmeventds-rs$Could not register {0} with dmeventd(RRLR�RMR�RRG(R((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR�Os
cCs|jt�dS(s8Stops compression on a VDO volume if it is running.
    N(R�R�(R((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR�XscCsWdd|j�g}|dk	r:|jdj|��n|rSt|dt�ndS(NR�s-uR�R�(RLRFR�R^RRO(RR�R�R�((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR�^s
cCs�|jjtd�j|j���|jtd�ytdd|j�g�Wn>t	k
r�}|jj
td�j|j�|���nX|jjtd�j|j���dS(sSuspends a running VDO.sSuspending VDO volume {0}RXtsuspends#Can't suspend VDO volume {0}; {1!s}sSuspended VDO volume {0}N(RMR�RRGRLR�RORFRR�R�(RR�((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR�fs%cCsv|j�sdS|jjtd�j|r1dnd|j���tdd|j�dd|rhd	nd
g�dS(s�Turns compression on or off if the VDO is running.

    Arguments:
      enable (boolean): True if compression should be enabled
    Ns{0} compression on VDO {1}tStartingtStoppingRXRYRZR�tontoff(RSRMRNRRGRLR(RR�((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR�sscCstdjtjt|����}d	}yutdddg�}xY|j�D]K}tj	d|�}|d	k	rO|j
d�}tdj|��}qOqOWWntk
r�nX|d	kr�|jj
d�d	S|j�|j�krttd
jd|����nd	S(s=Validates whether there is likely enough kernel memory to at least
    create the index. If there is an error getting the info, don't
    fail the create, just let the real check be done in vdoformat.

    Arguments:
      indexMemory - the amount of memory requested or default.

    Raises:
      ArgumentError
    s{0}gtgreptMemAvailables
/proc/meminfosMemAvailable:\s*(\d+)is{0}ks#Unable to validate available memoryNsGNot enough available memory in system for index requirement of {needed}tneeded(RRGtlocaleR�R�RFRRURtRuRVR�RMR�RRR(RRltmemoryNeededtmemoryAvailableR�RYR�t	available((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyRk�s"$ 
cCs�|dkr|j}n|dkr0|j}n|dkrH|j}n|dksl|dksl|dkr�|dko�|dko�|dkr�ttd���ndS(sYValidates that the hash zone, logical and physical thread counts
    are consistent (all zero or all non-zero).

    Arguments:
      hashZone  - hash zone thread count to use, may be None
      logical   - logical thread count to use, may be None
      physical  - physical thread count to use, may be None

    Raises:
      ArgumentError
    isRhash zone, logical and physical threads must either all be zero or all be non-zeroN(RFR3R5R7RR(RthashZonetlogicaltphysical((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyRm�s$%N(rRRRRt	getLoggertmynameRMtyaml_tagtvdosKeyRR�R�R�R�R�R�R�R�R�R�R�R�R�tvdoMdRaid5ModeKeyR�R�R�tvdoWritePolicyKeyRDR
tobjectR9RBRIRRRORWR[RR�R�R�R�RTRUR�R�R�RFR�RSR�R�R�R�RR	RRtstaticmethodRRtpropertyRRRR&RR<RR�R�R�R"R#R$R%R'R(ROR�R�RnR�R�RQR�R�R�RJR�R�R�R�RrR�R�RwRjRRvRwRxR�R7RyR�R�R�R�R�R�RkRm(((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyR"gs�(	
		
a					:3	8	
;	2_		
	-	$		7		J					 								1						0					
				
	 	 		
								
		"(%RR�RRRRRRRRRR	R
RRtutilsR
RRRRR}R�RMR\RttsocketRR�R�R�RRRR R!R"(((s;/usr/lib/python2.7/site-packages/vdo/vdomgmnt/VDOService.pyt<module>s4