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__/VDOArgumentParser.cpython-36.opt-1.pyc

3

x?ag��@stdZddlmZddlmZddlmZddlZddlZddlmZddl	m
Z
m	Z	ejd	�Gd
d�dej�Z
dS)z�
  VDOArgumentParser - argument parser for vdo command input

  $Id: //eng/vdo-releases/aluminum/src/python/vdo/vdomgmnt/VDOArgumentParser.py#19 $
�)�absolute_import)�division)�print_functionN�)�	Constants)�
ArgumentError�DefaultsZvdocseZdZdZed�jdjdd�ejdd_�D��ej	ejd`d�Z
ed	�jdjd
d�ejdda�D��ejejdbd�Z
Gdd�dej�ZGd
d�dej�Zdc�fdd�	Z�fdd�Zdd�Zdd�Zdddd�Zdedd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zdfd*d+�Z d,d-�Z!d.d/�Z"d0d1�Z#dgd2d3�Z$d4d5�Z%dhd7d8�Z&d9d:�Z'd;d<�Z(did=d>�Z)djd?d@�Z*dkdAdB�Z+dldCdD�Z,dmdEdF�Z-dndGdH�Z.dodIdJ�Z/dpdKdL�Z0dMdN�Z1dqdOdP�Z2dQdR�Z3dSdT�Z4drdUdV�Z5e6dWdX��Z7dYdZ�Z8dsd[d\�Z9d]d^�Z:�Z;S)t�VDOArgumentParserz�Argument parser for the vdo command.

  Attributes:
  lvmOptionalSuffix (str): describes usage of lvm suffixes
  lvmOptionalSiSuffix (str): describes usage of lvm SI suffixes
  z;Using a value with a {options} or {last} suffix
is optionalz, cCsg|]}tj|�qS�)r�lvmSuffixTextMap)�.0�suffixr
r
�'/usr/lib/python3.6/VDOArgumentParser.py�
<listcomp>:szVDOArgumentParser.<listcomp>Nr)�optionsZlastz;Using a value with a {options} or {last}
suffix is optionalcCsg|]}tj|�qSr
)r�lvmSiSuffixTextMap)rr
r
r
rrBscs.eZdZdZ�fdd�Zd�fdd�	Z�ZS)z'VDOArgumentParser.CommandArgumentParserz�Argument parser type to use for commands.

    Provides command-identifying "unrecognized arguments" error rather
    than having the unrecognized arguments bubble up to the root parser and
    result in a non-specific "unrecognized arguments" error.
    csttj|�j||�d|_dS)NF)�superr	�CommandArgumentParser�__init__�_redirected)�self�args�kwargs)�	__class__r
rrRsz0VDOArgumentParser.CommandArgumentParser.__init__NcsDd}|js,d|_|j||�}d|_|gf}nttj|�j||�}|S)z�Redirects the command's argument parsing through parse_arg()
      which will, if there are unknown arguments, result in a cmmand-specific
      "unrecognized arguments" message.
      NTF)r�
parse_argsrr	r�parse_known_args)rr�	namespace�result)rr
rrXs
z8VDOArgumentParser.CommandArgumentParser.parse_known_args)NN)�__name__�
__module__�__qualname__�__doc__rr�
__classcell__r
r
)rrrJsrc@seZdZdZddd�ZdS)z&VDOArgumentParser.ExclusiveStoreActionz�Action type to use for commands.

    Provides a class to store a string into a namespace as specified,
    returning an error if it's already set. 
    NcCs>t||j|j�|jk	r,|jtd�j|j��t||j|�dS)Nz)option '{0}' was specified more than once)�getattr�dest�default�error�_�format�setattr)r�parserr�valuesZ
option_stringr
r
r�__call__qs
z/VDOArgumentParser.ExclusiveStoreAction.__call__)N)rrr r!r,r
r
r
r�ExclusiveStoreActionjsr-cs tt|�j||�}|j|�|S)N)rr	r�#_VDOArgumentParser__postParseChecks)rrr)rr
rr~s
zVDOArgumentParser.parse_argscs"|jd�dkrtd�|d<tt|�j||�|jddddtjd�}|j�|_|j	�|_
td�}td�j|�}|jd|j
|jg||d	�|_
td
�}td�j|�}|jd|j
|jdd
�|jg||d	�|_td�}td�j|�}|jd|j�|jdd
�|jg||d	�|_td�}td�j|tj�}|jd|j�|j�|j�|j�|j�|j�|j�|j�|j�|j�|j�|j�|j�|j �|j!�|j"�|j#�|j$�|j%�|j&�|j'�|j(�|j)�|j�|jg||d	�|_*td�}td�j|�}|jd|j
|jg||d	�|_+td�}td�j|�}|jd|j
|jg||d	�|_,td�}td�j|�}|jd|j
|jg||d	�|_-td�}td�j|�}|jd|j
|jg||d	�|_.td �}td!�j|�}|jd"|j
|jg||d	�|_/td#�}td�j|�}|jd$|j�|j%dd
�|jg||d	�|_0td%�}td�j|�}|jd&|j�|jg||d	�|_1td'�}td(�j|tj�}|jd)|j�|j�|j�|j�|j�|j�|j�|j�|j�|j�|j �|j!�|j"�|j#�|j$�|j&�|j'�|j(�|j�|jg||d	�|_2td*�}td�j|�}|jd+|j3�|jg||d	�|_4td,�}td�j|�}d-d.d/d0d1d2d3d4d5d6d7g|_5|jd8|j
|jdd9�|jdd9�|jdd9�|jdd9�|j dd9�|j!dd9�|j"dd9�|j#dd9�|j$dd9�|j&dd9�|j(dd9�|jg
||d	�|_6td:�}td;�j|�}|jd<|jg||d	�|_7td=�}td>�}td�j|�}|jd?|j
|j�|jg||d	�|_8td@�}td�j|�}|jdA|j
|j9�|jg||d	�|_:tdB�}td;�j|�}|jdC|j	dDd
�|j;�|jg||d	�|_<td=�}tdE�}td�j|�}|jdF|j
|j�|jg||d	�|_=td=�}tdG�}tdH�j|�}|jdI|jg||d	�|_>dS)JN�descriptiona
        Manage kernel VDO devices and related configuration information. For
        help on individual commands specify the command followed by --help.
        Unless otherwise noted all commands must be run with root privileges.
                                zmanagement commands�command)�title�helpr$�metavarZparser_classz�
      Activates one or more VDO volumes. Activated volumes can be started
      using the 'start' command.
                      zN
      {0} This command must be run with root privileges.
                    �activate)�parentsr2r/zZ
      Modifies the write policy of one or all running VDO volumes.
                      ZchangeWritePolicyT)�requiredz�
      Converts a VDO volume so it can be managed by LVM. Converted volumes
      cannot be reverted back.
                      z�
      {0} This command is intended to be used by LVM. Do not call this
      directly unless you are sure what you are doing. This command must 
      be run with root privileges.
                    Zconvertzc
      Creates a VDO volume and its associated index and makes it available.
                      a�
      {0} If --activate={1} is specified the VDO volume is created but not made
      available. If the specified device is already in use by a VDO volume (as
      determined from the configuration file) the create will always be 
      rejected, even if --force is specified. If the device is not so in use
      but is formatted as a VDO volume or contains an existing file system
      the create will be rejected unless --force is given.
                    Zcreatez�
      Deactivates one or more VDO volumes. Deactivated volumes cannot be
      started by the 'start' command. Deactivating a currently running
      volume does not stop it.
                      z�
      {0} Once stopped a deactivated VDO volume must be activated before
      it can be started again. This command must be run with root
      privileges.
                    Z
deactivatez�
      Disables compression on one or more VDO volumes. If the VDO volume is
      running, takes effect immediately.
                      z�
      {0} If the VDO volume is not running compression will be disabled the
      next time the VDO volume is started. This command must be run with root
      privileges.
                    ZdisableCompressionz�
      Disables deduplication on one more VDO volumes. If the VDO volume is
      running, takes effect immediately.
                      z�
      {0} If the VDO volume is not running deduplication will be disabled the
      next time the VDO volume is started. This command must be run with root
      privileges.
                    ZdisableDeduplicationz�
      Enables compression on one or more VDO volumes. If the VDO volume is
      running, takes effect immediately.
                      z�
      {0} If the VDO volume is not running compression will be enabled the
      next time the VDO volume is started. This command must be run with root
      privileges.
                    ZenableCompressionz�
      Enables deduplication on one or more VDO volumes. If the VDO volume
      is running, takes effect immediately.
                      z�
      {0} If the VDO volume is not running deduplication will be enabled the
      next time the VDO volume is started. This command must be run with root
      privileges.
                    ZenableDeduplicationzv
      Grows the logical size of a VDO volume. The volume must exist and
      must be running.
                      ZgrowLogicalzw
      Grows the physical size of a VDO volume. The volume must exist and
      must be running.
                      ZgrowPhysicalz�
      Creates a VDO volume from an existing VDO formatted storage device by
      importing it into VDO manager for use.
                      a�
      {0} NOTE: The following values are not stored on the device and
      must be reset via command line parameters if you changed them 
      from the default value during create: block map cache size, 
      block map period, compression state, deduplication state, 
      512 emulation, maximum discard size, and thread configurations. 
      If --activate={1} is specified the VDO volume is created but not 
      made available. This command must be run with root privileges.
                    �importz�
      Displays a list of started VDO volumes. If --all is specified it
      displays both started and non-started volumes.
                      �listz�
      Modifies configuration parameters of one or all VDO volumes. Changes
      take effect the next time the VDO device is started; already-running
      devices are not affected.
                      �blockMapCacheSize�blockMapPeriod�maxDiscardSizeZuuidZ
vdoAckThreadsZvdoBioRotationIntervalZ
vdoBioThreadsZ
vdoCpuThreadsZvdoHashZoneThreadsZvdoLogicalThreadsZvdoPhysicalThreads�modify)�	noDefaultz{
      Prints the configuration file to stdout. This command does not require
      root privileges.
                      z
      {0}
                    ZprintConfigFilez
                    z]
      Removes one or more stopped VDO volumes and associated indexes.
                      �removezn
      Starts one or more stopped, activated VDO volumes and associated
      services.
                      �startz�
      Reports VDO system and volume status in YAML format. This command does
      not require root privileges though information will be incomplete if
      run without.
                      ZstatusFz\
      Stops one or more running VDO volumes and associated services.
                      �stopzG
      Shows the current version of VDO manager.
                      zK
      {0} This command does not need root privileges.
                    �version)?�getr'rr	rZadd_subparsersr�_commonOptionsParserZ!_VDOArgumentParser__commonOptions�_namingOptionsParserZ!_VDOArgumentParser__namingOptionsr(Z
add_parserZ_activateCommandParser�_writePolicyOptionParserZ_changeWritePolicyCommandParser�_nameOptionParser�_forceOptionParserZ_convertCommandParserrZdisabled�_deviceOptionParser�_activateOptionParser�_blockMapCacheSizeOptionParser�_blockMapPeriodOptionParser�_compressionOptionParser�_deduplicationOptionParser�_emulate512OptionParser�_indexMemOptionParser�_maxDiscardSizeOptionParser�_sparseIndexOptionParser�_uuidOptionParser�_vdoAckThreadsOptionParser�#_vdoBioRotationIntervalOptionParser�_vdoBioThreadsOptionParser�_vdoCpuThreadsOptionParser�_vdoHashZoneThreadsOptionParser�_vdoLogicalSizeOptionParser�_vdoLogicalThreadsOptionParser�_vdoLogLevelOptionParser�_vdoPhysicalThreadsOptionParser�_vdoSlabSizeOptionParserZ_createCommandParserZ_deactivateCommandParserZ _disableCompressionCommandParserZ"_disableDeduplicationCommandParserZ_enableCompressionCommandParserZ!_enableDeduplicationCommandParserZ_growLogicalCommandParserZ_growPhysicalCommandParserZ_importCommandParser�_allOptionParserZ_listCommandParser�_changeableModifyOptions�_modifyCommandParserZ_printConfigFileCommandParserZ_removeCommandParser�_forceRebuildOptionParserZ_startCommandParser�_pendingOptionParserZ_statusCommandParserZ_stopCommandParserZ_versionCommandParser)rrrZsubparserAdderZ
highLevelHelpr/ZcommandText)rr
rr�s,











































zVDOArgumentParser.__init__cCs4tjdd�}|jdtjtjtd�jt	j
d�d�|S)NF)�add_helpz
--activatez�
      Indicates if the VDO volume should, in addition to being created, be
      activated and started. The default is {activate}.
                                 )r4)�action�choicesr2)�argparse�ArgumentParser�add_argumentr	r-r�
enableChoicesr'r(rr4)rr*r
r
rrIsz'VDOArgumentParser._activateOptionParsercCstjdd�}|j|�|S)NF)rb)rerf�&_VDOArgumentParser__parserAddAllOption)rr*r
r
rr]-s
z"VDOArgumentParser._allOptionParserFc
Csf|rdntd�jtj�}tjdd�}|jdtj|j	tj
�dtd�jtj|jt
jtjtj|d�d	�|S)
zb
    Arguments:
      noDefault (boolean) - if True, no default is mentioned in the help text
    �zThe default is {0}.F)rbz--blockMapCacheSizez<megabytes>a�
      Specifies the amount of memory allocated for caching block map pages;
      the value must be a multiple of {pageSize}. {suffixOptions}. If no
      suffix is supplied, the value will be interpreted as {defaultUnits}.
      The value must be at least {minCacheSize} and less than
      {maxCachePlusOne}. Note that there is a memory overhead of 15%%.
      {defaultHelp}
                                 )ZpageSize�
suffixOptions�defaultUnitsZminCacheSizeZmaxCachePlusOne�defaultHelp)rc�typer3r2)r'r(rr9rerfrgr	r-�_VDOArgumentParser__optionCheckZcheckPageCachesz�vdoPhysicalBlockSize�lvmOptionalSiSuffixr�lvmDefaultUnitsTextZblockMapCacheSizeMinZblockMapCacheSizeMaxPlusOne)rr=rmr*r
r
rrJ3s 
z0VDOArgumentParser._blockMapCacheSizeOptionParserc
CsZ|rdntd�jtj�}tjdd�}|jdtj|j	tj
�dtd�jtjtj|d�d	�|S)
zb
    Arguments:
      noDefault (boolean) - if True, no default is mentioned in the help text
    rjzThe default value is {0}.F)rbz--blockMapPeriodz<period>a8
      Tunes the quantity of block map updates that can accumulate before
      cache pages are flushed to disk. The value must at least {minPeriod}
      and less than or equal to {maxPeriod}. A lower value means shorter
      recovery time but lower performance. {defaultHelp}
                                 )Z	minPeriodZ	maxPeriodrm)rcrnr3r2)
r'r(rr:rerfrgr	r-roZcheckBlockMapPeriodZblockMapPeriodMinZblockMapPeriodMax)rr=rmr*r
r
rrKSsz-VDOArgumentParser._blockMapPeriodOptionParsercCs&tjd|j�|j�|j�|j�gd�S)NF)rbr5)rerf�_confFileOptionParser�_debugOptionParser�_logFileOptionParser�_verboseOptionParser)rr
r
rrCos
z&VDOArgumentParser._commonOptionsParsercCs8tjdd�}|jdtjtjtjt	d�j
tjd�d�|S)NF)rbz
--compressiona
      Enables or disables compression when creating a VDO volume. The default
      is {compression}. Compression may be disabled if necessary to maximize
      performance or to speed processing of data that is unlikely to compress.
                                 )�compression)rcrdr%r2)rerfrgr	r-rrhrrwr'r()rr*r
r
rrLwsz*VDOArgumentParser._compressionOptionParserc
CsBtjdd�}|jddtj|jtj�tjdt	d�j
tjd�d�|S)	NF)rbz-fz
--confFilez<file>zj
      Specifies an alternate configuration file; the default is {file}.
                                 )�file)rcrnr%r3r2)rerfrgr	r-rorZ
checkConfFileZconfFiler'r()rr*r
r
rrs�s
z'VDOArgumentParser._confFileOptionParsercCs&tjdd�}|jddddtjd�|S)NF)rbz-dz--debug�
store_true�debug)rcr$r2)rerfrgZSUPPRESS)rr*r
r
rrt�s
z$VDOArgumentParser._debugOptionParsercCs8tjdd�}|jdtjtjtjt	d�j
tjd�d�|S)NF)rbz--deduplicationa!
      Enables or disables deduplication when creating a VDO volume. The
      default is {deduplication}. Deduplication may be disabled in instances
      where data is not expected to have good deduplication rates but
      compression is still desired.
                                 )�
deduplication)rcrdr%r2)rerfrgr	r-rrhrr{r'r()rr*r
r
rrM�sz,VDOArgumentParser._deduplicationOptionParsercCs4tjdd�}|jdtj|jtj�ddtd�d�|S)NF)rbz--devicez<devicepath>Tzj
      Specifies the absolute path of the device to use for VDO storage.
                                 )rcrnr3r6r2)	rerfrgr	r-rorZcheckBlkDevr')rr*r
r
rrH�s

z%VDOArgumentParser._deviceOptionParsercCs4tjdd�}|jdtjtjtd�jt	j
d�d�|S)NF)rbz--emulate512z�
      Specifies that the VDO volume is to emulate a 512 byte block device. The
      default is {emulate512}.
                                 )�
emulate512)rcrdr2)rerfrgr	r-rrhr'r(rr|)rr*r
r
rrN�sz)VDOArgumentParser._emulate512OptionParsercCs(tjdd�}|jddd|td�d�|S)NF)rbz--forcery�forcea[
      When creating a volume, ignores any existing file system or VDO signature
      already present in the storage device. When stopping or removing a VDO
      volume, first unmounts the file system stored on the device if mounted.
      When converting a volume to be used by LVM, this parameter is required.
                                 )rcr$r6r2)rerfrgr')rr6r*r
r
rrG�s
z$VDOArgumentParser._forceOptionParsercCs&tjdd�}|jdddtd�d�|S)NF)rbz--forceRebuildryZforceRebuildz�
      Forces an offline rebuild of a read-only VDO's metadata before starting
      so that it may be brought back online and made available. This option
      may result in data loss or corruption.
                                 )rcr$r2)rerfrgr')rr*r
r
rr`�s
z+VDOArgumentParser._forceRebuildOptionParsercCsHtjdd�}|jdtj|jtj�tjdt	d�j
tjtjtjd�d�|S)NF)rbz
--indexMemz<gigabytes>az
      Specifies the amount of index memory in gigabytes; the default is
      currently {indexMem} GB. The special decimal values 0.25, 0.5,
      0.75 can be used, as can any integer value at least {min} and less
      than or equal to {max}. (The special decimal values are matched as
      exact strings; "0.5" works but "0.50" is not accepted.)

      Larger values will require more disk space. For a dense index,
      each gigabyte of index memory will use approximately 11 GB of
      storage. For a sparse index, each gigabyte of index memory will
      use approximately 100 GB of storage.
                                 )�indexMem�min�max)rcrnr%r3r2)
