|
|
@ -20,6 +20,8 @@ description:
|
|
|
|
- Create and delete snapshots images on volume groups for NetApp E-series storage arrays.
|
|
|
|
- Create and delete snapshots images on volume groups for NetApp E-series storage arrays.
|
|
|
|
version_added: '2.2'
|
|
|
|
version_added: '2.2'
|
|
|
|
author: Kevin Hulquest (@hulquest)
|
|
|
|
author: Kevin Hulquest (@hulquest)
|
|
|
|
|
|
|
|
extends_documentation_fragment:
|
|
|
|
|
|
|
|
- netapp.eseries
|
|
|
|
options:
|
|
|
|
options:
|
|
|
|
api_username:
|
|
|
|
api_username:
|
|
|
|
required: true
|
|
|
|
required: true
|
|
|
@ -97,8 +99,7 @@ import json
|
|
|
|
|
|
|
|
|
|
|
|
from ansible.module_utils.basic import AnsibleModule
|
|
|
|
from ansible.module_utils.basic import AnsibleModule
|
|
|
|
from ansible.module_utils.pycompat24 import get_exception
|
|
|
|
from ansible.module_utils.pycompat24 import get_exception
|
|
|
|
from ansible.module_utils.urls import open_url
|
|
|
|
from ansible.module_utils.netapp import request
|
|
|
|
from ansible.module_utils.six.moves.urllib.error import HTTPError
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HEADERS = {
|
|
|
|
HEADERS = {
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
"Content-Type": "application/json",
|
|
|
@ -106,38 +107,6 @@ HEADERS = {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def request(url, data=None, headers=None, method='GET', use_proxy=True,
|
|
|
|
|
|
|
|
force=False, last_mod_time=None, timeout=10, validate_certs=True,
|
|
|
|
|
|
|
|
url_username=None, url_password=None, http_agent=None, force_basic_auth=True, ignore_errors=False):
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
r = open_url(url=url, data=data, headers=headers, method=method, use_proxy=use_proxy,
|
|
|
|
|
|
|
|
force=force, last_mod_time=last_mod_time, timeout=timeout, validate_certs=validate_certs,
|
|
|
|
|
|
|
|
url_username=url_username, url_password=url_password, http_agent=http_agent,
|
|
|
|
|
|
|
|
force_basic_auth=force_basic_auth)
|
|
|
|
|
|
|
|
except HTTPError:
|
|
|
|
|
|
|
|
err = get_exception()
|
|
|
|
|
|
|
|
r = err.fp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
raw_data = r.read()
|
|
|
|
|
|
|
|
if raw_data:
|
|
|
|
|
|
|
|
data = json.loads(raw_data)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
raw_data = None
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
if ignore_errors:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
raise Exception(raw_data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
resp_code = r.getcode()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if resp_code >= 400 and not ignore_errors:
|
|
|
|
|
|
|
|
raise Exception(resp_code, data)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
return resp_code, data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def find_volume_copy_pair_id_from_source_volume_id_and_destination_volume_id(params):
|
|
|
|
def find_volume_copy_pair_id_from_source_volume_id_and_destination_volume_id(params):
|
|
|
|
get_status = 'storage-systems/%s/volume-copy-jobs' % params['ssid']
|
|
|
|
get_status = 'storage-systems/%s/volume-copy-jobs' % params['ssid']
|
|
|
|
url = params['api_url'] + get_status
|
|
|
|
url = params['api_url'] + get_status
|
|
|
|