Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/system/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/system/vdo.pyo

�
�Udac@`s-ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZmZddl
Z
ddlZeZyddlZeZWn#ek
r�ej�ZeZnXd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Ze dkr)e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�/
---
author:
    - Bryan Gurney (@bgurney-rh)

module: vdo

short_description: Module to control VDO

version_added: "2.5"

description:
    - This module controls the VDO dedupe and compression device.
    - VDO, or Virtual Data Optimizer, is a device-mapper target that
      provides inline block-level deduplication, compression, and
      thin provisioning capabilities to primary storage.

options:
    name:
        description:
            - The name of the VDO volume.
        type: str
        required: true
    state:
        description:
            - Whether this VDO volume should be "present" or "absent".
              If a "present" VDO volume does not exist, it will be
              created.  If a "present" VDO volume already exists, it
              will be modified, by updating the configuration, which
              will take effect when the VDO volume is restarted.
              Not all parameters of an existing VDO volume can be
              modified; the "statusparamkeys" list contains the
              parameters that can be modified after creation. If an
              "absent" VDO volume does not exist, it will not be
              removed.
        type: str
        required: true
        choices: [ absent, present ]
        default: present
    activated:
        description:
            - The "activate" status for a VDO volume.  If this is set
              to "no", the VDO volume cannot be started, and it will
              not start on system startup.  However, on initial
              creation, a VDO volume with "activated" set to "off"
              will be running, until stopped.  This is the default
              behavior of the "vdo create" command; it provides the
              user an opportunity to write a base amount of metadata
              (filesystem, LVM headers, etc.) to the VDO volume prior
              to stopping the volume, and leaving it deactivated
              until ready to use.
        type: bool
    running:
        description:
            - Whether this VDO volume is running.
            - A VDO volume must be activated in order to be started.
        type: bool
    device:
        description:
            - The full path of the device to use for VDO storage.
            - This is required if "state" is "present".
        type: str
    logicalsize:
        description:
            - The logical size of the VDO volume (in megabytes, or
              LVM suffix format).  If not specified for a new volume,
              this defaults to the same size as the underlying storage
              device, which is specified in the 'device' parameter.
              Existing volumes will maintain their size if the
              logicalsize parameter is not specified, or is smaller
              than or identical to the current size.  If the specified
              size is larger than the current size, a growlogical
              operation will be performed.
        type: str
    deduplication:
        description:
            - Configures whether deduplication is enabled.  The
              default for a created volume is 'enabled'.  Existing
              volumes will maintain their previously configured
              setting unless a different value is specified in the
              playbook.
        type: str
        choices: [ disabled, enabled ]
    compression:
        description:
            - Configures whether compression is enabled.  The default
              for a created volume is 'enabled'.  Existing volumes
              will maintain their previously configured setting unless
              a different value is specified in the playbook.
        type: str
        choices: [ disabled, enabled ]
    blockmapcachesize:
        description:
            - The amount of memory allocated for caching block map
              pages, in megabytes (or may be issued with an LVM-style
              suffix of K, M, G, or T).  The default (and minimum)
              value is 128M.  The value specifies the size of the
              cache; there is a 15% memory usage overhead. Each 1.25G
              of block map covers 1T of logical blocks, therefore a
              small amount of block map cache memory can cache a
              significantly large amount of block map data.  Existing
              volumes will maintain their previously configured
              setting unless a different value is specified in the
              playbook.
        type: str
    readcache:
        description:
            - Enables or disables the read cache.  The default is
              'disabled'.  Choosing 'enabled' enables a read cache
              which may improve performance for workloads of high
              deduplication, read workloads with a high level of
              compression, or on hard disk storage.  Existing
              volumes will maintain their previously configured
              setting unless a different value is specified in the
              playbook.
            - The read cache feature is available in VDO 6.1 and older.
        type: str
        choices: [ disabled, enabled ]
    readcachesize:
        description:
            - Specifies the extra VDO device read cache size in
              megabytes.  This is in addition to a system-defined
              minimum.  Using a value with a suffix of K, M, G, or T
              is optional.  The default value is 0.  1.125 MB of
              memory per bio thread will be used per 1 MB of read
              cache specified (for example, a VDO volume configured
              with 4 bio threads will have a read cache memory usage
              overhead of 4.5 MB per 1 MB of read cache specified).
              Existing volumes will maintain their previously
              configured setting unless a different value is specified
              in the playbook.
            - The read cache feature is available in VDO 6.1 and older.
        type: str
    emulate512:
        description:
            - Enables 512-byte emulation mode, allowing drivers or
              filesystems to access the VDO volume at 512-byte
              granularity, instead of the default 4096-byte granularity.
              Default is 'disabled'; only recommended when a driver
              or filesystem requires 512-byte sector level access to
              a device.  This option is only available when creating
              a new volume, and cannot be changed for an existing
              volume.
        type: bool
    growphysical:
        description:
            - Specifies whether to attempt to execute a growphysical
              operation, if there is enough unused space on the
              device.  A growphysical operation will be executed if
              there is at least 64 GB of free space, relative to the
              previous physical size of the affected VDO volume.
        type: bool
        default: false
    slabsize:
        description:
            - The size of the increment by which the physical size of
              a VDO volume is grown, in megabytes (or may be issued
              with an LVM-style suffix of K, M, G, or T).  Must be a
              power of two between 128M and 32G.  The default is 2G,
              which supports volumes having a physical size up to 16T.
              The maximum, 32G, supports a physical size of up to 256T.
              This option is only available when creating a new
              volume, and cannot be changed for an existing volume.
        type: str
    writepolicy:
        description:
            - Specifies the write policy of the VDO volume.  The
              'sync' mode acknowledges writes only after data is on
              stable storage.  The 'async' mode acknowledges writes
              when data has been cached for writing to stable
              storage.  The default (and highly recommended) 'auto'
              mode checks the storage device to determine whether it
              supports flushes.  Devices that support flushes will
              result in a VDO volume in 'async' mode, while devices
              that do not support flushes will run in sync mode.
              Existing volumes will maintain their previously
              configured setting unless a different value is
              specified in the playbook.
        type: str
        choices: [ async, auto, sync ]
    indexmem:
        description:
            - Specifies the amount of index memory in gigabytes.  The
              default is 0.25.  The special decimal values 0.25, 0.5,
              and 0.75 can be used, as can any positive integer.
              This option is only available when creating a new
              volume, and cannot be changed for an existing volume.
        type: str
    indexmode:
        description:
            - Specifies the index mode of the Albireo index.  The
              default is 'dense', which has a deduplication window of
              1 GB of index memory per 1 TB of incoming data,
              requiring 10 GB of index data on persistent storage.
              The 'sparse' mode has a deduplication window of 1 GB of
              index memory per 10 TB of incoming data, but requires
              100 GB of index data on persistent storage.  This option
              is only available when creating a new volume, and cannot
              be changed for an existing volume.
        type: str
        choices: [ dense, sparse ]
    ackthreads:
        description:
            - Specifies the number of threads to use for
              acknowledging completion of requested VDO I/O operations.
              Valid values are integer values from 1 to 100 (lower
              numbers are preferable due to overhead).  The default is
              1.  Existing volumes will maintain their previously
              configured setting unless a different value is specified
              in the playbook.
        type: str
    biothreads:
        description:
            - Specifies the number of threads to use for submitting I/O
              operations to the storage device.  Valid values are
              integer values from 1 to 100 (lower numbers are
              preferable due to overhead).  The default is 4.
              Existing volumes will maintain their previously
              configured setting unless a different value is specified
              in the playbook.
        type: str
    cputhreads:
        description:
            - Specifies the number of threads to use for CPU-intensive
              work such as hashing or compression.  Valid values are
              integer values from 1 to 100 (lower numbers are
              preferable due to overhead).  The default is 2.
              Existing volumes will maintain their previously
              configured setting unless a different value is specified
              in the playbook.
        type: str
    logicalthreads:
        description:
            - Specifies the number of threads across which to
              subdivide parts of the VDO processing based on logical
              block addresses.  Valid values are integer values from
              1 to 100 (lower numbers are preferable due to overhead).
              The default is 1.  Existing volumes will maintain their
              previously configured setting unless a different value
              is specified in the playbook.
        type: str
    physicalthreads:
        description:
            - Specifies the number of threads across which to
              subdivide parts of the VDO processing based on physical
              block addresses.  Valid values are integer values from
              1 to 16 (lower numbers are preferable due to overhead).
              The physical space used by the VDO volume must be
              larger than (slabsize * physicalthreads).  The default
              is 1.  Existing volumes will maintain their previously
              configured setting unless a different value is specified
              in the playbook.
        type: str
notes:
  - In general, the default thread configuration should be used.
requirements:
  - PyYAML
  - kmod-kvdo
  - vdo
s�
- name: Create 2 TB VDO volume vdo1 on device /dev/md0
  vdo:
    name: vdo1
    state: present
    device: /dev/md0
    logicalsize: 2T

- name: Remove VDO volume vdo1
  vdo:
    name: vdo1
    state: absent
s#  (t
AnsibleModuletmissing_required_libNcC`s�|jd|�\}}}g}|dkrJtjd|tj�rJ|S|dkry|jdd|d|d|�ntj|�}|dkr�|S|d	}|dk	r�|j�}n|S(
Ns	%s statusisvdoconf.yml does not existitmsgsInventorying VDOs failed: %strcterrtVDOs(	trun_commandtretfindallt	MULTILINEt	fail_jsontyamltloadtNonetkeys(tmoduletvdocmdRtvdostatusoutRtvdolistt
vdostatusyamltvdoyamls((s>/usr/lib/python2.7/site-packages/ansible/modules/system/vdo.pytinventory_vdos7s
cC`s8|jd|�\}}}td|jd��}|S(Ns%s lists
(RtfilterRtsplit(RRRt
vdolistoutRtrunningvdolist((s>/usr/lib/python2.7/site-packages/ansible/modules/system/vdo.pytlist_running_vdosVscC`sF|jd||f�\}}}|dkrB|jd|�n|S(Ns%s start --name=%sisstarted VDO volume %s(Rtlog(RtvdonameRRtoutR((s>/usr/lib/python2.7/site-packages/ansible/modules/system/vdo.pyt	start_vdods"cC`sF|jd||f�\}}}|dkrB|jd|�n|S(Ns%s stop --name=%sisstopped VDO volume %s(RR#(RR$RRR%R((s>/usr/lib/python2.7/site-packages/ansible/modules/system/vdo.pytstop_vdols"cC`sF|jd||f�\}}}|dkrB|jd|�n|S(Ns%s activate --name=%sisactivated VDO volume %s(RR#(RR$RRR%R((s>/usr/lib/python2.7/site-packages/ansible/modules/system/vdo.pytactivate_vdots
	cC`sF|jd||f�\}}}|dkrB|jd|�n|S(Ns%s deactivate --name=%sisdeactivated VDO volume %s(RR#(RR$RRR%R((s>/usr/lib/python2.7/site-packages/ansible/modules/system/vdo.pytdeactivate_vdo}s
	cC`s�d}g}d|kr@|ddk	r@|jd|d�nd|krt|ddk	rt|jd|d�nd|kr�|ddkr�|jd�nd	|kr�|d	dk	r�|jd
|d	�nd|kr|ddk	r|jd|d�nd
|kr.|d
r.|jd�nd|krb|ddk	rb|jd|d�nd|kr�|ddkr�|jd�nd|kr�|ddk	r�|jd|d�nd|kr�|ddk	r�|jd|d�nd|kr*|ddk	r*|jd|d�nd|kr^|ddk	r^|jd|d�nd|kr�|ddk	r�|jd|d�ndj|�}|S(Nttlogicalsizes--vdoLogicalSize=tblockmapcachesizes--blockMapCacheSize=t	readcachetenableds--readCache=enabledt
readcachesizes--readCacheSize=tslabsizes--vdoSlabSize=t
emulate512s--emulate512=enabledtindexmems--indexMem=t	indexmodetsparses--sparseIndex=enabledt
ackthreadss--vdoAckThreads=t
biothreadss--vdoBioThreads=t
cputhreadss--vdoCpuThreads=tlogicalthreadss--vdoLogicalThreads=tphysicalthreadss--vdoPhysicalThreads=t (Rtappendtjoin(tparamst
vdocmdoptionstoptions((s>/usr/lib/python2.7/site-packages/ansible/modules/system/vdo.pytadd_vdooptions�s@c+/C`s�
tdtdddt�dtdddddd	dg�d
tdd�dtdd�d
tdddt�dtdd�dtdd�dtdddddg�dtdddddg�dtdd�dtdddddg�dtdd�dtdddt�dtdd�dtddddddg�dtdd�dtddddd g�d!tdd�d"tdd�d#tdd�d$tdd�d%tdd��}td&t�}td'|d(t�}ts�|jd)td*�d+t�n|jd,dt�}|s0|jd)d-|�nt	||�}t
||�}|jd}|jd}||kr!|dkr!|jd}|dkr�|jd)d.�n|j}	t
|	�}
|jd/||||
f�\}}}
|d0krt|d&<n |jd)d1|d2|d3|
�|jddkrZ|jd4||f�\}}}
n|jddk	r�|jddkr�|jd5||f�\}}}
n|jd
d6kr�t|||�n|jdd6kr�t|||�nt	||�}|jd7|�|j|�n||kr
|dkr
|jd8|�\}}}
tj|�}i}|d9}|dk	r�|}nd:d;d<d=d>d?d@dAdBdCdDg}iddE6ddC6ddD6dd<6dd@6ddA6ddB6d!d:6d"d;6d#d=6d$d>6d%d?6}i}i}xA|D]9}|||krH|||||<n||||<qWi}x&|j�D]}|||||<qmWi}x[|j�D]M}|j|dk	r�t||�|j|kr�|j|||<q�q�q�W|r�	t
|�}
|
rf|jdF|||
f�\}}}
|d0krCt|d&<qf|jd)dG|d2|d3|
�nd|j�krY|d}|dkr�|jd5||f�\}}}
|d0kr�t|d&<q�|jd)dH|d2|d3|
�n|dkrY|jdI||f�\}}}
|d0kr3t|d&<qV|jd)dH|d2|d3|
�qYnd|j�krL|d}|dkr�|jd4||f�\}}}
|d0kr�t|d&<q�|jd)dJ|d2|d3|
�n|dkrL|jdK||f�\}}}
|d0kr&t|d&<qI|jd)dJ|d2|d3|
�qLnd|j�kr�	|d}|dkr�|jdL|||f�\}}}
|d0kr�t|d&<q�|jd)dM|d2|d3|
�n|dkrB	|jdL|||f�\}}}
|d0kr	t|d&<qB	|jd)dM|d2|d3|
�n|dkr�	|jdL|||f�\}}}
|d0kr�	t|d&<q�	|jd)dM|d2|d3|
�q�	q�	ndEg}i}i} x.|D]&}|||||<||| |<q�	Wi}!x&|j�D]}|||!| |<q
Wi}"x[|!j�D]M}|j|dk	r=
t|!|�|j|kr�
|j||"|<q�
q=
q=
W|jd
rB|jd}#|jdN|#�\}}$}
t|$�dO}%dP|}&||dQ|&}'|'dR}(|%dS})|(|)krBt|d&<|jdT||f�\}}}
qBnd|"j�kr�t|d&<dU|"d}
|jdV|||
f�\}}}
n||dW}*|jd
d6kr�|*dkr�t|||�|d&s�t|d&<q�n|jd
dXkr4|*dkr4t|||�|d&s4t|d&<q4n|jdd6kr}||kr}t|||�|d&s}t|d&<q}n|*dks�|jd
dXkr�|jddXkr�||kr�t|||�|d&s�t|d&<q�nt	||�}|r
|jdY|�n|j|�n||kr�
|d	kr�
|jdZ||f�\}}}
|d0krq
t|d&<n |jd)d[|d2|d3|
�t	||�}|jd\|�|j|�nt	||�}|jd]|�|j|�dS(^Ntnamettypetstrtrequiredtstatetdefaulttpresenttchoicestabsentt	activatedtbooltrunningtgrowphysicaltdeviceR+t
deduplicationtdisabledR.tcompressionR,R-R/R1R0twritepolicytasynctautotsyncR2R3tdenseR4R5R6R7R8R9tchangedt
argument_spectsupports_check_modeR
tPyYAMLt	exceptiontvdosVDO is not installed.sECreating a VDO volume requires specifying a 'device' in the playbook.s"%s create --name=%s --device=%s %sisCreating VDO %s failed.RRs%s disableCompression --name=%ss!%s disableDeduplication --name=%stnoscreated VDO volume %ss	%s statusR
sAcknowledgement threadssBio submission threadssBlock map cache sizesCPU-work threadssLogical threadssPhysical threadss
Read cachesRead cache sizesConfigured write policytCompressiont
DeduplicationsLogical sizes%s modify --name=%s %ssModifying VDO %s failed.s/Changing deduplication on VDO volume %s failed.s %s enableDeduplication --name=%ss-Changing compression on VDO volume %s failed.s%s enableCompression --name=%ss/%s changeWritePolicy --name=%s --writePolicy=%ss.Changing write policy on VDO volume %s failed.sblockdev --getsz %sis/dev/mapper/sVDO statisticssphysical blocksis%s growPhysical --name=%ss--vdoLogicalSize=s%s growLogical --name=%s %stActivatetyess$modified parameters of VDO volume %ss%s remove --name=%ssRemoving VDO %s failed.sremoved VDO volume %ss5received request to remove non-existent VDO volume %s(tdicttTruetFalseRtHAS_YAMLRR	tYAML_IMP_ERRtget_bin_pathRR"R=RR@RR)R'R#t	exit_jsonRRRRCtintR(R&(+tmodule_argstresultRRRR!t
desiredvdoRERNR?R>RR%RtvdostatusoutputRt
processedvdosRtstatusparamkeystvdokeytranstcurrentvdoparamstmodtranst	statfieldt
currentparamstparamkeyt
diffparamstkeyt	dedupemodtcompressmodtwritepolmodt
sizeparamkeystcurrentsizeparamst	sizetranst
sizeparamstdiffsizeparamst
physdevicet
devsectorst	devblockst	dmvdonametcurrentvdostatstcurrentphysblockst
growthreshtvdoactivatestatus((s>/usr/lib/python2.7/site-packages/ansible/modules/system/vdo.pyt
run_module�s!		


				
		
		

	

	
	

	
	

	
	
	
	


	



	
	


	
	
	cC`st�dS(N(R�(((s>/usr/lib/python2.7/site-packages/ansible/modules/system/vdo.pytmaindst__main__(!t
__future__RRRRBt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRR	Rt	tracebackRRfRRcRetImportErrort
format_excRdRR"R&R'R(R)R@R�R�t__name__(((s>/usr/lib/python2.7/site-packages/ansible/modules/system/vdo.pyt<module>s>

�


										7	��	

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]