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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddlm
Z
dd
ljjZej�Zdefd��YZd�Zedkr�e�nd
S(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiont
deprecatedtstatust	communitytsupported_bysh	

module: sf_volume_manager
deprecated:
  removed_in: "2.11"
  why: This Module has been replaced
  alternative: please use M(na_elementsw_volume)
short_description: Manage SolidFire volumes
extends_documentation_fragment:
    - netapp.solidfire
version_added: '2.3'
author: Sumit Kumar (@timuster) <[email protected]>
description:
- Create, destroy, or update volumes on SolidFire

options:

    state:
        description:
        - Whether the specified volume should exist or not.
        required: true
        choices: ['present', 'absent']

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

    account_id:
        description:
        - Account ID for the owner of this volume.
        required: true

    512emulation:
        description:
        - Should the volume provide 512-byte sector emulation?
        - Required when C(state=present)

    qos:
        description: Initial quality of service settings for this volume. Configure as dict in playbooks.

    attributes:
        description: A YAML dictionary of attributes that you would like to apply on this volume.

    volume_id:
        description:
        - The ID of the volume to manage or update.
        - In order to create multiple volumes with the same name, but different volume_ids, please declare the I(volume_id)
          parameter with an arbitrary value. However, the specified volume_id will not be assigned to the newly created
          volume (since it's an auto-generated property).

    size:
        description:
        - The size of the volume in (size_unit).
        - Required when C(state = present).

    size_unit:
        description:
        - The unit used to interpret the size parameter.
        choices: ['bytes', 'b', 'kb', 'mb', 'gb', 'tb', 'pb', 'eb', 'zb', 'yb']
        default: 'gb'

    access:
        description:
        - "Access allowed for the volume."
        - "readOnly: Only read operations are allowed."
        - "readWrite: Reads and writes are allowed."
        - "locked: No reads or writes are allowed."
        - "replicationTarget: Identify a volume as the target volume for a paired set of volumes. If the volume is not paired, the access status is locked."
        - "If unspecified, the access settings of the clone will be the same as the source."
        choices: ['readOnly', 'readWrite', 'locked', 'replicationTarget']

s~
   - name: Create Volume
     sf_volume_manager:
       hostname: "{{ solidfire_hostname }}"
       username: "{{ solidfire_username }}"
       password: "{{ solidfire_password }}"
       state: present
       name: AnsibleVol
       qos: {minIOPS: 1000, maxIOPS: 20000, burstIOPS: 50000}
       account_id: 3
       enable512e: False
       size: 1
       size_unit: gb

   - name: Update Volume
     sf_volume_manager:
       hostname: "{{ solidfire_hostname }}"
       username: "{{ solidfire_username }}"
       password: "{{ solidfire_password }}"
       state: present
       name: AnsibleVol
       account_id: 3
       access: readWrite

   - name: Delete Volume
     sf_volume_manager:
       hostname: "{{ solidfire_hostname }}"
       username: "{{ solidfire_username }}"
       password: "{{ solidfire_password }}"
       state: absent
       name: AnsibleVol
       account_id: 2
sM

msg:
    description: Success message
    returned: success
    type: str

(t
AnsibleModule(t	to_nativeNtSolidFireVolumecB`s>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(c!C`sttj|_tj�|_|jjtdtdtdddg�dtdtdd�d	tdtdd
�dtddd
dg�dtdtdddd�dtdtdddd�dtdd
dd�dtdd
�dtdddddddddddddg
dd�d tdtdddddd!d"d#d$g��
�t
d%|jd&ddddgfgd't�|_|jj}|d|_
|d|_|d	|_|d|_|d|_|d|_|d|_|d|_|ddk	r |d|j|j|_n	d|_|d |_ttkrX|jjd(d)�ntjd*|j�|_dS(+Ntstatetrequiredtchoicestpresenttabsenttnamettypetstrt
account_idtintt
enable512etbooltaliasest512emulationtqostdicttdefaultt
attributest	volume_idtsizet	size_unittgbtbytestbtkbtmbttbtpbtebtzbtybtaccesstreadOnlyt	readWritetlockedtreplicationTargett
argument_spectrequired_iftsupports_check_modetmsgs)Unable to import the SolidFire Python SDKtmodule(tnetapp_utilstSF_BYTE_MAPt_size_unit_maptontap_sf_host_argument_specR/tupdateRtTruetFalsetNoneRR3tparamsRRRRRRRRRR*t
HAS_SF_SDKt	fail_jsontcreate_sf_connectiontsfe(tselftp((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/_sf_volume_manager.pyt__init__�sH	







	
cC`s�|jjd|j�}x�|jD]}}|j|jkr"|jdk	rw|j|jkr�t|j�dkr�|Sq�t|j�dkr�|j|_|Sq"q"WdS(s�
            Return volume object if found

            :return: Details about the volume. None if not found.
            :rtype: dict
        RtN(	R@tlist_volumes_for_accountRtvolumesRRR;Rtdelete_time(RAtvolume_listtvolume((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/_sf_volume_manager.pyt
get_volume�s'c
C`s�yG|jjd|jd|jd|jd|jd|jd|j�WnBtk
r�}|j	j
dd|j|jfd	t|��nXdS(
NRRt
total_sizeRRRR2s'Error provisioning volume %s of size %st	exception(R@t
create_volumeRRRRRRt	ExceptionR3R>R	(RAterr((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/_sf_volume_manager.pyRM�s				"cC`sZy|jjd|j�Wn9tk
rU}|jjdd|jdt|��nXdS(NRR2sError deleting volume %sRL(R@t
delete_volumeRRNR3R>R	(RARO((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/_sf_volume_manager.pyRP�s
cC`s�yD|jj|jd|jd|jd|jd|jd|j�Wn9tk
r}|j	j
dd|jdt|��nXdS(	NRR*RRKRR2sError updating volume %sRL(
R@t
modify_volumeRRR*RRRRNR3R>RR	(RARO((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/_sf_volume_manager.pyt
update_volume�s				cC`stt}t}t}|j�}|r�t}|jdkrBt}q�|jdkr�|jdk	r�|jdk	r�|j|jkr�t}t}q�|jdk	r�|jdk	r�|j|jkr�t}t}q�|jdk	r|jdk	r|j|jkrt}t}q�|jdk	rp|j|j	krpt
t|j|j	��}||j	dkr�t}t}q�q�|jdk	r�|jdk	r�|j|jkr�t}t}q�q�n|jdkr�t}nd}|rW|j
jr�d}qW|jdkr2|s|j�d}qT|rT|j�d}qTqW|jdkrW|j�d}qWn|j
jd	|d
|�dS(NRRg����MbP?RDsCheck mode, skipping changessVolume createdsVolume updatedsVolume deletedtchangedR2(R:RJR9RR*R;RRRKRtabstfloatRR3t
check_modeRMRRRPt	exit_json(RARSt
volume_existsRRt
volume_detailtsize_differencetresult_message((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/_sf_volume_manager.pytapply�sZ	0		0	!		
	

(t__name__t
__module__RCRJRMRPRRR\(((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/_sf_volume_manager.pyR
�s	7		
		
cC`st�}|j�dS(N(R
R\(tv((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/_sf_volume_manager.pytmain:s	t__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRtansible.module_utils._textR	tansible.module_utils.netapptmodule_utilstnetappR4t
has_sf_sdkR=tobjectR
R`R](((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/netapp/_sf_volume_manager.pyt<module>s


K"	�	

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