rerfrgr	r-rorZ
checkIndexmemr~r'r(ZindexMemIntMinZindexMemIntMax)rr*r
r
rrO�s
z'VDOArgumentParser._indexMemOptionParsercCs2tjdd�}|jdtj|jtj�dtd�d�|S)NF)rbz	--logfilez
<pathname>z�
      Specify the path of the file to which log messages are directed. If
      unspecified, log messages will go to syslog. Warning and error messages
      are always logged to syslog.
                                 )rcrnr3r2)	rerfrgr	r-rorZcheckLogFiler')rr*r
r
rrus

z&VDOArgumentParser._logFileOptionParserc
Csf|rdntd�jtj�}tjdd�}|jdtj|j	tj
�dtd�jtj|jt
jtjtj|d�d	�|S)
z�
    Arguments:
      noDefault (boolean) - if True, no default is provided nor mentioned in
                            the help text
    rjzThe default is {0}.F)rbz--maxDiscardSizez<megabytes>a�
      Specifies the maximum discard size VDO can receive. This is used for
      performance tuning and support of devices above us. The value must be
      a multiple of {blockSize}. {suffixOptions}. If no suffix is supplied,
      the value will be interpreted as {defaultUnits}. The value must be at
      least {minDiscard} and less than {maxDiscardPlusOne}.
      {defaultHelp}
                                 )Z	blockSizerkrlZ
