Merge "NetApp API failed. Reason - 18177:Relationship is in use by SnapMirror in local cluster"

This commit is contained in:
Zuul 2023-10-13 20:43:37 +00:00 committed by Gerrit Code Review
commit 22e568d1d3
3 changed files with 42 additions and 11 deletions

View File

@ -558,7 +558,6 @@ class NetAppCmodeMultiSVMFileStorageLibrary(
node_network_info = zip(nodes, network_info['network_allocations'])
for node_name, network_allocation in node_network_info:
port = self._get_node_data_port(node_name)
vlan = network_allocation['segmentation_id']
network_mtu = network_allocation.get('mtu')
@ -741,12 +740,24 @@ class NetAppCmodeMultiSVMFileStorageLibrary(
super(NetAppCmodeMultiSVMFileStorageLibrary, self).delete_replica(
context, replica_list, replica, share_snapshots)
# Fix for bug 1996907- If snapmirror relationship still exist,
# deletes those again.
snapmirrors_des_list = self._get_snapmirrors_destinations(
vserver, peer_vserver)
snapmirrors_des_list_from_peer = self._get_snapmirrors_destinations(
peer_vserver, vserver)
if snapmirrors_des_list or snapmirrors_des_list_from_peer:
super(NetAppCmodeMultiSVMFileStorageLibrary, self).delete_replica(
context, replica_list, replica, share_snapshots)
# Check if there are no remaining SnapMirror connections and if a
# vserver peering exists and delete it.
snapmirrors = self._get_snapmirrors(vserver, peer_vserver)
snapmirrors_from_local = self._get_snapmirrors(vserver, peer_vserver)
snapmirrors_from_peer = self._get_snapmirrors(peer_vserver, vserver)
peers = self._get_vserver_peers(peer_vserver, vserver)
if not (snapmirrors or snapmirrors_from_peer) and peers:
if (not (snapmirrors_from_local or snapmirrors_from_peer
or snapmirrors_des_list or snapmirrors_des_list_from_peer)
and peers):
self._delete_vserver_peer(peer_vserver, vserver)
def manage_server(self, context, share_server, identifier, driver_options):
@ -795,6 +806,10 @@ class NetAppCmodeMultiSVMFileStorageLibrary(
return self._client.get_snapmirrors(
source_vserver=vserver, dest_vserver=peer_vserver)
def _get_snapmirrors_destinations(self, vserver, peer_vserver):
return self._client.get_snapmirror_destinations(
source_vserver=vserver, dest_vserver=peer_vserver)
def _get_vservers_from_replicas(self, context, replica_list, new_replica):
active_replica = self.find_active_replica(replica_list)
@ -1175,6 +1190,7 @@ class NetAppCmodeMultiSVMFileStorageLibrary(
LOG.debug(
msg, {'operation_id': operation_id, 'status': status})
return
try:
wait_for_status()
except exception.NetAppException:

View File

@ -1478,6 +1478,8 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
mock.Mock(return_value=(self.fake_vserver,
self.fake_new_vserver_name)))
self.mock_object(base_class, 'delete_replica')
self.mock_object(self.library, '_get_snapmirrors_destinations',
mock.Mock(return_value=[]))
self.mock_object(self.library, '_get_snapmirrors',
mock.Mock(return_value=[]))
self.mock_object(self.library, '_get_vserver_peers',
@ -1491,6 +1493,10 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
self.library._get_vservers_from_replicas.assert_called_once_with(
None, [self.fake_replica], self.fake_new_replica
)
self.library._get_snapmirrors_destinations.assert_has_calls(
[mock.call(self.fake_vserver, self.fake_new_vserver_name),
mock.call(self.fake_new_vserver_name, self.fake_vserver)]
)
base_class.delete_replica.assert_called_once_with(
None, [self.fake_replica], self.fake_new_replica, []
)
@ -1602,6 +1608,7 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
class FakeDBObj(dict):
def to_dict(self):
return self
fake_parent_share = copy.deepcopy(fake.SHARE)
fake_parent_share['id'] = fake.SHARE_ID2
fake_parent_share['host'] = fake.MANILA_HOST_NAME_2
@ -1826,11 +1833,11 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
@ddt.data(
{'expected_server': fake.SHARE_SERVER_NO_NFS_NONE,
'share_group': {'share_server_id':
fake.SHARE_SERVER_NO_NFS_NONE['id']}},
'share_group': {
'share_server_id': fake.SHARE_SERVER_NO_NFS_NONE['id']}},
{'expected_server': fake.SHARE_SERVER_NO_DETAILS,
'share_group': {'share_server_id':
fake.SHARE_SERVER_NO_DETAILS['id']}},
'share_group': {
'share_server_id': fake.SHARE_SERVER_NO_DETAILS['id']}},
{'expected_server': fake.SHARE_SERVER_NO_DETAILS,
'share_group': {
'share_server_id': fake.SHARE_SERVER_NO_DETAILS['id']},

View File

@ -0,0 +1,8 @@
---
fixes:
- |
NetApp driver `bug #1982808
<https://bugs.launchpad.net/manila/+bug/1982808>`_: Fixed issue
to add the retry logic to delete and release the snapmirror relationship.
Delete the vserver pairing when there is no snapmirror relationship exist
on source and destination cluster.