Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/storage/hpe3par/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/storage/hpe3par/ss_3par_cpg.pyo

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddlm
Z
y*dd
lmZddlmZeZWnek
r�eZnXd�Zd�Zd�Zd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
---
short_description: Manage HPE StoreServ 3PAR CPG
author:
  - Farhan Nomani (@farhan7500)
  - Gautham P Hegde (@gautamphegde)
description:
  - Create and delete CPG on HPE 3PAR.
module: ss_3par_cpg
options:
  cpg_name:
    description:
      - Name of the CPG.
    type: str
    required: true
  disk_type:
    choices:
      - FC
      - NL
      - SSD
    description:
      - Specifies that physical disks must have the specified device type.
    type: str
  domain:
    description:
      - Specifies the name of the domain in which the object will reside.
    type: str
  growth_increment:
    description:
      - Specifies the growth increment(in MiB, GiB or TiB) the amount of logical disk storage
       created on each auto-grow operation.
    type: str
  growth_limit:
    description:
      - Specifies that the autogrow operation is limited to the specified
       storage amount that sets the growth limit(in MiB, GiB or TiB).
    type: str
  growth_warning:
    description:
      - Specifies that the threshold(in MiB, GiB or TiB) of used logical disk space when exceeded
       results in a warning alert.
    type: str
  high_availability:
    choices:
      - PORT
      - CAGE
      - MAG
    description:
      - Specifies that the layout must support the failure of one port pair,
       one cage, or one magazine.
    type: str
  raid_type:
    choices:
      - R0
      - R1
      - R5
      - R6
    description:
      - Specifies the RAID type for the logical disk.
    type: str
  set_size:
    description:
      - Specifies the set size in the number of chunklets.
    type: int
  state:
    choices:
      - present
      - absent
    description:
      - Whether the specified CPG should exist or not.
    required: true
    type: str
  secure:
    description:
      - Specifies whether the certificate needs to be validated while communicating.
    type: bool
    default: no
extends_documentation_fragment: hpe3par
version_added: '2.8'
s�
    - name: Create CPG sample_cpg
      ss_3par_cpg:
        storage_system_ip: 10.10.10.1
        storage_system_username: username
        storage_system_password: password
        state: present
        cpg_name: sample_cpg
        domain: sample_domain
        growth_increment: 32000 MiB
        growth_limit: 64000 MiB
        growth_warning: 48000 MiB
        raid_type: R6
        set_size: 8
        high_availability: MAG
        disk_type: FC
        secure: no

    - name: Delete CPG sample_cpg
      ss_3par_cpg:
        storage_system_ip: 10.10.10.1
        storage_system_username: username
        storage_system_password: password
        state: absent
        cpg_name: sample_cpg
        secure: no
t
(t
AnsibleModule(thpe3par(tclient(t
exceptionscC`s1|r-tjj|d}||kr-tSntS(Nt	set_sizes(Rt
HPE3ParClienttRAID_MAPtTruetFalse(t	raid_typetset_sizetset_size_array((sO/usr/lib/python2.7/site-packages/ansible/modules/storage/hpe3par/ss_3par_cpg.pytvalidate_set_size�s
cC`st|ddk	r9|dr9tjj|dd|d<n|ddk	rp|drpttj|d�|d<n|S(NtRAIDTypet
raid_valuetHA(tNoneRRRtgetattr(t
ldlayout_dict((sO/usr/lib/python2.7/site-packages/ansible/modules/storage/hpe3par/ss_3par_cpg.pytcpg_ldlayout_map�s	c
C`ssy;t||�s)ttd||ffS|j|�s-g}
|	rittj|	�}	i|	d6g}
ni|d6|d6|d6|
d6}t|�}|dk	r�tj	|�}n|dk	r�tj	|�}n|dk	r�tj	|�}ni|d6|d6|d	6|d
6|d6}|j
||�n
ttdfSWn$tj
k
ra}
ttd
|
fSXttd|fS(Ns#Set size %s not part of RAID set %stdiskTypeRtsetSizeRtdiskPatternstdomaintgrowthIncrementMiBtgrowthLimitMiBtusedLDWarningAlertMiBtLDLayoutsCPG already presentsCPG creation failed | %ssCreated CPG %s successfully.(RRt	cpgExistsRRRRRR
tconvert_to_binary_multiplet	createCPGRRtClientException(t
client_objtcpg_nameR tgrowth_incrementtgrowth_limittgrowth_warningRRthigh_availabilityt	disk_typet
disk_patternst	ld_layouttoptionalte((sO/usr/lib/python2.7/site-packages/ansible/modules/storage/hpe3par/ss_3par_cpg.pyt
create_cpg�sD

cC`shy0|j|�r"|j|�n
ttdfSWn$tjk
rV}ttd|fSXttd|fS(NsCPG does not existsCPG delete failed | %ssDeleted CPG %s successfully.(R%t	deleteCPGRRRR((R)R*R3((sO/usr/lib/python2.7/site-packages/ansible/modules/storage/hpe3par/ss_3par_cpg.pyt
delete_cpg�sc
C`sotdtj�dddgg�}ts=|jdd�nt|jd�dksot|jd�d	kr�|jdd
�n|jd}|jd}|jd
}|jd}|jd}|jd}|jd}|jd}|jd}	|jd}
|jd}|jd}|jd}
d|}ytj||
�}Wn�t	j
k
rq|jdd�nmt	jk
r�|jdd�nJt	jk
r�|jdd�n't
k
r�}|jdd|�nX|dks�|dkr	|jdd�n|dkr(|jdd�n|jddkr�zryD|j||�t|||||||	|
||�
\}}}Wn't
k
r�}|jdd|�nXWd|j�Xn~|jddkr<zZy,|j||�t||�\}}}Wn't
k
r)}|jdd|�nXWd|j�Xn|r[|jd |d|�n|jd|�dS(!Nt
argument_spectrequired_togetherRRtmsgsQthe python hpe3par_sdk library is required (https://pypi.org/project/hpe3par_sdk)R*iisECPG name must be at least 1 character and not more than 31 characterststorage_system_iptstorage_system_usernametstorage_system_passwordR R+R,R-R.R/tsecureshttps://%s:8080/api/v1sSSL Certificate FailedsConnection ErrorsUnsupported WSAPI versionsInitializing client failed. %ss+Storage system username or password is NonesCPG Name is NonetstatetpresentsCPG create failed | %stabsenttchanged(R	R
tcpg_argument_spectHAS_3PARCLIENTt	fail_jsontlentparamsRRRt
SSLCertFailedtConnectionErrortUnsupportedVersiont	ExceptionRtloginR4tlogoutR6t	exit_json(tmoduleR:R;R<R*R R+R,R-RRR.R/R=t	wsapi_urlR)R3t
return_statusRAR9((sO/usr/lib/python2.7/site-packages/ansible/modules/storage/hpe3par/ss_3par_cpg.pytmain�s�2













t__main__N(t
__future__RRRttypet
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicR	t$ansible.module_utils.storage.hpe3parR
thpe3par_sdkRt
hpe3parclientRRRCtImportErrorRRRR4R6RQt__name__(((sO/usr/lib/python2.7/site-packages/ansible/modules/storage/hpe3par/ss_3par_cpg.pyt<module>s,


R


		
	1	
	O

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