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_svm.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_bys�

module: na_ontap_svm

short_description: NetApp ONTAP SVM
extends_documentation_fragment:
    - netapp.na_ontap
version_added: '2.6'
author: NetApp Ansible Team (@carchi8py) <[email protected]>

description:
- Create, modify or delete SVM on NetApp ONTAP

options:

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

  name:
    description:
    - The name of the SVM to manage.
    required: true

  from_name:
    description:
    - Name of the SVM to be renamed
    version_added: '2.7'

  root_volume:
    description:
    - Root volume of the SVM.
    - Cannot be modified after creation.

  root_volume_aggregate:
    description:
    - The aggregate on which the root volume will be created.
    - Cannot be modified after creation.

  root_volume_security_style:
    description:
    -   Security Style of the root volume.
    -   When specified as part of the vserver-create,
        this field represents the security style for the Vserver root volume.
    -   When specified as part of vserver-get-iter call,
        this will return the list of matching Vservers.
    -   The 'unified' security style, which applies only to Infinite Volumes,
        cannot be applied to a Vserver's root volume.
    -   Cannot be modified after creation.
    choices: ['unix', 'ntfs', 'mixed', 'unified']

  allowed_protocols:
    description:
    - Allowed Protocols.
    - When specified as part of a vserver-create,
      this field represent the list of protocols allowed on the Vserver.
    - When part of vserver-get-iter call,
      this will return the list of Vservers
      which have any of the protocols specified
      as part of the allowed-protocols.
    - When part of vserver-modify,
      this field should include the existing list
      along with new protocol list to be added to prevent data disruptions.
    - Possible values
    - nfs   NFS protocol,
    - cifs   CIFS protocol,
    - fcp   FCP protocol,
    - iscsi   iSCSI protocol,
    - ndmp   NDMP protocol,
    - http   HTTP protocol,
    - nvme   NVMe protocol

  aggr_list:
    description:
    - List of aggregates assigned for volume operations.
    - These aggregates could be shared for use with other Vservers.
    - When specified as part of a vserver-create,
      this field represents the list of aggregates
      that are assigned to the Vserver for volume operations.
    - When part of vserver-get-iter call,
      this will return the list of Vservers
      which have any of the aggregates specified as part of the aggr list.

  ipspace:
    description:
    - IPSpace name
    - Cannot be modified after creation.
    version_added: '2.7'


  snapshot_policy:
    description:
    - Default snapshot policy setting for all volumes of the Vserver.
      This policy will be assigned to all volumes created in this
      Vserver unless the volume create request explicitly provides a
      snapshot policy or volume is modified later with a specific
      snapshot policy. A volume-level snapshot policy always overrides
      the default Vserver-wide snapshot policy.
    version_added: '2.7'

  language:
    description:
    - Language to use for the SVM
    - Default to C.UTF-8
    - Possible values   Language
    - c                 POSIX
    - ar                Arabic
    - cs                Czech
    - da                Danish
    - de                German
    - en                English
    - en_us             English (US)
    - es                Spanish
    - fi                Finnish
    - fr                French
    - he                Hebrew
    - hr                Croatian
    - hu                Hungarian
    - it                Italian
    - ja                Japanese euc-j
    - ja_v1             Japanese euc-j
    - ja_jp.pck         Japanese PCK (sjis)
    - ja_jp.932         Japanese cp932
    - ja_jp.pck_v2      Japanese PCK (sjis)
    - ko                Korean
    - no                Norwegian
    - nl                Dutch
    - pl                Polish
    - pt                Portuguese
    - ro                Romanian
    - ru                Russian
    - sk                Slovak
    - sl                Slovenian
    - sv                Swedish
    - tr                Turkish
    - zh                Simplified Chinese
    - zh.gbk            Simplified Chinese (GBK)
    - zh_tw             Traditional Chinese euc-tw
    - zh_tw.big5        Traditional Chinese Big 5
    version_added: '2.7'

  subtype:
    description:
    - The subtype for vserver to be created.
    - Cannot be modified after creation.
    choices: ['default', 'dp_destination', 'sync_source', 'sync_destination']
    version_added: '2.7'

  comment:
    description:
    - When specified as part of a vserver-create, this field represents the comment associated with the Vserver.
    - When part of vserver-get-iter call, this will return the list of matching Vservers.
    version_added: '2.8'
