New options for identity_preserve (#60498)

* new option

* Force ansibot to run again
This commit is contained in:
Chris Archibald 2019-08-26 07:03:26 -07:00 committed by Jake Jackson
parent 930088da96
commit 53df4d8186
2 changed files with 25 additions and 2 deletions

View file

@ -88,6 +88,13 @@ options:
- Default is unlimited, it can be explicitly set to 0 as unlimited.
type: int
version_added: '2.9'
identity_preserve:
description:
- Specifies whether or not the identity of the source Vserver is replicated to the destination Vserver.
- If this parameter is set to true, the source Vserver's configuration will additionally be replicated to the destination.
- If the parameter is set to false, then only the source Vserver's volumes and RBAC configuration are replicated to the destination.
type: bool
version_added: '2.9'
short_description: "NetApp ONTAP or ElementSW Manage SnapMirror"
version_added: "2.7"
'''
@ -109,6 +116,17 @@ EXAMPLES = """
username: "{{ destination_cluster_username }}"
password: "{{ destination_cluster_password }}"
# creates and initializes the snapmirror between vservers
- name: Create ONTAP/ONTAP vserver SnapMirror
na_ontap_snapmirror:
state: present
source_vserver: ansible_src
destination_vserver: ansible_dest
identity_preserve: true
hostname: "{{ destination_cluster_hostname }}"
username: "{{ destination_cluster_username }}"
password: "{{ destination_cluster_password }}"
# existing snapmirror relation with status 'snapmirrored' will be initiailzed
- name: Inititalize ONTAP/ONTAP SnapMirror
na_ontap_snapmirror:
@ -217,7 +235,8 @@ class NetAppONTAPSnapmirror(object):
default='ontap_ontap'),
source_username=dict(required=False, type='str'),
source_password=dict(required=False, type='str', no_log=True),
max_transfer_rate=dict(required=False, type='int')
max_transfer_rate=dict(required=False, type='int'),
identity_preserve=dict(required=False, type='bool')
))
self.module = AnsibleModule(
@ -349,6 +368,8 @@ class NetAppONTAPSnapmirror(object):
snapmirror_create.add_new_child('policy', self.parameters['policy'])
if self.parameters.get('max_transfer_rate'):
snapmirror_create.add_new_child('max-transfer-rate', str(self.parameters['max_transfer_rate']))
if self.parameters.get('identity_preserve'):
snapmirror_create.add_new_child('identity-preserve', str(self.parameters['identity_preserve']))
try:
self.server.invoke_successfully(snapmirror_create, enable_tunneling=True)
self.snapmirror_initialize()

View file

@ -76,7 +76,8 @@ class MockONTAPConnection(object):
'source-location': 'ansible:ansible',
'relationship-status': status, 'policy': 'ansible',
'relationship-type': 'data_protection',
'max-transfer-rate': 1000},
'max-transfer-rate': 1000,
'identity-preserve': 'true'},
'snapmirror-destination-info': {'destination-location': 'ansible'}}}
xml.translate_struct(data)
return xml
@ -163,6 +164,7 @@ class TestMyModule(unittest.TestCase):
''' creating snapmirror and testing idempotency '''
data = self.set_default_args()
data['schedule'] = 'abc'
data['identity_preserve'] = True
set_module_args(data)
my_obj = my_module()
my_obj.asup_log_for_cserver = Mock(return_value=None)