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_volume_copy.pyo

�
�Udac@`s
ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	dZ
ddlZdd
lm
Z
ddlmZddlmZidd6dd6Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zedkre�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�

---
module: netapp_e_volume_copy
short_description: NetApp E-Series create volume copy pairs
description:
    - Create and delete snapshots images on volume groups for NetApp E-series storage arrays.
version_added: '2.2'
author: Kevin Hulquest (@hulquest)
extends_documentation_fragment:
    - netapp.eseries
options:
    api_username:
        required: true
        description:
        - The username to authenticate with the SANtricity WebServices Proxy or embedded REST API.
    api_password:
        required: true
        description:
        - The password to authenticate with the SANtricity WebServices Proxy or embedded REST API.
    api_url:
        required: true
        description:
        - The url to the SANtricity WebServices Proxy or embedded REST API, for example C(https://prod-1.wahoo.acme.com/devmgr/v2).
    validate_certs:
        required: false
        default: true
        description:
        - Should https certificates be validated?
    source_volume_id:
        description:
            - The id of the volume copy source.
            - If used, must be paired with destination_volume_id
            - Mutually exclusive with volume_copy_pair_id, and search_volume_id
    destination_volume_id:
        description:
            - The id of the volume copy destination.
            - If used, must be paired with source_volume_id
            - Mutually exclusive with volume_copy_pair_id, and search_volume_id
    volume_copy_pair_id:
        description:
            - The id of a given volume copy pair
            - Mutually exclusive with destination_volume_id, source_volume_id, and search_volume_id
            - Can use to delete or check presence of volume pairs
            - Must specify this or (destination_volume_id and source_volume_id)
    state:
        description:
            - Whether the specified volume copy pair should exist or not.
        required: True
        choices: ['present', 'absent']
    create_copy_pair_if_does_not_exist:
        description:
            - Defines if a copy pair will be created if it does not exist.
            - If set to True destination_volume_id and source_volume_id are required.
        type: bool
        default: True
    start_stop_copy:
        description:
            - starts a re-copy or stops a copy in progress
            - "Note: If you stop the initial file copy before it it done the copy pair will be destroyed"
            - Requires volume_copy_pair_id
    search_volume_id:
        description:
            - Searches for all valid potential target and source volumes that could be used in a copy_pair
            - Mutually exclusive with volume_copy_pair_id, destination_volume_id and source_volume_id
t
s�
---
msg:
    description: Success message
    returned: success
    type: str
    sample: Json facts for the volume copy that was created.
sx
msg:
    description: Success message
    returned: success
    type: str
    sample: Created Volume Copy Pair with ID
N(t
AnsibleModule(t	to_native(trequestsapplication/jsonsContent-TypetAcceptc
C`s�d|d}|d|}t|ddd|dd|d	d
td|d�\}}d}xF|D]>}|d|d
kre|d|d
kr�|d}q�qeqeW|S(Ns#storage-systems/%s/volume-copy-jobstssidtapi_urltmethodtGETturl_usernametapi_usernameturl_passwordtapi_passwordtheaderstvalidate_certstsourceVolumetsource_volume_idtid(RtHEADERStNone(tparamst
get_statusturltrctresptvolume_copy_pair_idtpotential_copy_pair((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_volume_copy.pytHfind_volume_copy_pair_id_from_source_volume_id_and_destination_volume_idns
cC`s�d|d}|d|}i|dd6|dd6}t|dtj|�d	td
dd|d
d|ddtd|d�\}}|dkr�t||ffSt||ffSdS(Ns#storage-systems/%s/volume-copy-jobsR
RRtsourceIdtdestination_volume_idttargetIdtdatat
ignore_errorsRtPOSTRRRRRRi�(RtjsontdumpstTrueRtFalse(RRRtrDataRR ((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_volume_copy.pytcreate_copy_pairs$cC`s�d|d|df}|d|}t|dtddd|d	d
|ddtd
|d
�\}}|dkr�t||ffSt||ffSdS(Ns?storage-systems/%s/volume-copy-jobs/%s?retainRepositories=falseR
R!RR(RtDELETERRRRRRi�(RR,RR-(RRRRR ((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_volume_copy.pyt delete_copy_pair_by_copy_pair_id�scC`s�d|d|df}|d|}t|dtddd|d	d
|ddtd
|d
�\}}|dkr�t||ffSt||ffSdS(Ns?storage-systems/%s/volume-copy-jobs/%s?retainRepositories=falseR
R!RR(RR0RRRRRRi�(RR,RR-(RRRRR ((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_volume_copy.pyt/find_volume_copy_pair_id_by_volume_copy_pair_id�scC`s�d|d|d|df}|d|}t|dtddd	|d
d|dd
td|d�\}}|dkr�t|ddfSt|fSdS(Ns9storage-systems/%s/volume-copy-jobs-control/%s?control=%sR
R!tstart_stop_copyRR(RR)RRRRRRi�itpercentComplete(RR,RR-(RRRt
response_codet
response_data((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_volume_copy.pyR3�scC`s�d|d|df}|d|}t|dtddd|d	d
|ddtd
|d
�\}}|dkr�|ddkr�t|dfSt|dfSn
t|fSdS(Ns.storage-systems/%s/volume-copy-jobs-control/%sR
R!RR(RRRRRRRRi�R4i����(RR,RR-(RRRR5R6((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_volume_copy.pytcheck_copy_status�sc
C`sqd|d}|d|}t|dtddd|dd	|d
dtd|d�\}}|d
kr]d}g}x<|D]4}|d|dkr�|d}q}|j|�q}Wg}g}	x�|D]�}|d|kr|dtkrO|dtkr|	j|d�qqOq�|dtkr�|dtkrO|j|d�qOq�q�W|	|fStd|��dS(Nsstorage-systems/%s/volumesR
RR(RRRRRRRRi�Rtsearch_volume_idtcapacitytvolumeCopyTargettvolumeCopySources
Response [%s](RR,RRtappendR-t	Exception(
RRRR5R6tsource_capacityt
candidatestvolumetpotential_sourcestpotential_targets((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_volume_copy.pyt(find_valid_copy_pair_targets_and_sources�s2



c%C`s�tdtdtdd�dtdd�dtdtdd	dd
�dtdtdd�dtdt�d
tdt�dtdtdt�dtdtdt�dtdtdtdd�dtdtdtdd�dtdd�dtdtdddgdd�dtdtdtdd�dtdtdddgdd�dtdd��dddgddgddgddgddggdddggd dtddggdddggdddggg�}|j}|djd!�s|dcd!7<n|ddk	r�yt|�\}}Wn-tk
rU}|j	d"d#t
|��nX|jd$td"d%t|�t|�fd|dd&|d'|�n|ddks�|ddkr�t
|�\}}|ddkrp|tkr|jd$td"d(d|dd)|�q�t|�\}}|tkrY|jd$td"d(d|dd)|�q�|j	d"d*|�q�|tkr�|jd$td"d+d|d�q�t|�\}}|tkr�|jd$td"d,d|d�q�|j	d"d-|�n|ddkr/|ddkr*t|�|d<n|ddkr�t|�\}	\}
}|	tkr|jd$td"d.|d/�q|j	d"d0|
|f�n�t|�\}\}
}|r�|jd$td"d1|d�nA|
d2kr|j	d"d3|d�n|j	d"d4|
|f�|j	d"d5�n�|ddkrRt|�|d<nt|�\}\}}|tkr�|jd$td"d6|d�nG|d2kr�|jd$td"d7|d�n|j	d"d8||f�dS(9Nt
argument_specRttypetstrR%t
copy_prioritytrequiredtdefaultitintR
RRRtno_logRttargetWriteProtectedtboolt
onlineCopyR!Rtchoicestpresenttabsentt"create_copy_pair_if_does_not_existR3tstarttstopR8tmutually_exclusivetrequired_togethertrequired_ift/tmsgs5Failed to find valid copy pair candidates. Error [%s]tchangeds> Valid source devices found: %s Valid target devices found: %st
valid_targetst
valid_sourcess"Volume Copy Pair copy has started.tpercent_dones*Could not start volume copy pair Error: %ss!Volume Copy Pair copy is stopped.s'Volume Copy Pair copy has been stopped.s)Could not stop volume copy pair Error: %ss$Created Volume Copy Pair with ID: %sRs4Could not create volume copy pair Code: %s Error: %ss$ Volume Copy Pair with ID: %s existsi�so Volume Copy Pair with ID: %s does not exist. Can not create without source_volume_id and destination_volume_ids2Could not find volume copy pair Code: %s Error: %stDones) Volume Copy Pair with ID: %s was deleteds, Volume Copy Pair with ID: %s does not exists4Could not delete volume copy pair Code: %s Error: %s(R	tdictR-R,RtendswithRRCR=t	fail_jsonR
t	exit_jsontlenR7R3R#R/R2R1(tmoduleRRBRAtetcurrenty_runningtstatus_infotstart_statustinfotcopy_began_statusRR texist_statustexist_status_codetexist_status_datat
delete_statustdelete_status_codetdelete_status_data((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_volume_copy.pytmain�s�!!					

 !	t__main__(t
__future__RRRREt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtRESULTStEXAMPLEStRETURNR*tansible.module_utils.basicR	tansible.module_utils._textR
tansible.module_utils.netappRRR#R/R1R2R3R7RCRqt__name__(((sW/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/netapp_e_volume_copy.pyt<module>s2


C
							%	�

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