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_qos_policy_group.pyc

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddljj
ZddlmZdd
lmZddlmZej�Zdefd��YZd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys8
module: na_ontap_qos_policy_group
short_description: NetApp ONTAP manage policy group in Quality of Service.
extends_documentation_fragment:
  - netapp.na_ontap
version_added: '2.8'
author: NetApp Ansible Team (@carchi8py) <[email protected]>

description:
  - Create, destroy, modify, or rename QoS policy group on NetApp ONTAP.

options:
  state:
    choices: ['present', 'absent']
    description:
      - Whether the specified policy group should exist or not.
    default: 'present'

  name:
    description:
    - The name of the policy group to manage.

  vserver:
    description:
    - Name of the vserver to use.

  from_name:
    description:
    - Name of the existing policy group to be renamed to name.

  max_throughput:
    description:
    - Maximum throughput defined by this policy.

  min_throughput:
    description:
    - Minimum throughput defined by this policy.

  force:
    type: bool
    default: False
    description:
    - Setting to 'true' forces the deletion of the workloads associated with the policy group along with the policy group.
sQ
    - name: create qos policy group
      na_ontap_qos_policy_group:
        state: present
        name: policy_1
        vserver: policy_vserver
        max_throughput: 800KB/s,800iops
        min_throughput: 100iops
        hostname: 10.193.78.30
        username: admin
        password: netapp1!

    - name: modify qos policy group max throughput
      na_ontap_qos_policy_group:
        state: present
        name: policy_1
        vserver: policy_vserver
        max_throughput: 900KB/s,800iops
        min_throughput: 100iops
        hostname: 10.193.78.30
        username: admin
        password: netapp1!

    - name: delete qos policy group
      na_ontap_qos_policy_group:
        state: absent
        name: policy_1
        vserver: policy_vserver
        hostname: 10.193.78.30
        username: admin
        password: netapp1!

