Fix bug when setting up a local vserver peer (#54257)

* Revert "changes to clusteR"

This reverts commit 33ee1b71e4bc8435fb315762a871f8c4cb6c5f80.

* Revert "changes to clusteR"

This reverts commit 33ee1b71e4bc8435fb315762a871f8c4cb6c5f80.

* Revert "Revert "changes to clusteR""

This reverts commit f1104a37b4.

* Revert "Revert "changes to clusteR""

This reverts commit f1104a37b4.

* Revert "documentation changes"

This reverts commit 02c369d0414fdff492d90865c903bdade3174261.

* fix bug

* Revert "Revert "documentation changes""

This reverts commit 496b91bebe.
pull/54863/head
Chris Archibald 6 years ago committed by John R Barker
parent 81deb8f132
commit 1c6bc5ed4a

@ -224,6 +224,12 @@ class NetAppONTAPVserverPeer(object):
% (self.parameters['vserver'], to_native(error)), % (self.parameters['vserver'], to_native(error)),
exception=traceback.format_exc()) exception=traceback.format_exc())
def is_remote_peer(self):
if self.parameters.get('dest_hostname') is None or \
(self.parameters['dest_hostname'] == self.parameters['hostname']):
return False
return True
def vserver_peer_accept(self): def vserver_peer_accept(self):
""" """
Accept a vserver peer at destination Accept a vserver peer at destination
@ -234,8 +240,6 @@ class NetAppONTAPVserverPeer(object):
'vserver-peer-accept', **{'peer-vserver': self.parameters['vserver'], 'vserver-peer-accept', **{'peer-vserver': self.parameters['vserver'],
'vserver': self.parameters['peer_vserver']}) 'vserver': self.parameters['peer_vserver']})
try: try:
# accept only if the peer relationship is on a remote cluster
if self.parameters.get('dest_hostname') is not None:
self.dest_server.invoke_successfully(vserver_peer_accept, enable_tunneling=True) self.dest_server.invoke_successfully(vserver_peer_accept, enable_tunneling=True)
except netapp_utils.zapi.NaApiError as error: except netapp_utils.zapi.NaApiError as error:
self.module.fail_json(msg='Error accepting vserver peer %s: %s' self.module.fail_json(msg='Error accepting vserver peer %s: %s'
@ -253,6 +257,8 @@ class NetAppONTAPVserverPeer(object):
cd_action = self.na_helper.get_cd_action(current, self.parameters) cd_action = self.na_helper.get_cd_action(current, self.parameters)
if cd_action == 'create': if cd_action == 'create':
self.vserver_peer_create() self.vserver_peer_create()
# accept only if the peer relationship is on a remote cluster
if self.is_remote_peer():
self.vserver_peer_accept() self.vserver_peer_accept()
elif cd_action == 'delete': elif cd_action == 'delete':
self.vserver_peer_delete() self.vserver_peer_delete()

Loading…
Cancel
Save