Skip to content
This repository has been archived by the owner on Feb 24, 2022. It is now read-only.

Commit

Permalink
Sync bitbucket and GitHub
Browse files Browse the repository at this point in the history
  • Loading branch information
carchi8py committed Jan 6, 2021
1 parent 9a89e3b commit 8b9c7c3
Show file tree
Hide file tree
Showing 10 changed files with 439 additions and 126 deletions.
10 changes: 7 additions & 3 deletions ansible_collections/netapp/ontap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ Join our Slack Channel at [Netapp.io](http://netapp.io/slack)
### New Options
- na_ontap_cluster - `time_out` to wait for cluster creation, adding and removing a node.
- na_ontap_debug - connection diagnostics added for invalid ipaddress and DNS hostname errors.
- na_ontap_snapmirror - new option `create_destination` to automatically create destination endpoint (ONTAP 9.7).
- na_ontap_snapmirror - new option `destination_cluster` to automatically create destination SVM for SVM DR (ONTAP 9.7).
- na_ontap_snapmirror - new option `source_cluster` to automatically set SVM peering (ONTAP 9.7).
- na_ontap_lun - `total_size` and `total_size_unit` when using SAN application template.
- na_ontap_snapmirror - `create_destination` to automatically create destination endpoint (ONTAP 9.7).
- na_ontap_snapmirror - `destination_cluster` to automatically create destination SVM for SVM DR (ONTAP 9.7).
- na_ontap_snapmirror - `source_cluster` to automatically set SVM peering (ONTAP 9.7).

### Minor changes
- na_ontap_firmware_upgrade - Added a new 'storage' type as default firmware_type.
- na_ontap_info - deprecate ``state`` option.
- na_ontap_lun - support increasing lun_count and total_size when using SAN application template.
- na_ontap_quota - allow to turn quota on/off without providing quota_target or type.
- na_ontap_rest_info - deprecate ``state`` option.
- na_ontap_snapmirror - use REST API for create action if target supports it. (ZAPIs are still used for all other actions).
Expand All @@ -57,6 +59,8 @@ Join our Slack Channel at [Netapp.io](http://netapp.io/slack)
- na_ontap_snapmirror - wait up to 5 minutes for abort to complete before issuing a delete.
- na_ontap_snmp - SNMP module wrong access_control issue and error handling fix.
- na_ontap_volume - REST expects 'all' for tiering policy and not 'backup'.
- na_ontap_volume - detect and report error when attempting to change FlexVol into FlexGroup.
- na_ontap_volume - report error if ``aggregate_name`` option is used with a FlexGroup.

## 20.12.0

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
minor_changes:
- na_ontap_lun - support increasing lun_count and total_size when using SAN application template.
- na_ontap_lun - new options ``total_size`` and ``total_size_unit`` when using SAN application template.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bugfixes:
- na_ontap_volume - detect and report error when attempting to change FlexVol into FlexGroup.
- na_ontap_volume - report error if ``aggregate_name`` option is used with a FlexGroup.
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@ def get_modified_attributes(self, current, desired, get_list_diff=False):
modified_list = self.compare_lists(value, desired[key], get_list_diff) # get modified list from current and desired
if modified_list is not None:
modified[key] = modified_list
elif isinstance(value, dict):
modified_dict = self.get_modified_attributes(value, desired[key])
if modified_dict:
modified[key] = modified_dict
else:
try:
result = cmp(value, desired[key])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,25 +62,44 @@ def get_application_uuid(self):
dummy, error = self._set_application_uuid()
return self.app_uuid, error

def get_application_details(self):
def get_application_details(self, template=None):
"""Use REST application/applications to get application details"""
uuid, error = self.get_application_uuid()
if error:
return uuid, error
if uuid is None: # not found
return None, None
if template:
query = dict(fields='name,%s,statistics' % template)
else:
query = None
api = '/application/applications/%s' % uuid
response, error = self.rest_api.get(api)
response, error = self.rest_api.get(api, query)
return response, rrh.api_error(api, error)

def create_application(self, body):
"""Use REST application/applications san template to create one or more LUNs"""
self.fail_if_uuid()
dummy, error = self.fail_if_uuid()
if error is not None:
return dummy, error
api = '/application/applications'
query = {'return_timeout': 30, 'return_records': 'true'}
response, error = self.rest_api.post(api, body, params=query)
return rrh.check_for_error_and_job_results(api, response, error, self.rest_api)

def patch_application(self, body):
"""Use REST application/applications san template to add one or more LUNs"""
dummy, error = self.fail_if_no_uuid()
if error is not None:
return dummy, error
uuid, error = self.get_application_uuid()
if error is not None:
return dummy, error
api = '/application/applications/%s' % uuid
query = {'return_timeout': 30, 'return_records': 'true'}
response, error = self.rest_api.patch(api, body, params=query)
return rrh.check_for_error_and_job_results(api, response, error, self.rest_api)

def create_application_body(self, template_name, template_body, smart_container=True):
if not isinstance(smart_container, bool):
error = "expecting bool value for smart_container, got: %s" % smart_container
Expand All @@ -95,7 +114,9 @@ def create_application_body(self, template_name, template_body, smart_container=

def delete_application(self):
"""Use REST application/applications to delete app"""
self.fail_if_no_uuid()
dummy, error = self.fail_if_no_uuid()
if error is not None:
return dummy, error
api = '/application/applications/%s' % self.app_uuid
query = {'return_timeout': 30}
response, error = self.rest_api.delete(api, params=query)
Expand All @@ -105,7 +126,9 @@ def delete_application(self):

def get_application_components(self):
"""Use REST application/applications to get application components"""
self.fail_if_no_uuid()
dummy, error = self.fail_if_no_uuid()
if error is not None:
return dummy, error
api = '/application/applications/%s/components' % self.app_uuid
response, error = self.rest_api.get(api)
return response, rrh.api_error(api, error)
Expand All @@ -114,7 +137,9 @@ def get_application_component_uuid(self):
"""Use REST application/applications to get component uuid
Assume a single component per application
"""
self.fail_if_no_uuid()
dummy, error = self.fail_if_no_uuid()
if error is not None:
return dummy, error
response, error = self.get_application_components()
record, error = rrh.check_for_0_or_1_records(None, response, error, None)
if error is None and record is not None:
Expand All @@ -123,7 +148,9 @@ def get_application_component_uuid(self):

def get_application_component_details(self, comp_uuid=None):
"""Use REST application/applications to get application components"""
self.fail_if_no_uuid()
dummy, error = self.fail_if_no_uuid()
if error is not None:
return dummy, error
if comp_uuid is None:
# assume a single component
comp_uuid, error = self.get_application_component_uuid()
Expand All @@ -141,7 +168,9 @@ def get_application_component_backing_storage(self):
Assume a single component per application
"""
self.fail_if_no_uuid()
dummy, error = self.fail_if_no_uuid()
if error is not None:
return dummy, error
response, error = self.get_application_component_details()
if error or response is None:
return response, error
Expand All @@ -152,9 +181,11 @@ def fail_if_no_uuid(self):
if self.app_uuid is None:
msg = 'function should not be called before application uuid is set.'
return None, msg
return None, None

def fail_if_uuid(self):
"""Prevent a logic error."""
if self.app_uuid is not None:
msg = 'function should not be called when application uuid is set.'
return None, msg
return None, None
Loading

0 comments on commit 8b9c7c3

Please sign in to comment.