t
N(tNetAppModule(t
AnsibleModule(t	to_nativetNetAppOntapQosPolicyGroupcB`seeZdZd�Zd
d�Zd�Zd
d�Zd�Zd�Z	d�Z
d�Zd	�ZRS(s;
    Create, delete, modify and rename a policy group.
    cC`sMtj�|_|jjtdtdtdddddgdd�d	tdtdd�d
tdtdd�dtdtdd�dtdtdd�d
tdtdd�dtdtdddt���td|jdt�|_t	�|_
|j
j|jj�|_
ttkr1|jjdd�ntjd|j�|_dS(s>
        Initialize the Ontap qos policy group class.
        tstatetrequiredttypetstrtchoicestpresenttabsenttdefaulttnamet	from_nametvservertmax_throughputtmin_throughputtforcetboolt
argument_spectsupports_check_modetmsgs(the python NetApp-Lib module is requiredtmoduleN(tnetapp_utilstna_ontap_host_argument_specRtupdatetdicttFalsetTrueR
RR	t	na_helpertset_parameterstparamst
parameterstHAS_NETAPP_LIBt	fail_jsontsetup_na_ontap_zapitserver(tself((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_qos_policy_group.pyt__init__ns&'	
	cC`s=|dkr|jd}ntjjd�}tjjd�}|jd|�|jd|jd�tjjd�}|j|�|j|�|jj|t	�}d}|j
d�r9t|jd��dkr9|j
d	�j
d�}i|jd�d6|jd�d6|jd
�d6|jd�d
6}n|S(s�
        Return details of a policy group.
        :param policy_group_name: policy group name
        :return: policy group details.
        :rtype: dict.
        Rsqos-policy-group-get-itersqos-policy-group-infospolicy-groupRtquerysnum-recordsisattributes-listsmax-throughputRsmin-throughputRN(
tNoneR)R tzapit	NaElementt
add_new_childtadd_child_elemR-tinvoke_successfullyR%tget_child_by_nametinttget_child_content(R.tpolicy_group_nametpolicy_group_get_itertpolicy_group_infoR0tresulttpolicy_group_detailtpolicy_info((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_qos_policy_group.pytget_policy_group�s&

*cC`stjjd�}|jd|jd�|jd|jd�|jjd�rl|jd|jd�n|jjd�r�|jd|jd�ny|jj|t�WnOtjj	k
r}|j
jd	d
|jdt|�fdt
j��nXdS(
s-
        create a policy group name.
        sqos-policy-group-createspolicy-groupRRRsmax-throughputRsmin-throughputRs&Error creating qos policy group %s: %st	exceptionN(R R2R3R4R)tgetR-R6R%t
NaApiErrorRR+Rt	tracebackt
format_exc(R.tpolicy_groupterror((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_qos_policy_group.pytcreate_policy_group�scC`s�|dkr|jd}ntjjd�}|jd|�|jjd�rp|jdt|jd��ny|jj	|t
�WnHtjjk
r�}|jj
dd|t|�fdtj��nXdS(	sb
        delete an existing policy group.
        :param policy_group: policy group name.
        Rsqos-policy-group-deletespolicy-groupRRs&Error deleting qos policy group %s: %sRAN(R1R)R R2R3R4RBRR-R6R%RCRR+RRDRE(R.RFtpolicy_group_objRG((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_qos_policy_group.pytdelete_policy_group�s cC`s�tjjd�}|jd|jd�|jjd�rU|jd|jd�n|jjd�r�|jd|jd�ny|jj|t�WnOtjj	k
r�}|j
jdd	|jdt|�fd
t
j��nXdS(s&
        Modify policy group.
        sqos-policy-group-modifyspolicy-groupRRsmax-throughputRsmin-throughputRs'Error modifying qos policy group %s: %sRAN(R R2R3R4R)RBR-R6R%RCRR+RRDRE(R.RIRG((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_qos_policy_group.pytmodify_policy_group�scC`s�tjjd�}|jd|jd�|jd|jd�y|jj|t�WnOtjjk
r�}|j	j
dd|jdt|�fdtj
��nXd	S(
s+
        Rename policy group name.
        sqos-policy-group-renamesnew-nameRspolicy-group-nameRRs&Error renaming qos policy group %s: %sRAN(R R2R3R4R)R-R6R%RCRR+RRDRE(R.t
rename_objRG((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_qos_policy_group.pytrename_policy_group�scC`s4x-|j�D]}|dkr
|j�q
q
WdS(sc
        helper method to modify policy group.
        :param modify: modified attributes.
        RRN(smax_throughputsmin_throughput(tkeysRK(R.tmodifyt	attribute((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_qos_policy_group.pyt
modify_helper�scC`s%|jd�|j�}d\}}|jjd�r_|jj|j|jd�|�}n|jj||j�}|jj||j�}|jj	r|j
jr�q|r�|j�n|dkr�|j
�q|dkr�|j�q|r|j|�qn|j
jd|jj	�dS(s.
        Run module based on playbook
        tna_ontap_qos_policy_groupRtcreatetdeletetchangedN(NN(tasup_log_for_cserverR@R1R)RBR&tis_rename_actiont
get_cd_actiontget_modified_attributesRURt
check_modeRMRHRJRQt	exit_json(R.tcurrenttrenamet	cd_actionRO((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_qos_policy_group.pytapply�s&
(


cC`sAtj|j�}tjd|jd|�}tj||�dS(s�
        Fetch admin vserver for the given cluster
        Create and Autosupport log event with the given module name
        :param event_name: Name of the event log
        :return: None
        RRN(R tget_cserverR-R,Rt
ems_log_event(R.t
event_nametresultstcserver((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_qos_policy_group.pyRVsN(
t__name__t
__module__t__doc__R/R1R@RHRJRKRMRQR_RV(((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_qos_policy_group.pyRjs							cC`st�}|j�dS(s&Apply vserver operations from playbookN(RR_(tqos_policy_group((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_qos_policy_group.pytmains	t__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRDtansible.module_utils.netapptmodule_utilstnetappR t"ansible.module_utils.netapp_moduleR	tansible.module_utils.basicR
tansible.module_utils._textRthas_netapp_libR*tobjectRRiRe(((s\/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_qos_policy_group.pyt<module>s"


-"�	

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