minDiscardZmaxDiscardPlusOnerm)rcrnr3r2)r'r(rr;rerfrgr	r-roZcheckMaxDiscardSizerprqrrrZmaxDiscardSizeMinZmaxDiscardSizeMaxPlusOne)rr=rmr*r
r
rrPs 
z-VDOArgumentParser._maxDiscardSizeOptionParsercCstjdd�}|j|dd�|S)NF)rbT)r6)rerf�'_VDOArgumentParser__parserAddNameOption)rr*r
r
rrF5sz#VDOArgumentParser._nameOptionParserTcCs,tjdd�j|d�}|j|�|j|�|S)z_
    Arguments:
      required (boolean) - if True, an argument is required to this parser
    F)rb)r6)rerfZadd_mutually_exclusive_grouprir�)rr6r*r
r
rrD<s

z&VDOArgumentParser._namingOptionsParsercCs&tjdd�}|jdddtd�d�|S)NF)rbz	--pendingry�pendingz�
      Shows pending modifications that will take effect upon restart 
      in the status report of a running VDO volume. Pending modifications are 
      denoted with square brackets.
                                 )rcr$r2)rerfrgr')rr*r
r
rraJs
z&VDOArgumentParser._pendingOptionParsercCs4tjdd�}|jdtjtjtd�jt	j
d�d�|S)NF)rbz
--sparseIndexz_
      Enables sparse indexing. The default is {sparseIndex}.
                                 )�sparseIndex)rcrdr2)rerfrgr	r-rrhr'r(rr�)rr*r
