Merge "NetApp cDOT store port IDs and addresses at share server backend details"

This commit is contained in:
Zuul 2019-03-08 21:39:42 +00:00 committed by Gerrit Code Review
commit 43028c6d60
3 changed files with 28 additions and 3 deletions

View File

@ -23,6 +23,7 @@ as needed to provision shares.
import re
from oslo_log import log
from oslo_serialization import jsonutils
from oslo_utils import excutils
from manila import exception
@ -121,6 +122,9 @@ class NetAppCmodeMultiSVMFileStorageLibrary(
"""Creates and configures new Vserver."""
vlan = network_info['segmentation_id']
ports = {}
for network_allocation in network_info['network_allocations']:
ports[network_allocation['id']] = network_allocation['ip_address']
@utils.synchronized('netapp-VLAN-%s' % vlan, external=True)
def setup_server_with_lock():
@ -128,7 +132,10 @@ class NetAppCmodeMultiSVMFileStorageLibrary(
self._validate_network_type(network_info)
vserver_name = self._get_vserver_name(network_info['server_id'])
server_details = {'vserver_name': vserver_name}
server_details = {
'vserver_name': vserver_name,
'ports': jsonutils.dumps(ports)
}
try:
self._create_vserver(vserver_name, network_info)

View File

@ -20,6 +20,7 @@ import copy
import ddt
import mock
from oslo_log import log
from oslo_serialization import jsonutils
from manila import context
from manila import exception
@ -309,10 +310,15 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
result = self.library.setup_server(fake.NETWORK_INFO)
ports = {}
for network_allocation in fake.NETWORK_INFO['network_allocations']:
ports[network_allocation['id']] = network_allocation['ip_address']
self.assertTrue(mock_validate_network_type.called)
self.assertTrue(mock_get_vserver_name.called)
self.assertTrue(mock_create_vserver.called)
self.assertDictEqual({'vserver_name': fake.VSERVER1}, result)
self.assertDictEqual({'vserver_name': fake.VSERVER1,
'ports': jsonutils.dumps(ports)}, result)
def test_setup_server_with_error(self):
@ -336,11 +342,16 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
self.library.setup_server,
fake.NETWORK_INFO)
ports = {}
for network_allocation in fake.NETWORK_INFO['network_allocations']:
ports[network_allocation['id']] = network_allocation['ip_address']
self.assertTrue(mock_validate_network_type.called)
self.assertTrue(mock_get_vserver_name.called)
self.assertTrue(mock_create_vserver.called)
self.assertDictEqual(
{'server_details': {'vserver_name': fake.VSERVER1}},
{'server_details': {'vserver_name': fake.VSERVER1,
'ports': jsonutils.dumps(ports)}},
fake_exception.detail_data)
@ddt.data(

View File

@ -0,0 +1,7 @@
---
features:
- |
The Neutron Port IDs and IP addresses of the network allocation when using
the NetApp cDOT driver with DHSS=true are made accessible for
administrators at share server backend_details of newly created share
servers. Those are corresponding to the NetApp lifs of a vserver.