Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/storage/netapp/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pyo

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
l
mZddlmZddlmZddlmZd�Zd�Zdefd��YZd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys[
---
module: netapp_e_storagepool
short_description: NetApp E-Series manage volume groups and disk pools
description: Create or remove volume groups and disk pools for NetApp E-series storage arrays.
version_added: '2.2'
author:
  - Kevin Hulquest (@hulquest)
  - Nathan Swartz (@ndswartz)
extends_documentation_fragment:
  - netapp.eseries
options:
  state:
    description:
      - Whether the specified storage pool should exist or not.
      - Note that removing a storage pool currently requires the removal of all defined volumes first.
    required: true
    choices: ["present", "absent"]
  name:
    description:
      - The name of the storage pool to manage
    required: true
  criteria_drive_count:
    description:
      - The number of disks to use for building the storage pool.
      - When I(state=="present") then I(criteria_drive_count) or I(criteria_min_usable_capacity) must be specified.
      - The pool will be expanded if this number exceeds the number of disks already in place (See expansion note below)
    required: false
    type: int
  criteria_min_usable_capacity:
    description:
      - The minimum size of the storage pool (in size_unit).
      - When I(state=="present") then I(criteria_drive_count) or I(criteria_min_usable_capacity) must be specified.
      - The pool will be expanded if this value exceeds its current size. (See expansion note below)
    required: false
    type: float
  criteria_drive_type:
    description:
      - The type of disk (hdd or ssd) to use when searching for candidates to use.
      - When not specified each drive type will be evaluated until successful drive candidates are found starting with
        the most prevalent drive type.
    required: false
    choices: ["hdd","ssd"]
  criteria_size_unit:
    description:
      - The unit used to interpret size parameters
    choices: ["bytes", "b", "kb", "mb", "gb", "tb", "pb", "eb", "zb", "yb"]
    default: "gb"
  criteria_drive_min_size:
    description:
      - The minimum individual drive size (in size_unit) to consider when choosing drives for the storage pool.
  criteria_drive_interface_type:
    description:
      - The interface type to use when selecting drives for the storage pool
      - If not provided then all interface types will be considered.
    choices: ["sas", "sas4k", "fibre", "fibre520b", "scsi", "sata", "pata"]
    required: false
  criteria_drive_require_da:
    description:
      - Ensures the storage pool will be created with only data assurance (DA) capable drives.
      - Only available for new storage pools; existing storage pools cannot be converted.
    default: false
    type: bool
    version_added: '2.9'
  criteria_drive_require_fde:
    description:
     - Whether full disk encryption ability is required for drives to be added to the storage pool
    default: false
    type: bool
  raid_level:
    description:
      - The RAID level of the storage pool to be created.
      - Required only when I(state=="present").
      - When I(raid_level=="raidDiskPool") then I(criteria_drive_count >= 10 or criteria_drive_count >= 11) is required
        depending on the storage array specifications.
      - When I(raid_level=="raid0") then I(1<=criteria_drive_count) is required.
      - When I(raid_level=="raid1") then I(2<=criteria_drive_count) is required.
      - When I(raid_level=="raid3") then I(3<=criteria_drive_count<=30) is required.
      - When I(raid_level=="raid5") then I(3<=criteria_drive_count<=30) is required.
      - When I(raid_level=="raid6") then I(5<=criteria_drive_count<=30) is required.
      - Note that raidAll will be treated as raidDiskPool and raid3 as raid5.
    required: false
    choices: ["raidAll", "raid0", "raid1", "raid3", "raid5", "raid6", "raidDiskPool"]
    default: "raidDiskPool"
  secure_pool:
    description:
      - Enables security at rest feature on the storage pool.
      - Will only work if all drives in the pool are security capable (FDE, FIPS, or mix)
      - Warning, once security is enabled it is impossible to disable without erasing the drives.
    required: false
    type: bool
  reserve_drive_count:
    description:
      - Set the number of drives reserved by the storage pool for reconstruction operations.
      - Only valid on raid disk pools.
    required: false
  remove_volumes:
    description:
    - Prior to removing a storage pool, delete all volumes in the pool.
    default: true
  erase_secured_drives:
    description:
      - If I(state=="absent") then all storage pool drives will be erase
      - If I(state=="present") then delete all available storage array drives that have security enabled.
    default: true
    type: bool
notes:
  - The expansion operations are non-blocking due to the time consuming nature of expanding volume groups
  - Traditional volume groups (raid0, raid1, raid5, raid6) are performed in steps dictated by the storage array. Each
    required step will be attempted until the request fails which is likely because of the required expansion time.
  - raidUnsupported will be treated as raid0, raidAll as raidDiskPool and raid3 as raid5.
  - Tray loss protection and drawer loss protection will be chosen if at all possible.
s&
- name: No disk groups
  netapp_e_storagepool:
    ssid: "{{ ssid }}"
    name: "{{ item }}"
    state: absent
    api_url: "{{ netapp_api_url }}"
    api_username: "{{ netapp_api_username }}"
    api_password: "{{ netapp_api_password }}"
    validate_certs: "{{ netapp_api_validate_certs }}"
s�
msg:
    description: Success message
    returned: success
    type: str
    sample: Json facts for the pool that was created.
N(tgroupby(tsleep(tpformat(tNetAppESeriesModule(t	to_nativecC`stt|t�std��ngtt|��D]$\}}|tt|��f^q1}t|dd�dt�S(sIReturns a generator containing a descending list of most common elements.siterator must be a list.tkeycS`s|dS(Ni((tx((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pyt<lambda>�streverse(t
isinstancetlistt	TypeErrorRtsortedtlentTrue(titeratorR
tgrouptgrouped((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytget_most_common_elements�s=c`s"tj���fd��}|S(sNGeneric memoizer for any function with any number of arguments including zero.c`sVdtf���fd��Y}�r@�r@t��f�nd}|�j|�S(NtMemoizeFuncArgsc`seZ���fd�ZRS(c`s����||<||S(N((tselft_key(targstfunctkwargs(sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pyt__missing__�s(t__name__t
__module__R!((RRR (sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pyR�stno_argument_response(tdicttstrt__getitem__(RR RR
(R(RR sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytwrapper�s"$(t	functoolstwraps(RR(((RsW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytmemoize�s
tNetAppESeriesStoragePoolcB`s^eZdZdZd�Zeed���Zeed���Zeed���Z	ee
d��Zed��Zed��Z
dd	�Zed
��Zd�Zed��Zed
��Zd�Zed��Zed��Zd�Zd�Zed�Zed�Zd�Zd�Zed�Zed�Zed�Z d�Z!RS(i
ic#C`sXd}tdtdtdddgdd�d	tdtdd�d
tdddd
dddddddg
dddd�dtdd�dtddddddddgdd�d tdd!d"gdddt�d#tdd$�d%tdd&dt�d'tdd&dt�d(tdd$�d)tdd*d+d,d-d.d/d0gdd0�d1tdd&dt�d2tdd&dt�d3tdd�d4tdd&dt��}ddd)ggg}tt|�jd5|d6|d7td8|�|jj}|d|_|d9|_	|d	|_
|d|_|d(|_|d
|_
|d#|_|d |_|d|_|d'|_|d%|_|d)|_|d1|_|d2|_|d3|_|d4|_d|_|jr�t|j|j|j
�|_n|jrt|j|j|j
�|_nd|_
|jd*kr9d0|_n|jd-krTd.|_ndS(:Ns02.00.0000.0000tstatetrequiredtchoicestpresenttabsentttypeR&tnametcriteria_size_unittbytestbtkbtmbtgbttbtpbtebtzbtybtdefaulttcriteria_drive_counttinttcriteria_drive_interface_typetsastsas4ktfibret	fibre520btscsitsatatpatatcriteria_drive_typetssdthddtcriteria_drive_min_sizetfloattcriteria_drive_require_datbooltcriteria_drive_require_fdetcriteria_min_usable_capacityt
raid_leveltraidAlltraid0traid1traid3traid5traid6traidDiskPoolterase_secured_drivestsecure_pooltreserve_drive_counttremove_volumestansible_optionstweb_services_versiontsupports_check_modetrequired_iftssid(R%RtFalsetsuperR,t__init__tmoduletparamsR-RcR3R@RRR4RMRJRBRQRORSR[R\R]R^tNonetpool_detailRAt
SIZE_UNIT_MAP(RtversionR_RbR((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pyRf�sl!*!	!!	















						cC`s8g|jD]*}|dr
|ddkr
|d^q
S(s&Determine the list of available drivest	availableRtoptimaltid(tdrives(Rtdrive((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytavailable_drives�scC`sAg|jD]}|d^q
}gt|�D]}|d^q-S(sHDetermine the types of available drives sorted by the most common first.tdriveMediaTypei(RpR(RRqttypestentry((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytavailable_drive_types�s cC`sAg|jD]}|d^q
}gt|�D]}|d^q-S(s(Determine the types of available drives.tphyDriveTypei(RpR(RRqt
interfacesRu((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytavailable_drive_interface_typess cC`ss|rBg|jD].}|d|jdkr|dr|^qSg|jD]#}|d|jdkrL|^qLS(s.Retrieve list of drives found in storage pool.tcurrentVolumeGroupRefRothotSpare(RpRj(Rtexclude_hotsparesRq((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytstorage_pool_drivess,cC`s�d}|jdkr"t|j�Sy |jd|j�\}}Wn9tk
r}}|jjdd|jt	|�f�nX|ddS(sMMaximum number of drives that a storage pool can be expanded at a given time.RZsstorage-systems/%s/capabilitiestmsgsJFailed to fetch maximum expandable drive count. Array id [%s].  Error[%s].tfeatureParameterstmaxDCEDrivesN(
RiRSRRrtrequestRct	ExceptionRgt	fail_jsonR(Rtcapabilitiestrcterror((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytexpandable_drive_counts
 cC`sw|jd|jdt�\}}|dks`d|ddj�ks`|ddddkrg|jS|dddS(s:Provide the storage array's minimum disk pool drive count.s4storage-systems/%s/symbol/getSystemAttributeDefaultst
ignore_errorsi�tminimumDriveCounttdefaultstdiskPoolDefaultAttributesi(R�RcRtkeyst$DEFAULT_DISK_POOL_MINIMUM_DISK_COUNT(RR�tattr((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytdisk_pool_drive_minimum s
"&cC`s�|r_tg|jD]@}|d|kr|dr|ddkrt|d�^q�}nFtg|jD]0}|drl|ddkrlt|d�^ql�}|jjd|�t|�S(s1Determine the list of available drive capacities.RoRmRRntusableCapacitysavailable drive capacities: %s(tsetRpRARgtlogR(Rt
drive_id_listRqtavailable_drive_capacities((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytget_available_drive_capacities,s,3cC`sfd}y |jd|j�\}}Wn9tk
ra}|jjdd|jt|�f�nX|S(s.Retrieve list of drives found in storage pool.sstorage-systems/%s/drivesR~s7Failed to fetch disk drives. Array id [%s].  Error[%s].N(RiR�RcR�RgR�R(RRpR�R�((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pyRp9s cC`s�|jr||jkrtS|jdkr8||jkS|jdkrQ|dkS|jdkrz|dkoy|ddkS|jdkr�d|ko�d	kSS|jd
kr�d|ko�d	kSStS(
s%Validate drive count criteria is met.RZRUiRViRWRXiiRYi(sraid3sraid5(R@RdRSR�(Rtdrive_count((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytis_drive_count_validEs

cC`s�d}y |jd|j�\}}Wn?tk
rg}|jjdd|jt|�|jf�nXg|D]}|d|jkro|^qo}|r�|dSt	�S(s"Retrieve storage pool information.s storage-systems/%s/storage-poolsR~sAFailed to get storage pools. Array id [%s]. Error[%s]. State[%s].R3iN(
RiR�RcR�RgR�RR-R3R%(Rtstorage_pools_respR�terrtpoolRj((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytstorage_poolVs !,cC`s�d}y |jd|j�\}}Wn?tk
rg}|jjdd|jt|�|jf�nX|jd}g|D] }|d|kr||d^q|}|S(s6Retrieve list of volumes associated with storage pool.sstorage-systems/%s/volumesR~sAFailed to get storage pools. Array id [%s]. Error[%s]. State[%s].tvolumeGroupRefRoN(	RiR�RcR�RgR�RR-R�(Rtvolumes_respR�R�t	group_reftvolumetstorage_pool_volume_list((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytstorage_pool_volumescs !
-c`s��fd�}�fd�}�jrCt�j�t|�}nt|�}tt�j��t�j|���}|dd}||d}|||�}||d|dd}	||	}
|
|}||�|}|
|}
|
dS(s@Return the total usable capacity based on the additional drives.c`s|dkrO|dkrdS|dkr,dS|dkr<dS|dkr�d	Sn�|d
kr�|dkrkdS|dkr{d	S|dkr�dS|dkr�dSnO|d
kr�|dkr�dS|dkr�d	S|dkr�dS|dkr�dSn�jjdd�j�dS(s/Determine the space reserved for reconstructioni$iXg�������?ixgffffff�?i8g�������?iP�g333333�?i@g�������?g�������?i�R~s7Drive count exceeded the error percent table. Array[%s]N(RgR�Rc(t_drive_countt
_extent_count(R(sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytget_ddp_error_percentts8c`s�d}�jr�j}n�|dkr0d}n~|dkrEd}ni|dkrZd}nT|dkrod	}n?|d
kr�d}n*|dkr�d
}n|dkr�d}n|S(s'Determine the number of reserved drive.iiii�ii�ii@ii iiiii(R](t_disk_countt
reserve_count(R(sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytget_ddp_reserved_drive_count�s$								I�i i
I(RjRR}tminR�(Rtexpansion_drive_listR�R�R�tdrive_usable_capacitytdrive_data_extentstmaximum_stripe_countt
error_percentterror_overheadttotal_stripe_counttstripe_count_per_drivetreserved_stripe_counttavailable_stripe_count((RsW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytget_ddp_capacityqs  	


c`s��fd�}x�|�D]�}�jrJ�jt|d�krJqqJn�jr��jdkr��j�j|dd�ks�jt|d�kr�qq�n�jr��jt�j|dd��kr�qq�n|SW�jj	dd�j
�d	S(
sBRetrieve set of drives candidates for creating a new storage pool.c`s�t�}�jr�jgn�j}�jr<�jgn�j}xp|D]h}x_|D]W}d!}td�jdkr�dnddtdd��}tdd	d
td�j��}td�jd
|dt	d�j
r�dndd|d�jr�tnt	d|dt	d�j
rdndd|�
}y,�j
d�jd|dd�\}	}Wn9tk
r�}
�jjdd�jt|
�f�nX|rY|j|d�qYqYWqLWt�}t�}t�}
t�}t�}xi|D]a}|dr&|d r|j|�qM|j|�q�|d r@|
j|�q�|j|�q�W|rg|j|�n|r}|j|�n|
r�|j|
�n|r�|j|�n|S("s(Perform request for new volume creation.R2RZtdiskPoolttraditionalt"diskPoolVolumeCandidateRequestDatat reconstructionReservedDriveCounti��tcandidateSelectionTypetcounttdriveRefListtdriveReft	raidLevelRwtdssPreallocEnabledtsecurityTypetcapabletnoneRst onlyProtectionInformationCapabletvolumeCandidateRequestDatatallocateReserveSpacet
securityLeveltfdesGstorage-systems/%s/symbol/getVolumeCandidates?verboseErrorResponse=truetdatatmethodtPOSTR~s=Failed to retrieve volume candidates. Array [%s]. Error [%s].tvolumeCandidatettrayLossProtectiontdrawerLossProtectionN(RRJRvRBRyRiR%RSRrRdRQRORR�RcR�RgR�Rtextendtappend(tcandidates_listtdrive_typestinterface_typestinterface_typet
drive_typet
candidatestvolume_candidate_request_datatcandidate_selection_typetcriteriaR�R�ttray_drawer_protectionttray_protectiontdrawer_protectiont
no_protectiontsorted_candidatestitem(R(sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytget_candidate_drive_request�sj	

		#					



t
driveCountRZR�R�t
usableSizeR~s=Not enough drives to meet the specified criteria. Array [%s].N(R@RARRRSR�RMR�R�RgR�Rc(RR�t	candidate((RsW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytget_candidate_drives�sC					&	c`s��fd�}t�}d}d}d}�jrY�j}�jt�jd�}n�jr{�jt�j�}n|dks�|dkr�x|�D]�}�jr��jt�j	|d��kr�q�q�n�j
dkr)t|d�|kr^�j|d�|kr^|j|�Pq^n5|t|d�8}|t|d�8}|j|�|dkr�|dkr�Pq�q�W�j
jdd�j�n|S(	s�Retrieve required expansion drive list.

        Note: To satisfy the expansion criteria each item in the candidate list must added specified group since there
        is a potential limitation on how many drives can be incorporated at a time.
            * Traditional raid volume groups must be added two drives maximum at a time. No limits on raid disk pools.

        :return list(candidate): list of candidate structures from the getVolumeGroupExpansionCandidates symbol endpoint
        c`s�d}d�j}�jdkr2d�j}ny,�j|ddd�jd�\}}Wn9tk
r�}�jjdd	�jt|�f�nX|d
S(s�Perform the request for expanding existing volume groups or disk pools.

            Note: the list of candidate structures do not necessarily produce candidates that meet all criteria.
            sUstorage-systems/%s/symbol/getVolumeGroupExpansionCandidates?verboseErrorResponse=trueRZsRstorage-systems/%s/symbol/getDiskPoolExpansionCandidates?verboseErrorResponse=trueR�R�R�RoR~s=Failed to retrieve volume candidates. Array [%s]. Error [%s].R�N(	RiRcRSR�RjR�RgR�R(R�turlR�R�(R(sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pyt%get_expansion_candidate_drive_request$s
,ittotalRaidedSpaceRpRZR�R~s=Not enough drives to meet the specified criteria. Array [%s].(RRRRARjR@RR}RMR�R�RSR�R�RgR�Rc(RR�trequired_candidate_listtrequired_additional_drivestrequired_additional_capacityttotal_required_capacityR�((RsW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytget_expansion_candidate_drivess6					"	

cC`sr|js&|jjdd|j�n|jdkr_|jjdd|jd|jf�n|jdddS(	sWRetrieve the current number of reserve drives for raidDiskPool (Only for raidDiskPool).R~s(The storage pool must exist. Array [%s].RZs?The storage pool must be a raidDiskPool. Pool [%s]. Array [%s].RotvolumeGroupDatatdiskPoolDataR�(RjRgR�RcRS(R((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytget_reserve_drive_count]s	cC`s�|jdkr9|jjdd|jd|jf�nt�}|jr�|j|j�xI|j�D]}|j|d�qhWn!|j	�}|j|dd�t
|�}tt|dd	�|d
�}|d
kr�d
}n|S(sWRetrieve the maximum number of reserve drives for storage pool (Only for raidDiskPool).RZR~s?The storage pool must be a raidDiskPool. Pool [%s]. Array [%s].RoRpR�R�g�������?ii
(
RSRgR�RjRcRR�R}R�R�RR�RA(Rt
drives_idsR�R�tmaximum_reserve_drive_count((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytget_maximum_reserve_drive_countis		!	cC`st}|jdkr|jr|j�}|jdksH|j|krk|jjdd||jf�n|j|j�kr�t}n|syE|j	d|jdddt
d	|jd
d|j��\}}Wqtk
r}|jjdd|jd
|jf�qXqn|S(
s-Set the reserve drive count for raidDiskPool.RZiR~s�Supplied reserve drive count is invalid or exceeds the maximum allowed. Note that it may be necessary to wait for expansion operations to complete before the adjusting the reserve drive count. Maximum [%s]. Array [%s].s7storage-systems/%s/symbol/setDiskPoolReservedDriveCountR�R�R�R�Rot
newDriveCountsLFailed to set reserve drive count for disk pool. Disk Pool [%s]. Array [%s].(
RdRSR]R�RgR�RcR�RR�R%RjR�(Rt
check_modetchangedt
maximum_countR�trespR�((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytset_reserve_drive_count�s"	"c	C`s�t}t�}x?|jD]4}|dr|drt}|j|d�qqW|r�|r�y5|jd|jdddtd|��\}}Wq�tk
r�}|j	j
d	d
|j�q�Xn|S(sHErase all available drives that have encryption at rest feature enabled.Rmt
fdeEnabledRosDstorage-systems/%s/symbol/reprovisionDrive?verboseErrorResponse=trueR�R�R�R�R~s.Failed to erase all secured drives. Array [%s](RdRRpRR�R�RcR%R�RgR�(RR�R�tdrives_listRqR�R�R�((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pyt"erase_all_available_secured_drives�s	
	,!cC`s d|j}td|jd|j��}|jdkr�d|j}|jtddddd	dd
ddd
��|jr�|jtdtdtd|j����q�ny%|j|ddd|�\}}Wn9tk
r}|j	j
dd|jt|�f�nX|j|_
dS(sCreate new storage pool.sEstorage-systems/%s/symbol/createVolumeGroup?verboseErrorResponse=truetlabelR�RZsBstorage-systems/%s/symbol/createDiskPool?verboseErrorResponse=truetbackgroundOperationPriorityt
useDefaulttcriticalReconstructPrioritytdegradedReconstructPriorityt poolUtilizationCriticalThresholdi��tpoolUtilizationWarningThresholditvolumeCandidateDatatdiskPoolVolumeCandidateDataR�R�R�R�R~s9Failed to create storage pool. Array id [%s].  Error[%s].N(RcR%R3R�RStupdateR]R�R�RgR�RR�Rj(RR�trequest_bodyR�R�R�((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytcreate_storage_pool�s(


	%c	C`sBg|jD]}|dr
|d^q
}yK|jr<dnd}|jd|j|jd|fdd�\}}WnCtk
r�}|jjdd	|jd|jt|�f�nX|r>|j	r>y5|jd
|jdddt
d
|��\}}Wq>tk
r:}|jjdd|jt|�f�q>XndS(sDelete storage pool.R�Ros?delete-volumes=truets%storage-systems/%s/storage-pools/%s%sR�tDELETER~sGFailed to delete storage pool. Pool id [%s]. Array id [%s].  Error[%s].sDstorage-systems/%s/symbol/reprovisionDrive?verboseErrorResponse=trueR�R�R�sRFailed to erase drives prior to creating new storage pool. Array [%s]. Error [%s].N(R}R^R�RcRjR�RgR�RR[R%(RRqR}tdelete_volumes_parameterR�R�R�((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytdelete_storage_pool�s*	-%	,c
C`s|j|_t}|jrE|jddkrE|jjdd�n|jrj|jddkrjt}n|r|ryB|jd|j|jdfdt	dt�d	d
�\}}Wqt
k
r�}|jjdd|jd|jt|�f�qXn|j|_|S(s+Enable security on an existing storage poolR�tenabledR~sMIt is not possible to disable storage pool security! See array documentation.s#storage-systems/%s/storage-pools/%sRoR�t
securePoolR�R�sDFailed to secure storage pool. Pool id [%s]. Array [%s]. Error [%s].(R�RjRdR\RgR�RR�RcR%R�R(RR�tneeds_secure_poolR�R�R�((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytsecure_storage_pool�s	
 "(cC`s�|j|jdk}|rE|jddkrE|jjdd�n|r�|r�td|j�}y5|jd|j|jfd|dd�\}}Wq�tk
r�}|jjdd	|jt	|�f�q�Xn|j
|_|S(
s*Request storage pool raid level migration.R�RZR~s+Raid level cannot be changed for disk poolss7storage-systems/%s/storage-pools/%s/raid-type-migrationR�R�R�sKFailed to change the raid level of storage pool. Array id [%s].  Error[%s].(RSRjRgR�R%R�RcR3R�RR�(RR�tneeds_migrationtsp_raid_migrate_reqR�R�R�((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytmigrate_raid_level�s
	,c
C`s�|j�}t|�}d}t�}xY|r�t�}x6|rqt|�|jkrq|j|j�d�q<W|j|�q*W|r�|r�d|j}|j	dkr�d|j}nx|r�|j�}t
d|jdd|�}	y%|j|dd	d
|	�\}
}Wn�t
k
r}|jd|j|jdfd
t�\}
}
|
dkr�|
r�g|
D]#}|d|jkrl|d^ql}|jjdddj|�|jd|jt|�f�n|jjdd|jd|jt|�f�nX|r�x�t|j�D]�}|jd|j|jdfd
t�\}
}
|
dkrxS|
D]A}|d|jkrf|ddkrftd�|d}PqfqfWd}PqqWq�q�Wn||fS(s�Add drives to existing storage pool.

        :return bool: whether drives were required to be added to satisfy the specified criteria.gRpsMstorage-systems/%s/symbol/startVolumeGroupExpansion?verboseErrorResponse=trueRZsJstorage-systems/%s/symbol/startDiskPoolExpansion?verboseErrorResponse=trueR�R�R�R�R�s3storage-systems/%s/storage-pools/%s/action-progressRoR�i�t	volumeReft
currentActionR~s�Failed to add drives to the storage pool possibly because of actions in progress. Actions [%s]. Pool id [%s]. Array id [%s]. Error[%s].s, sNFailed to add drives to storage pool. Pool id [%s]. Array id [%s].  Error[%s].tremappingDceitestimatedTimeToCompletion(R�RPRRR�R�tpopR�RcRSR%RjR�R�RR�RgR�tjoinRtrangetEXPANSION_TIMEOUT_SECR	(RR�texpansion_candidate_listtchanged_requiredtestimated_completion_timet!required_expansion_candidate_listtsubsetR�tcandidate_drives_listRR�R�R�tactions_resptactiontactionstdummy((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytexpand_storage_poolsX			

		%	&
#%	&


c
C`sCt}|jdkr~|jdkrI|jdkrI|jjdd�n|jr~|j|j�r~|jjdd�q~n|j|_	|jj
t|j	��|jdkr�|jr�|j
dt�n|j	rc|jdkr�t}q{|jdkr{|jrI|jt|j�krI|jjdd|j|j	df�n|jr�|j|j	d	kr�|jjdd
|j|j	df�n|jdk	r�|j|j	ddkr�|jjdd
|j|j	df�n|jdt�\}}|rt}n|jdt�r't}n|jdt�rBt}n|jdt�r`t}q`q{n|jdkr{t}nd}|r�|jjr�|jdkr�|jr�|j
�n|j	r}t�}|j�\}}|r�|jd�n|j�r|jd�n|j�r+|jd�n|j�rG|jd�n|rcddj|�}n|r�|d|7}q�q�|j�d}|j�r�d}n|j�r�|d7}q�q�|j	r�|j�d}q�n|j|_	|jj
t|j	��|jj
||j�|jjd||jd||j	�dS(s'Apply requested state to storage array.R0R~sNOne of criteria_min_usable_capacity or criteria_drive_count must be specified.s@criteria_drive_count must be valid for the specified raid level.R�R1sEFailed to reduce the size of the storage pool. Array [%s]. Pool [%s].RoRssTFailed! It is not possible to modify storage pool media type. Array [%s]. Pool [%s].t!protectionInformationCapabilitiestprotectionInformationCapablesJFailed! It is not possible to modify DA-capability. Array [%s]. Pool [%s].s3No changes were required for the storage pool [%s].texpandedsraid migrationtsecuredsadjusted reserve drive counts>Following changes have been applied to the storage pool [%s]: s, sB
The expansion operation will complete in an estimated %s minutes.sStorage pool [%s] was created.s*Storage pool [%s] was created and secured.s Adjusted reserve drive count.sStorage pool [%s] removed.R�N( RdR-R@RiRRRgR�R�R�RjR�R
R[R�RRR}RcRJROR"RRR�R�RR�RRRR3t	exit_json(RR�tneeds_expansionRR~tchange_listR%((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytapply@s�		!					
		
		
N("R"R#RR�RftpropertyR+RrRvRyRR}R�R�RiR�RpR�R�R�R�R�R�R�R�RdR�R�RRRRR"R*(((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pyR,�s>	>
	
	NZD				;cC`st�}|j�dS(N(R,R*(R�((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pytmain�s	t__main__(t
__future__RRRR2t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR)t	itertoolsRttimeR	tpprintR
tansible.module_utils.netappRtansible.module_utils._textRRR+R,R,R"(((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_storagepool.pyt<module>s*


r			���	

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