r
rrQXsz*VDOArgumentParser._sparseIndexOptionParsercCsJ|rdntd�}tjdd�}|jdtj|jtj�dtd�j	|d�d	�|S)
zb
    Arguments:
      noDefault (boolean) - if True, no default is mentioned in the help text
    rjz�For newly created volumes, the default is an empty 
                   string (generate a new uuid).  For importing existing 
                   volumes, the default is the existing VDO volume's uuid.F)rbz--uuidz<uuid>z�
      Sets the UUID of the VDO volume. The value needs to be either a
      valid uuid or an empty string. If an empty string is specified, a
      new random uuid is generated for the VDO volume.
      {defaultHelp}
                                 )rm)rcrnr3r2)
r'rerfrgr	r-rorZcheckUUIDValuer()rr=rmr*r
r
rrRes
z#VDOArgumentParser._uuidOptionParserc
CsV|rdn
djtj�}tjdd�}|jdtj|jtj	�dt
d�jtjtj|d�d	�|S)
zb
    Arguments:
      noDefault (boolean) - if True, no default is mentioned in the help text
    rjzThe default is {0}.F)rbz--vdoAckThreadsz
<threadCount>z�
      Specifies the number of threads to use for acknowledging completion of
      requested VDO I/O operations. The value must be at least {min} and less
      than or equal to {max}. {defaultHelp}
                                 )rr�rm)rcrnr3r2)