sI

    - name: Create SVM
      na_ontap_svm:
        state: present
        name: ansibleVServer
        root_volume: vol1
        root_volume_aggregate: aggr1
        root_volume_security_style: mixed
        hostname: "{{ netapp_hostname }}"
        username: "{{ netapp_username }}"
        password: "{{ netapp_password }}"

t
N(t
AnsibleModule(t	to_native(tNetAppModuletNetAppOntapSVMcB`sbeZd�Zd	d�Zd�Zd�Zd�Zd�Zd	e	d�Z
d�Zd�ZRS(
c C`s�tj�|_|jjtdtdtdddgdd�dtdtdd	�d
tdtdd	�dtdd	�dtdd	�d
tdd	dddddg�dtdd�dtdd�dtdd	dt�dtdd	dt�dtdd	dt�dtdddddg�dtdd	dt��
�td|jdt�|_t	�|_
|j
j|jj�|_
ttkr�|jjdd �ntjd!|j�|_dS("Ntstatetrequiredtchoicestpresenttabsenttdefaulttnamettypetstrt	from_nametroot_volumetroot_volume_aggregatetroot_volume_security_styletunixtntfstmixedtunifiedtallowed_protocolstlistt	aggr_listtipspacetsnapshot_policytlanguagetsubtypetdp_destinationtsync_sourcetsync_destinationtcommentt
argument_spectsupports_check_modetmsgs(the python NetApp-Lib module is requiredtmodule(tnetapp_utilstna_ontap_host_argument_specR)tupdatetdicttFalsetTrueR	R,Rt	na_helpertset_parameterstparamst
parameterstHAS_NETAPP_LIBt	fail_jsontsetup_na_ontap_zapitserver(tself((sO/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_svm.pyt__init__�s8	
cC`s8|dkr|jd}ntjjd�}tjjjdi|d6�}tjjd�}|j|�|j|�|jj|dt	�}d}|j
d�r4t|jd��dkr4|j
d	�}|j
d�}t
�}|j
d
�}	|	dk	r6|	j�}
x$|
D]}|j|j��qWnt
�}|j
d�}
|
dk	r�|
j�}x$|D]}|j|j��qmWni|jd�d6|jd�d
6|jd�d6|jd�d6|jd�d6|d6|jd�d6|jd�d6|d6|jd�d6|jd�d6}n|S(s�
        Checks if vserver exists.

        :return:
            vserver object if vserver found
            None if vserver is not found
        :rtype: object/None
        Rsvserver-get-itersvserver-infosvserver-nametquerytenable_tunnelingsnum-recordsisattributes-lists	aggr-listsallowed-protocolssroot-volumeRsroot-volume-aggregateRsroot-volume-security-styleRsvserver-subtypeR$R R#ssnapshot-policyR"RR!R(N(tNoneR6R-tzapit	NaElementtcreate_node_with_childrentadd_child_elemR:tinvoke_successfullyR1tget_child_by_nametinttget_child_contentRtget_childrentappendtget_content(R;tvserver_nametvserver_infot
query_detailsR=tresulttvserver_detailstattributes_listR tget_listt
aggregatestaggrt	protocolsRt
get_protocolstprotocol((sO/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_svm.pytget_vserver�sN	

		
	
cC`s�i|jdd6}|j|dd�|j|dd�|j|dd�|j|d	d	�|j|d
d
�|j|dd�|j|d
d�|j|dd�tjjjd|�}y|jj|dt�WnOtjj	k
r/}|j
jdd|jdt|�fdt
j��nXt�}x4dD],}|jj|�r@|j|||<q@q@W|r�|j|�ndS(NRsvserver-nameRsroot-volumeRsroot-volume-aggregateRsroot-volume-security-styleR#R!R"ssnapshot-policyR$svserver-subtypeR(svserver-createR>R+sError provisioning SVM %s: %st	exceptionRR (sallowed_protocolss	aggr_list(R6tadd_parameter_to_dictR-R@RARBR:RDR1t
NaApiErrorR,R8R
t	tracebackt
format_excR0tgettmodify_vserver(R;toptionstvserver_createtetkey((sO/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_svm.pytcreate_vserver%s.	
cC`s�tjjjdi|jdd6�}y|jj|dt�WnOtjjk
r�}|j	j
dd|jdt|�fdtj
��nXdS(Nsvserver-destroyRsvserver-nameR>R+sError deleting SVM %s: %sRX(R-R@RARBR6R:RDR1RZR,R8R
R[R\(R;tvserver_deleteRa((sO/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_svm.pytdelete_vserver@scC`s�tjjjdi|jdd6|jdd6�}y|jj|dt�WnOtjjk
r�}|j	j
dd|jdt|�fd	tj
��nXdS(
Nsvserver-renameRsvserver-nameRsnew-nameR>R+sError renaming SVM %s: %sRX(R-R@RARBR6R:RDR1RZR,R8R
R[R\(R;tvserver_renameRa((sO/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_svm.pytrename_vserverLsc	C`s�tjjd�}|jd|jd�x,|D]$}|dkr\|jd|jd�n|dkr�|jd|jd�n|dkr�|jd|jd�n|dkr�tjjd�}x%|jdD]}|jd	|�q�W|j|�n|d
kr0tjjd�}x%|jd
D]}|jd|�q*W|j|�q0q0Wy|jj|d
t�WnOtjj	k
r�}|j
jdd|jdt|�fdt
j��nXdS(sR
        Modify vserver.
        :param modify: list of modify attributes
        svserver-modifysvserver-nameRR#R"R(Rsallowed-protocolsRVR s	aggr-lists	aggr-nameR>R+sError modifying SVM %s: %sRXN(R-R@RAt
add_new_childR6RCR:RDR1RZR,R8R
R[R\(	R;tmodifytvserver_modifyt	attributeRRVRRRSRa((sO/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_svm.pyR^Ys4
cC`so|dkr|}n|jj|�dk	rk|rRt|jj|��||<qk|jj|�||<ndS(s�
        add defined parameter (not None) to adict using key.
        :param adict: a dictionary.
        :param name: name in self.parameters.
        :param key:  key in adict.
        :param tostr: boolean.
        N(R?R6R]R(R;tadictRRbttostr((sO/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_svm.pyRYys	cC`s�|jd�|j�}d\}}|jjd�r_|jj|j|jd�|�}n|jj||j�}|jj||j�}xy|D]q}|dkr�|j	j
dd	|jd
|f�n|dkr�|jdj�dkrd
|jd<qq�q�W|jjr�|j	j
r&q�|r9|j�n|dkrR|j�q�|dkrk|j�q�|r�|j|�q�n|j	jd|jj�dS(s%Call create/modify/delete operations.tna_ontap_svmRRRRR$R!R+s*Error modifying SVM %s: can not modify %s.RR#sc.utf-8sc.utf_8tcreatetdeletetchangedN(NN(sroot_volumesroot_volume_aggregatesroot_volume_security_stylessubtypesipspace(tasup_log_for_cserverRWR?R6R]R3tis_rename_actiont
get_cd_actiontget_modified_attributesR,R8tlowerRqt
check_modeRgRcReR^t	exit_json(R;tcurrentt	cd_actiontrenameRiRk((sO/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_svm.pytapply�s2
(
'


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
        R,tvserverN(R-tget_cserverR:R9R,t
ems_log_event(R;t
event_nametresultstcserver((sO/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_svm.pyRr�sN(
t__name__t
__module__R<R?RWRcReRgR^R1RYR|Rr(((sO/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_svm.pyR�s	$7			
	 	 cC`st�}|j�dS(s&Apply vserver operations from playbookN(RR|(tv((sO/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_svm.pytmain�s	t__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR[tansible.module_utils.netapptmodule_utilstnetappR-tansible.module_utils.basicR	tansible.module_utils._textR
t"ansible.module_utils.netapp_moduleRthas_netapp_libR7tobjectRR�R�(((sO/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/na_ontap_svm.pyt<module>s"


��	

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