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/na_ontap_volume_autosize.pyo

�
�Udac@`s
ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlZddl
jjZddlmZdd
lmZddl
mZddlmZej�Zdefd��YZd�Zedkr	e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
module: na_ontap_volume_autosize
short_description: NetApp ONTAP manage volume autosize
extends_documentation_fragment:
    - netapp.na_ontap
version_added: '2.9'
author: NetApp Ansible Team (@carchi8py) <[email protected]>
description:
- Modify Volume AutoSize
options:
  volume:
    description:
    - The name of the flexible volume for which we want to set autosize.
    type: str
    required: true

  mode:
    description:
    - Specify the flexible volume's autosize mode of operation.
    type: str
    choices: ['grow', 'grow_shrink', 'off']

  vserver:
    description:
    - Name of the vserver to use.
    required: true
    type: str

  grow_threshold_percent:
    description:
    - Specifies the percentage of the flexible volume's capacity at which autogrow is initiated.
    - The default grow threshold varies from 85% to 98%, depending on the volume size.
    - It is an error for the grow threshold to be less than or equal to the shrink threshold.
    - Range between 0 and 100
    type: int

  increment_size:
    description:
    - Specify the flexible volume's increment size using the following format < number > [k|m|g|t]
    - The amount is the absolute size to set.
    - The trailing 'k', 'm', 'g', and 't' indicates the desired units, namely 'kilobytes', 'megabytes', 'gigabytes', and 'terabytes' (respectively).
    type: str

  maximum_size:
    description:
    - Specify the flexible volume's maximum allowed size using the following format < number > [k|m|g|t]
    - The amount is the absolute size to set.
    - The trailing 'k', 'm', 'g', and 't' indicates the desired units, namely 'kilobytes', 'megabytes', 'gigabytes', and 'terabytes' (respectively).
    - The default value is 20% greater than the volume size at the time autosize was enabled.
    - It is an error for the maximum volume size to be less than the current volume size.
    - It is also an error for the maximum size to be less than or equal to the minimum size.
    type: str

  minimum_size:
    description:
    - Specify the flexible volume's minimum allowed size using the following format < number > [k|m|g|t] The amount is the absolute size to set.
    - The trailing 'k', 'm', 'g', and 't' indicates the desired units, namely 'kilobytes', 'megabytes', 'gigabytes', and 'terabytes' (respectively).
    - The default value is the size of the volume at the time the 'grow_shrink' mode was enabled.
    - It is an error for the minimum size to be greater than or equal to the maximum size.
    type: str

  reset:
    description:
    - "Sets the values of maximum_size, increment_size, minimum_size, grow_threshold_percent, shrink_threshold_percent and mode to their defaults"
    type: bool

  shrink_threshold_percent:
    description:
    - Specifies the percentage of the flexible volume's capacity at which autoshrink is initiated.
    - The default shrink threshold is 50%. It is an error for the shrink threshold to be greater than or equal to the grow threshold.
    - Range between 0 and 100
    type: int
sv
    - name: Modify volume autosize
      na_ontap_volume_autosize:
        hostname: 10.193.79.189
        username: admin
        password: netapp1!
        volume: ansibleVolumesize12
        mode: grow
        grow_threshold_percent: 99
        increment_size: 50m
        maximum_size: 10g
        minimum_size: 21m
        shrink_threshold_percent: 40
        vserver: ansible_vserver

    - name: Reset volume autosize
      na_ontap_volume_autosize:
        hostname: 10.193.79.189
        username: admin
        password: netapp1!
        volume: ansibleVolumesize12
        reset: true
        vserver: ansible_vserver
t
N(tNetAppModule(t
AnsibleModule(tOntapRestAPI(t	to_nativetNetAppOntapVolumeAutosizecB`s_eZd�Zd	d�Zd�Zd	d�Zd�Zd�Zd�Z	d�Z
d�ZRS(
cC`s[t|_tdddddd#dd$�|_tj�|_|jjtd	td
tdd�d
td
tddddg�dtd
tdd�dtd
tdd�dtd
tdd�dtd
tdd�dtd
tdd�dtd
tdd�dtd
tdd��	�t	d|jdtdddgddgddgddgddgdd
gg�|_
t�|_|jj
|j
j�|_t|j
�|_|jj�rt|_|jjd�r�|j
jdd�n|jjd�rW|j
jdd �qWnGttkr2|j
jdd!�n%tjd"|j
d|jd�|_dS(%Ntkitmitgittitvolumetrequiredttypetstrtmodetchoicestgrowtgrow_shrinktofftvservertgrow_threshold_percenttinttincrement_sizetmaximum_sizetminimum_sizetresettbooltshrink_threshold_percentt
argument_spectsupports_check_modetmutually_exclusivetmsgs?Rest API does not support increment size, please switch to ZAPIs6Rest API does not support reset, please switch to ZAPIs(the python NetApp-Lib module is requiredtmoduleii@(tFalsetuse_resttdictt_size_unit_maptnetapp_utilstna_ontap_host_argument_specR$tupdatetTrueR
R(R	t	na_helpertset_parameterstparamst
parametersRtrestApitis_resttgett	fail_jsontHAS_NETAPP_LIBtsetup_na_ontap_zapitserver(tself((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_volume_autosize.pyt__init__�sL								cC`s|jrridd6}d|}|jj||�\}}|d
k	ra|jjdd|�n|j|d�Stjj	d�}|j
d|jd�y|jj
|t�}WnOtjjk
r}|jjdd|jdt|�fd	tj��nX|j|�Sd
S(sX
        Get volume_autosize information from the ONTAP system
        :return:
        tautosizetfieldssstorage/volumes/R's%ssvolume-autosize-getRs0Error fetching volume autosize infor for %s : %st	exceptionN(R*R5R7tNoneR(R8t_create_get_volume_returnR-tzapit	NaElementt
add_new_childR4R;tinvoke_successfullyR0t
NaApiErrorRt	tracebackt
format_exc(R<tuuidR3tapitmessageterrortvolume_autosize_infotresult((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_volume_autosize.pytget_volume_autosize�s 	

cC`s�i}|jr�d|kr,|d|d<nd|krI|d|d<nd|krf|d|d<nd|kr�|d|d<nd|kr�|d|d	<q�n�|jd�r�|jd�|d<n|jd
�r�t|jd
��|d<n|jd�r|jd�|d<n|jd
�r=|jd
�|d<n|jd�rb|jd�|d<n|jd�r�t|jd��|d	<n|ikr�d}n|S(ss
        Create a return value from volume-autosize-get info file
        :param results:
        :return:
        Rtgrow_thresholdRtmaximumRtminimumR tshrink_thresholdR#sgrow-threshold-percentsincrement-sizeRsmaximum-sizesminimum-sizesshrink-threshold-percentN(R*tget_child_by_nametget_child_contentRRA(R<tresultstreturn_value((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_volume_autosize.pyRB�s6		c	C`s|jr4i}i}i}|jjd�rA|jd|d<n|jjd�rg|jd|d<n|jjd�r�|jd|d<n|jjd�r�|jd|d<n|jjd�r�|jd|d	<n||d
<d|}|jj|||�\}}|dk	r|jjdd
|�qn�tj	j
d�}|jd|jd�|jjd�r�|jd|jd�n|jjd�r�|jdt|jd��n|jjd�r�|jd|jd�n|jjd�dk	r|jdt|jd��n|jjd�rK|jd|jd�n|jjd�rw|jd|jd�n|jjd�r�|jdt|jd��ny|j
j|t�WnOtj	jk
r}|jjdd|jdt|�fdtj��nXdS(s<
        Modify a Volumes autosize
        :return:
        RRRQRRRR RSR#RTR>sstorage/volumes/R's%ssvolume-autosize-setRsgrow-threshold-percentRsincrement-sizeR!smaximum-sizesminimum-sizesshrink-threshold-percents'Error modify volume autosize for %s: %sR@N(R*R4R7R5tpatchRAR(R8R-RCRDRERR;RFR0RGRRHRI(	R<RJR3tdataR>RKRLRMRN((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_volume_autosize.pytmodify_volume_autosize�sP	

   )cC`snxgdddgD]V}|j|�r|jrG|j||�||<qft|j||��||<qqW|S(sx
        Save a converted parameter
        :param converted_parameters: Dic of all parameters
        :return:
        RR R(R7R*tconvert_to_byteRt
convert_to_kb(R<tconverted_parameterstattr((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_volume_autosize.pytmodify_to_kbs	#cC`sb|j|�ddkr3|jjdd|�n|j|j|�dt|j|�d �S(	s�
        Convert a number 10m in to its correct KB size
        :param variable: the Parameter we are going to covert
        :param converted_parameters: Dic of all parameters
        :return:
        i����RRRRR's%s must end with a k, m, g or t(RRRR(R7R(R8R,R(R<tvariableR^((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_volume_autosize.pyR]*scC`sf|j|�dd	kr3|jjdd|�n|j|j|�dt|j|�d �dS(
Ni����RRRRR's%s must end with a k, m, g or ti(RRRR(R7R(R8R,R(R<RaR^((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_volume_autosize.pyR\5scC`s�idd6|jdd6|jdd6}d}|jj||�\}}|d
k	rp|jjdd	|�n|d
ddS(sI
        Get a volume's UUID
        :return: uuid of the volume
        t*R?RtnameRssvm.namesstorage/volumesR's%strecordsiRJN(R4R5R7RAR(R8(R<R3RKRLRM((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_volume_autosize.pytget_volume_uuid:s
cC`sd}|js%tjd|j�n|jr=|j�}n|jd|�}tj|j	�}|j
|�}|jj||�|jj
r�|jjr�q�|jd|�n|j	jd�tkr�|jd|�t|j_
n|jjd|jj
�dS(Ntna_ontap_volume_autosizeRJR!tchanged(RAR*R-t
ems_log_eventR;ReRPtcopytdeepcopyR4R`R1tget_modified_attributesRgR(t
check_modeR[R7R0t	exit_json(R<RJtcurrentR^((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_volume_autosize.pytapplyHs"		N(t__name__t
__module__R=RARPRBR[R`R]R\ReRo(((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_volume_autosize.pyR
s	2	#0				cC`st�}|j�dS(sE
    Apply volume autosize operations from playbook
    :return:
    N(R
Ro(tobj((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_volume_autosize.pytmain_s	t__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtsysRiRHtansible.module_utils.netapptmodule_utilstnetappR-t"ansible.module_utils.netapp_moduleR	tansible.module_utils.basicR
Rtansible.module_utils._textRthas_netapp_libR9tobjectR
RsRp(((s[/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_volume_autosize.pyt<module>s(


J�		

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