r(rZ
ackThreadsrerfrgr	r-ro�checkThreadCount0_100r'Z
ackThreadsMinZ
ackThreadsMax)rr=rmr*r
r
rrSsz,VDOArgumentParser._vdoAckThreadsOptionParserc
CsV|rdn
djtj�}tjdd�}|jdtj|jtj	�dt
d�jtjtj|d�d	�|S)
zb
    Arguments:
      noDefault (boolean) - if True, no default is mentioned in the help text
    rjzThe default is {0}.F)rbz--vdoBioRotationIntervalz	<ioCount>z�
      Specifies the number of I/O operations to enqueue for each
      bio-submission thread before directing work to the next. The value must
      be at least {min} and less than or equal to {max}. {defaultHelp}
                                 )rr�rm)rcrnr3r2)
r(rZbioRotationIntervalrerfrgr	r-roZcheckRotationIntervalr'ZbioRotationIntervalMinZbioRotationIntervalMax)rr=rmr*r
r
rrT�sz5VDOArgumentParser._vdoBioRotationIntervalOptionParsercCs^|rdntd�jtj�}tjdd�}|jdtj|j	tj
�dtd�jtjtjtj
|d�d	�|S)
zb
    Arguments:
      noDefault (boolean) - if True, no default is mentioned in the help text
    rjzThe default is {0}.F)rbz--vdoBioThreadsz
