NetApp: set proper broadcast domain for IPspace

When DHSS=True, the cDOT driver creates vservers to act as
manila share servers and sets up LIFs within the vservers
as export locations using physical ports.  The LIFs in the
NetApp cluster may use overlapping addresses provided that
they are put in separate IPspaces and the physical ports
underneath them are put in corresponding broadcast domains.

Fix the cDOT driver to maintain a proper 1-1 relation between
IPSpaces and broadcast domains as documented here [1].

[1] https://library.netapp.com/ecmdocs/ECMP1636021/html/GUID-CB9BD2E2-D085-446E-8EB2-6BF609E42ABA.html

Change-Id: I32968e82cc679bb7efe492f3ca980e16e5e29c83
Closes-bug: #1646603
This commit is contained in:
Tom Barron 2016-12-02 05:16:28 -05:00
parent cc19d7b4a7
commit fa32c3787e
3 changed files with 17 additions and 13 deletions

View File

@ -35,7 +35,6 @@ from manila.share.drivers.netapp import utils as na_utils
LOG = log.getLogger(__name__)
DELETED_PREFIX = 'deleted_manila_'
DEFAULT_IPSPACE = 'Default'
DEFAULT_BROADCAST_DOMAIN = 'OpenStack'
DEFAULT_MAX_PAGE_LENGTH = 50
@ -601,7 +600,6 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
@na_utils.trace
def _ensure_broadcast_domain_for_port(self, node, port, mtu,
domain=DEFAULT_BROADCAST_DOMAIN,
ipspace=DEFAULT_IPSPACE):
"""Ensure a port is in a broadcast domain. Create one if necessary.
@ -609,10 +607,14 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
happens in multi-node clusters, then there isn't anything to do.
Otherwise, we can assume the IPspace is correct and extant by this
point, so the remaining task is to remove the port from any domain it
is already in, create the desired domain if it doesn't exist, and add
the port to the desired domain.
is already in, create the domain for the IPspace if it doesn't exist,
and add the port to this domain.
"""
# Derive the broadcast domain name from the IPspace name since they
# need to be 1-1 and the default for both is the same name, 'Default'.
domain = re.sub(r'ipspace', 'domain', ipspace)
port_info = self._get_broadcast_domain_for_port(node, port)
# Port already in desired ipspace and broadcast domain.

View File

@ -1062,8 +1062,7 @@ class NetAppClientCmodeTestCase(test.TestCase):
self.mock_object(self.client, '_add_port_to_broadcast_domain')
self.client._ensure_broadcast_domain_for_port(
fake.NODE_NAME, fake.PORT, fake.MTU, domain=fake.BROADCAST_DOMAIN,
ipspace=fake.IPSPACE_NAME)
fake.NODE_NAME, fake.PORT, fake.MTU, ipspace=fake.IPSPACE_NAME)
self.client._get_broadcast_domain_for_port.assert_called_once_with(
fake.NODE_NAME, fake.PORT)
@ -1073,10 +1072,11 @@ class NetAppClientCmodeTestCase(test.TestCase):
self.assertFalse(self.client._create_broadcast_domain.called)
self.assertFalse(self.client._add_port_to_broadcast_domain.called)
def test_ensure_broadcast_domain_for_port_other_domain(self):
@ddt.data(fake.IPSPACE_NAME, client_cmode.DEFAULT_IPSPACE)
def test_ensure_broadcast_domain_for_port_other_domain(self, ipspace):
port_info = {
'ipspace': fake.IPSPACE_NAME,
'ipspace': ipspace,
'broadcast-domain': 'other_domain',
}
self.mock_object(self.client,
@ -1091,13 +1091,12 @@ class NetAppClientCmodeTestCase(test.TestCase):
self.mock_object(self.client, '_add_port_to_broadcast_domain')
self.client._ensure_broadcast_domain_for_port(
fake.NODE_NAME, fake.PORT, domain=fake.BROADCAST_DOMAIN,
ipspace=fake.IPSPACE_NAME, mtu=fake.MTU)
fake.NODE_NAME, fake.PORT, ipspace=fake.IPSPACE_NAME, mtu=fake.MTU)
self.client._get_broadcast_domain_for_port.assert_called_once_with(
fake.NODE_NAME, fake.PORT)
self.client._remove_port_from_broadcast_domain.assert_called_once_with(
fake.NODE_NAME, fake.PORT, 'other_domain', fake.IPSPACE_NAME)
fake.NODE_NAME, fake.PORT, 'other_domain', ipspace)
self.client._broadcast_domain_exists.assert_called_once_with(
fake.BROADCAST_DOMAIN, fake.IPSPACE_NAME)
self.assertFalse(self.client._create_broadcast_domain.called)
@ -1125,8 +1124,7 @@ class NetAppClientCmodeTestCase(test.TestCase):
self.mock_object(self.client, '_add_port_to_broadcast_domain')
self.client._ensure_broadcast_domain_for_port(
fake.NODE_NAME, fake.PORT, domain=fake.BROADCAST_DOMAIN,
ipspace=fake.IPSPACE_NAME, mtu=fake.MTU)
fake.NODE_NAME, fake.PORT, ipspace=fake.IPSPACE_NAME, mtu=fake.MTU)
self.client._get_broadcast_domain_for_port.assert_called_once_with(
fake.NODE_NAME, fake.PORT)

View File

@ -0,0 +1,4 @@
---
fixes:
- Changed NetApp cDOT driver when running with DHSS=True to maintain
a 1-1 relation between IPSpaces and broadcast domains.