Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport/2.7/47621 #48129

Merged
merged 2 commits into from
Nov 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- Fixes issues with source and destination location for na_ontap_snapmirror
22 changes: 15 additions & 7 deletions lib/ansible/modules/storage/netapp/na_ontap_snapmirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
DOCUMENTATION = '''
author: NetApp Ansible Team (ng-ansibleteam@netapp.com)
description:
- Create/Delete/Initialize/Modify SnapMirror volume/vserver relationships
- Create/Delete/Initialize SnapMirror volume/vserver relationships
- Modify schedule for a SnapMirror relationship
extends_documentation_fragment:
- netapp.ontap
module: na_ontap_snapmirror
Expand Down Expand Up @@ -83,6 +84,7 @@
na_ontap_snapmirror:
state: absent
destination_path: <path>
source_hostname: "{{ source_hostname }}"
hostname: "{{ netapp_hostname }}"
username: "{{ netapp_username }}"
password: "{{ netapp_password }}"
Expand Down Expand Up @@ -222,19 +224,22 @@ def delete_snapmirror(self):
Delete a SnapMirror relationship
#1. Quiesce the SnapMirror relationship at destination
#2. Break the SnapMirror relationship at the source
#3. Release the SnapMirror at destination
#3. Release the SnapMirror at source
#4. Delete SnapMirror at destination
"""
if not self.parameters.get('source_hostname'):
self.module.fail_json(msg='Missing parameters for delete: Please specify the '
'source cluster to release the SnapMirror relation')
'source cluster hostname to release the SnapMirror relation')
if self.parameters.get('source_username'):
self.module.params['username'] = self.parameters['dest_username']
self.module.params['username'] = self.parameters['source_username']
if self.parameters.get('source_password'):
self.module.params['password'] = self.parameters['dest_password']
self.module.params['password'] = self.parameters['source_password']
self.module.params['hostname'] = self.parameters['source_hostname']
self.source_server = netapp_utils.setup_ontap_zapi(module=self.module)
self.snapmirror_quiesce()
self.snapmirror_break()
if self.parameters.get('relationship_type') and \
self.parameters.get('relationship_type') not in ['load_sharing', 'vault']:
self.snapmirror_break()
if self.get_destination():
self.snapmirror_release()
self.snapmirror_delete()
Expand Down Expand Up @@ -325,7 +330,9 @@ def snapmirror_initialize(self):
initialize_zapi = 'snapmirror-initialize'
if self.parameters.get('relationship_type') and self.parameters['relationship_type'] == 'load_sharing':
initialize_zapi = 'snapmirror-initialize-ls-set'
options = {'destination-location': self.parameters['destination_path']}
options = {'source-location': self.parameters['source_path']}
else:
options = {'destination-location': self.parameters['destination_path']}
snapmirror_init = netapp_utils.zapi.NaElement.create_node_with_children(
initialize_zapi, **options)
try:
Expand Down Expand Up @@ -411,6 +418,7 @@ def apply(self):
current = self.snapmirror_get()
cd_action = self.na_helper.get_cd_action(current, self.parameters)
modify = self.na_helper.get_modified_attributes(current, self.parameters)

if cd_action == 'create':
self.snapmirror_create()
elif cd_action == 'delete':
Expand Down