<threadCount>a?
      Specifies the number of threads to use for submitting I/O operations to
      the storage device. The value must be at least {min} and less than or
      equal to {max}. Each additional thread after the first will use an
      additional {threadOverhead} MB of RAM {defaultHelp}
                                 )rr�ZthreadOverheadrm)rcrnr3r2)r'r(rZ
bioThreadsrerfrgr	r-ro�checkThreadCount1_100Z
bioThreadsMinZ
bioThreadsMaxZbioThreadOverheadMB)rr=rmr*r
r
rrU�sz,VDOArgumentParser._vdoBioThreadsOptionParserc
CsZ|rdntd�jtj�}tjdd�}|jdtj|j	tj
�dtd�jtjtj|d�d	�|S)
zb
    Arguments:
      noDefault (boolean) - if True, no default is mentioned in the help text
    rjzThe default is {0}.F)rbz--vdoCpuThreadsz
<threadCount>z�
      Specifies the number of threads to use for CPU-intensive work such as
      hashing or compression. The value must be at least {min} and less than
      or equal to {max}. {defaultHelp}
                                 )rr�rm)rcrnr3r2)
r'r(rZ
cpuThreadsrerfrgr	r-ror�Z
cpuThreadsMinZ
cpuThreadsMax)rr=rmr*r
r
rrV�sz,VDOArgumentParser._vdoCpuThreadsOptionParserc
CsV|rdn
djtj�}tjdd�}|jdtj|jtj	�dt
d�jtjtj|d�d	�|S)
zb
    Arguments:
      noDefault (boolean) - if True, no default is mentioned in the help text
    rjzThe default is {0}.F)rbz--vdoHashZoneThreadsz
<threadCount>a�
      Specifies the number of threads across which to subdivide parts of the
      VDO processing based on the hash value computed from the block data.
      The value must be at least {min} and less than or equal to {max}.
      vdoHashZonesThreads, vdoLogicalThreads and vdoPhysicalThreads must be
      either all zero or all non-zero. {defaultHelp}
                                 )rr�rm)rcrnr3r2)
