Merge "NetApp: set proper broadcast domain for IPspace"

This commit is contained in:
Jenkins 2017-01-05 22:08:48 +00:00 committed by Gerrit Code Review
commit 7bbfcbaedf
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
@ -605,7 +604,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.
@ -613,10 +611,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.