�
�Udac @` s2 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 y d d l
m Z m Z e
Z Wn e k
r� e Z n Xd d l m Z m Z d d
l m Z m Z m Z m Z e d � � Z e d � � Z e d � � Z e d � � Z e 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�
---
module: infini_vol
version_added: 2.3
short_description: Create, Delete or Modify volumes on Infinibox
description:
- This module creates, deletes or modifies volume on Infinibox.
author: Gregory Shulov (@GR360RY)
options:
name:
description:
- Volume Name
required: true
state:
description:
- Creates/Modifies volume when present or removes when absent
required: false
default: present
choices: [ "present", "absent" ]
size:
description:
- Volume size in MB, GB or TB units. See examples.
required: false
pool:
description:
- Pool that volume will reside on
required: true
extends_documentation_fragment:
- infinibox
requirements:
- capacity
s�
- name: Create new volume named foo under pool named bar
infini_vol:
name: foo
size: 1TB
pool: bar
state: present
user: admin
password: secret
system: ibox001
t
( t KiBt Capacity( t
AnsibleModulet missing_required_lib( t
HAS_INFINISDKt api_wrappert
get_systemt infinibox_argument_specc C` s7 y | j j d | j d � SWn t k
r2 d SXd S( s Return Pool or Nonet namet poolN( t poolst gett paramst Exceptiont None( t modulet system( ( sP /usr/lib/python2.7/site-packages/ansible/modules/storage/infinidat/infini_vol.pyt get_poolJ s
c C` s7 y | j j d | j d � SWn t k
r2 d SXd S( s Return Volume or NoneR N( t volumesR R R R ( R R ( ( sP /usr/lib/python2.7/site-packages/ansible/modules/storage/infinidat/infini_vol.pyt
get_volumeS s
c C` s� | j st | j j d | j d d t | | � � } | j d rt t | j d � j d t � } | j | � qt n | j d t
� d S( s
Create VolumeR R t sizei@ t changedN( t
check_modeR t createR R R
t roundupR t update_sizet exit_jsont True( R R t volumeR ( ( sP /usr/lib/python2.7/site-packages/ansible/modules/storage/infinidat/infini_vol.pyt
create_volume\ s +
c C` s~ t } | j d rj t | j d � j d t � } | j � | k rj | j s^ | j | � n t } qj n | j d | � d S( s
Update VolumeR i@ R N(
t FalseR R
R! R t get_sizeR R"