r(r�hashZoneThreadsrerfrgr	r-ror�r'ZhashZoneThreadsMinZhashZoneThreadsMax)rr=rmr*r
r
rrW�sz1VDOArgumentParser._vdoHashZoneThreadsOptionParsercCsZ|rdn
djtj�}tjdd�}|jdtj|jtj	�dt
d�jtjtjtj
|d�d	�|S)
zb
    Arguments:
      noDefault (boolean) - if True, no default is mentioned in the help text
    rjzThe default is {0}.F)rbz--vdoLogicalThreadsz
<threadCount>a�
      Specifies the number of threads across which to subdivide parts of the
      VDO processing based on the logical address. The value must be at least
      {min} and less than or equal to {max}. A logical thread count of
      {threshold} or more will require explicitly specifying a sufficiently
      large block map cache size.
      vdoHashZonesThreads, vdoLogicalThreads and vdoPhysicalThreads must be
      either all zero or all non-zero. {defaultHelp}
                                 )rr�Z	thresholdrm)rcrnr3r2)r(rr�rerfrgr	r-roZcheckLogicalThreadCountr'ZlogicalThreadsMinZlogicalThreadsMaxZ(logicalThreadsBlockMapCacheSizeThreshold)rr=rmr*r
r
rrYsz0VDOArgumentParser._vdoLogicalThreadsOptionParserc
Csb|rdntd�}tjdd�}|jdtj|jtj�|r8dnd|dtd	�j	t
j|jtj
|d
�d�|S)z�
    Arguments:
      required (boolean) - if True, no default is provided nor mentioned in
                            the help text
    rjz.The default is the size of the storage device.F)rbz--vdoLogicalSizeN�0z<megabytes>z�
      Specifies the logical VDO volume size in {defaultUnits}.
      {suffixOptions}. Used for over-provisioning volumes. The maximum size
      supported is {max}. {defaultHelp}
                                 )rlrkr�rm)rcrnr%r6r3r2)r'rerfrgr	r-rorZcheckLogicalSizer(rrr�lvmOptionalSuffixZlogicalSizeMax)rr6rmr*r
r
rrX$s 

z-VDOArgumentParser._vdoLogicalSizeOptionParsercCs8tjdd�}|jdtjtjtjtd�j	tjd�d�|S)NF)rbz
--vdoLogLevelz�
      Specifies the VDO driver log level. Levels are case-sensitive. The
      default is {logLevel}.
                                 )ZlogLevel)rcrdr%r2)
rerfrgr	r-rZvdoLogLevelChoicesZvdoLogLevelr'r()rr*r
r
rrZAsz*VDOArgumentParser._vdoLogLevelOptionParsercCs^|rdntd�jtj�}tjdd�}|jdtj|j	tj
�dtd�jtjtjtj
|d�d	�|S)
zb
    Arguments:
      noDefault (boolean) - if True, no default is mentioned in the help text
    rjzThe default is {0}.F)rbz--vdoPhysicalThreadsz
<threadCount>a]
      Specifies the number of threads across which to subdivide parts
      of the VDO processing based on physical block addresses. The
      value must be at least {min} and less than or equal to {max}.
      The value must also be less than or equal to the slab count
      (which can be found via the 'status' command after device
      creation). Each additional thread after the first will use an
      additional {overhead} MB of RAM. vdoPhysicalThreads,
      vdoHashZonesThreads and vdoLogicalThreads must be either all
      zero or all non-zero. {defaultHelp}
                                 )rr�Zoverheadrm)rcrnr3r2)r'r(rZphysicalThreadsrerfrgr	r-roZcheckPhysicalThreadCountZphysicalThreadsMinZphysicalThreadsMaxZphysicalThreadOverheadMB)rr=rmr*r
r
rr[Ps
z1VDOArgumentParser._vdoPhysicalThreadsOptionParserc
CsPtjdd�}|jdtj|jtj�tjdt	d�j
tjtjtj|j
tjd�d�|S)NF)rbz
--vdoSlabSizez<megabytes>a
      Set the free space allocator's slab size. Must be a power of two between
      {minSize} and {maxSize}; the default is {defaultSlabSize}.
      {suffixOptions}. If no suffix is used, the value will be interpreted as
      {defaultUnits}. This allocator manages the space VDO uses to store user
      data.
      
      The maximum number of slabs in the system is 8192, so this value
      determines the maximum physical size of a VDO volume. One slab is the
      minimum amount by which a VDO volume can be grown. Smaller slabs also
      increase the potential for parallelism if the device has multiple
      physical threads. Therefore, this value should be set as small as
      possible, given the eventual maximal size of the volume.
                                 )ZminSizeZmaxSizeZdefaultSlabSizerkrl)rcrnr%r3r2)rerfrgr	r-rorZ
