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

Add support for FlexCache to na_ontap_vserver_peer #52301

Merged
merged 5 commits into from
Mar 4, 2019
Merged
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
14 changes: 11 additions & 3 deletions lib/ansible/modules/storage/netapp/na_ontap_vserver_peer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python

# (c) 2018, NetApp, Inc
# (c) 2018-2019, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
Expand All @@ -27,9 +27,10 @@
description:
- Specifies name of the source Vserver in the relationship.
applications:
choices: ['snapmirror', 'file_copy', 'lun_copy']
choices: ['snapmirror', 'file_copy', 'lun_copy', 'flexcache']
description:
- List of applications which can make use of the peering relationship.
- FlexCache supported from ONTAP 9.5 onwards.
peer_vserver:
description:
- Specifies name of the peer Vserver in the relationship.
Expand All @@ -54,6 +55,7 @@
'''

EXAMPLES = """

- name: Source vserver peer create
na_ontap_vserver_peer:
state: present
Expand All @@ -65,6 +67,7 @@
username: "{{ netapp_username }}"
password: "{{ netapp_password }}"
dest_hostname: "{{ netapp_dest_hostname }}"

- name: vserver peer delete
na_ontap_vserver_peer:
state: absent
Expand Down Expand Up @@ -100,7 +103,7 @@ def __init__(self):
vserver=dict(required=True, type='str'),
peer_vserver=dict(required=True, type='str'),
peer_cluster=dict(required=False, type='str'),
applications=dict(required=False, type='list', choices=['snapmirror', 'file_copy', 'lun_copy']),
applications=dict(required=False, type='list', choices=['snapmirror', 'file_copy', 'lun_copy', 'flexcache']),
dest_hostname=dict(required=False, type='str'),
dest_username=dict(required=False, type='str'),
dest_password=dict(required=False, type='str', no_log=True)
Expand Down Expand Up @@ -128,6 +131,8 @@ def __init__(self):
if self.parameters.get('dest_password'):
self.module.params['password'] = self.parameters['dest_password']
self.dest_server = netapp_utils.setup_na_ontap_zapi(module=self.module)
# reset to source host connection for asup logs
self.module.params['hostname'] = self.parameters['hostname']

def vserver_peer_get_iter(self):
"""
Expand Down Expand Up @@ -240,6 +245,9 @@ def apply(self):
"""
Apply action to create/delete or accept vserver peer
"""
results = netapp_utils.get_cserver(self.server)
cserver = netapp_utils.setup_na_ontap_zapi(module=self.module, vserver=results)
netapp_utils.ems_log_event("na_ontap_vserver_peer", cserver)
current = self.vserver_peer_get()
cd_action = self.na_helper.get_cd_action(current, self.parameters)
if cd_action == 'create':
Expand Down