�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
m Z d d l m
Z
y* d d
l m Z d d l m Z e Z Wn e k
r� e Z n Xd � Z d � Z d � Z d � Z d � Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust 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( t hpe3par( t client( t
exceptionsc C` s1 | r- t j j | d } | | k r- t Sn t S( Nt set_sizes( R t
HPE3ParClientt RAID_MAPt Truet False( t raid_typet set_sizet set_size_array( ( sO /usr/lib/python2.7/site-packages/ansible/modules/storage/hpe3par/ss_3par_cpg.pyt validate_set_size� s
c C` st | d d k r9 | d r9 t j j | d d | d <n | d d k rp | d rp t t j | d � | d <n | S( Nt RAIDTypet
raid_valuet HA( t NoneR R R t getattr( t
ldlayout_dict( ( sO /usr/lib/python2.7/site-packages/ansible/modules/storage/hpe3par/ss_3par_cpg.pyt cpg_ldlayout_map� s c
C` ss y;t | | � s) t t d | | f f S| j | � s-g }
| ri t t j | � } i | d 6g }
n i | d 6| d 6| d 6|
d 6} t | � } | d k r� t j | � } n | d k r� t j | � } n | d k r� t j | � } n i | d 6| d 6| d 6| d
6| d 6} | j
| | � n
t t d f SWn$ t j
k
ra}
t t d
|
f SXt t d | f S( Ns# Set size %s not part of RAID set %st diskTypeR t setSizeR t diskPatternst domaint growthIncrementMiBt growthLimitMiBt usedLDWarningAlertMiBt LDLayouts CPG already presents CPG creation failed | %ss Created CPG %s successfully.( R R t cpgExistsR R R R R R
t convert_to_binary_multiplet createCPGR R t ClientException( t
client_objt cpg_nameR t growth_incrementt growth_limitt growth_warningR R t high_availabilityt disk_typet
disk_patternst ld_layoutt optionalt e( ( sO /usr/lib/python2.7/site-packages/ansible/modules/storage/hpe3par/ss_3par_cpg.pyt
create_cpg� sD
c C` sh y0 | j | � r"