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

Network allocation is made accessible to administrators. It is now easier to
find the port in neutron, if it has been changed or deleted.
Change-Id: I65911b6bf59a4d57fc39d67e6faa4f84422be806
Closes-Bug: #1804656
This commit is contained in:
Maurice Schreiber 2018-05-03 08:14:18 +02:00
parent 0fd1b8f9fa
commit 43771c2d31
No known key found for this signature in database
GPG Key ID: D39C8CD40259CE1F
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
@ -119,6 +120,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():
@ -126,7 +130,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
@ -227,10 +228,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):
@ -254,11 +260,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.