checkSlabSizeZslabSizer'r(ZslabSizeMinZslabSizeMaxr�rrr)rr*r
r
rr\qs

z*VDOArgumentParser._vdoSlabSizeOptionParsercCs&tjdd�}|jdddtd�d�|S)NF)rbz	--verbosery�verbosezO
      Prints commands before executing them.
                                 )rcr$r2)rerfrgr')rr*r
r
rrv�s
z&VDOArgumentParser._verboseOptionParserc	CsX|rdntd�jtj�}tjdd�}|jdtjtj	|r:dntj|td�j|d�d	�|S)
z�
    Arguments:
      required (boolean)  - If True, no default is provided or mentioned
                            in the help text.
    rjzThe default is {0}.F)rbz
--writePolicyNa�
      Specifies the write policy. If 'sync', writes are acknowledged only
      after the data is guaranteed to persist. If 'async', writes are
      acknowledged when the data has been cached for writing to the
      underlying storage. Data which has not been flushed is not guaranteed
      to persist in this mode, however this mode is ACID compliant (after
      recovery from a crash any unflushed write is guaranteed either to have
      persisted all its data, or to have done nothing). Most databases and
      filesystems should use this mode. If 'async-unsafe', writes are handled
      like 'async' but there is no guarantee of the above atomicity. This
      mode should only be used for better performance when atomicity is
      not required. If 'auto', VDO will check the underlying storage and
      determine whether it supports flushes. If it does, VDO will run in async
      mode, otherwise it will run in sync mode. {defaultHelp}
                                 )rm)rcrdr%r6r2)
r'r(rZwritePolicyrerfrgr	r-ZwritePolicyChoices)rr6rmr*r
r
rrE�sz*VDOArgumentParser._writePolicyOptionParsercs�fdd�}|S)a�Returns a callable for option checking which traps and translates
    exceptions from the vdo management option checking to argparse's
    exception in order to provide consistent behavior for option errors
    including preventing stack traces.

    Arguments:
      checkFunc (callable)  - the vdo management option check method to use

    Returns:
      __checker (callable)  - the wrapper which translates vdo option check
                              exception to argparse's.
    csBy�|�}Wn0tk
r<}ztjt|���WYdd}~XnX|S)N)rreZArgumentTypeError�str)ZoptionValueZex)�	checkFuncr
rZ	__checker�s
 z2VDOArgumentParser.__optionCheck.<locals>.__checkerr
)�clsr�Z_VDOArgumentParser__checkerr
)r�rZ
__optionCheck�szVDOArgumentParser.__optionCheckcCs|jddddtd�d�dS)Nz-az--allry�allz�
      Indicates that the command should be applied to all configured VDO
      volumes. May not be used with --name.
                                 )rcr$r2)rgr')rr*r
r
rZ__parserAddAllOption�s
z&VDOArgumentParser.__parserAddAllOptionc	Cs*|jddtj|jtj�d|td�d�dS)Nz-nz--namez<volume>zh
    Operates on the specified VDO volume. May not be used with --all.
                                 )rcrnr3r6r2)rgr	r-rorZcheckVDONamer')rr*r6r
r
rZ__parserAddNameOption�s
z'VDOArgumentParser.__parserAddNameOptioncsR�jdkrN�fdd�|jD�}t|�dkrN|jjtd�jdjdj|j����dS)	a5Performs post-parsing checks between linked options.

    If there is a check failure invokes the appropriate parser error()
    method to display the error message and exit.

    Arguments:
      namespace (Namespace) - the Namespace instance populated by parsing
                              arguments
    r<cs g|]}t�|d�dk	r|�qS)N)r#)rZoption)rr
rr�sz7VDOArgumentParser.__postParseChecks.<locals>.<listcomp>rz#options must be specified from: {0}z--{0}z, --N)r0r^�lenr_r&r'r(�join)rrrr
)rrZ__postParseChecks�s
z#VDOArgumentParser.__postParseChecks���r�r�r�)NN)F)F)F)F)T)F)F)F)F)F)F)F)F)F)F)F)<rrr r!r'r(r�rZlvmSuffixesrr�Z
lvmSiSuffixesrrqrerfrZActionr-rrrIr]rJrKrCrLrsrtrMrHrNrGr`rOrurPrFrDrarQrRrSrTrUrVrWrYrXrZr[r\rvrE�classmethodrorir�r.r"r
r
)rrr	1sp
 
 



 









!
%

r	)r!Z
__future__rrrre�gettextrjrrrZinstallrfr	r
r
r
r�<module>s


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