Merge "[NetApp] Fix share server migration"

This commit is contained in:
Zuul 2023-08-16 21:01:58 +00:00 committed by Gerrit Code Review
commit 624dbabc25
4 changed files with 31 additions and 16 deletions

View File

@ -1200,7 +1200,7 @@ class NetAppCmodeMultiSVMFileStorageLibrary(
'network_allocations':
source_share_server['network_allocations'],
'neutron_subnet_id':
source_share_server['share_network_subnet'].get(
source_share_server['share_network_subnets'][0].get(
'neutron_subnet_id')
}
@ -1339,6 +1339,15 @@ class NetAppCmodeMultiSVMFileStorageLibrary(
LOG.error(msg)
return not_compatible
# Blocking multiple subnets
new_subnets = new_share_network.get('share_network_subnets', [])
old_subnets = old_share_network.get('share_network_subnets', [])
if (len(new_subnets) != 1) or (len(old_subnets) != 1):
msg = _("Cannot perform server migration for share network"
"with multiple subnets.")
LOG.error(msg)
return not_compatible
pools = self._get_pools()
# NOTE(dviroel): These clients can only be used for non-tunneling
@ -1468,17 +1477,17 @@ class NetAppCmodeMultiSVMFileStorageLibrary(
# Manila haven't made new allocations, we can just get allocation data
# from the source share server.
if not dest_share_server['network_allocations']:
share_server_to_get_network_info = source_share_server
share_server_network_info = source_share_server
else:
share_server_to_get_network_info = dest_share_server
share_server_network_info = dest_share_server
# Reuse network information from the source share server in the SVM
# Migrate if the there was no share network changes.
network_info = {
'network_allocations':
share_server_to_get_network_info['network_allocations'],
share_server_network_info['network_allocations'],
'neutron_subnet_id':
share_server_to_get_network_info['share_network_subnet'].get(
share_server_network_info['share_network_subnets'][0].get(
'neutron_subnet_id')
}

View File

@ -2353,7 +2353,7 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
'network_allocations':
self.fake_src_share_server['network_allocations'],
'neutron_subnet_id':
self.fake_src_share_server['share_network_subnet'].get(
self.fake_src_share_server['share_network_subnets'][0].get(
'neutron_subnet_id')
}
self.mock_object(self.library._client, 'list_cluster_nodes',
@ -2400,7 +2400,7 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
'network_allocations':
self.fake_src_share_server['network_allocations'],
'neutron_subnet_id':
self.fake_src_share_server['share_network_subnet'].get(
self.fake_src_share_server['share_network_subnets'][0].get(
'neutron_subnet_id')
}
@ -2689,8 +2689,8 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
'network_allocations':
server_to_get_network_info['network_allocations'],
'neutron_subnet_id':
server_to_get_network_info['share_network_subnet'][
'neutron_subnet_id']
server_to_get_network_info['share_network_subnets'][0].get(
'neutron_subnet_id')
}
mock_list_cluster_nodes = self.mock_object(
@ -2756,8 +2756,8 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
'network_allocations':
server_to_get_network_info['network_allocations'],
'neutron_subnet_id':
server_to_get_network_info['share_network_subnet'][
'neutron_subnet_id']
server_to_get_network_info['share_network_subnets'][0].get(
'neutron_subnet_id')
}
mock_list_cluster_nodes = self.mock_object(

View File

@ -575,10 +575,10 @@ SHARE_SERVER = {
'network_allocations': (USER_NETWORK_ALLOCATIONS +
ADMIN_NETWORK_ALLOCATIONS),
'host': SERVER_HOST,
'share_network_subnet': {
'share_network_subnets': [{
'neutron_net_id': 'fake_neutron_net_id',
'neutron_subnet_id': 'fake_neutron_subnet_id'
}
}]
}
SHARE_SERVER_2 = {
@ -590,10 +590,10 @@ SHARE_SERVER_2 = {
'network_allocations': (USER_NETWORK_ALLOCATIONS +
ADMIN_NETWORK_ALLOCATIONS),
'host': SERVER_HOST_2,
'share_network_subnet': {
'share_network_subnets': [{
'neutron_net_id': 'fake_neutron_net_id_2',
'neutron_subnet_id': 'fake_neutron_subnet_id_2'
}
}]
}
VSERVER_INFO = {
@ -1784,7 +1784,7 @@ SHARE_NETWORK = {
'name': 'fake_name',
'description': 'fake_description',
'security_services': [CIFS_SECURITY_SERVICE],
'subnets': [SHARE_NETWORK_SUBNET],
'share_network_subnets': [SHARE_NETWORK_SUBNET],
}
SHARE_TYPE_2 = copy.deepcopy(SHARE_TYPE)

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Netapp driver: Fix Netapp share server migration with multiple subnets.
For more details please refer to
`launchpad bug #2018300 <https://bugs.launchpad.net/manila/+bug/2018300>`