diff --git a/manila/share/drivers/netapp/dataontap/cluster_mode/lib_multi_svm.py b/manila/share/drivers/netapp/dataontap/cluster_mode/lib_multi_svm.py index 188e6d6ba1..d044cfd5ef 100644 --- a/manila/share/drivers/netapp/dataontap/cluster_mode/lib_multi_svm.py +++ b/manila/share/drivers/netapp/dataontap/cluster_mode/lib_multi_svm.py @@ -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) diff --git a/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_multi_svm.py b/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_multi_svm.py index 3ebca55a18..bd6dd7c7a5 100644 --- a/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_multi_svm.py +++ b/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_multi_svm.py @@ -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( diff --git a/releasenotes/notes/bug-1804656-netapp-cdot-add-port-ids-to-share-server-backend-424ca11a1eb44826.yaml b/releasenotes/notes/bug-1804656-netapp-cdot-add-port-ids-to-share-server-backend-424ca11a1eb44826.yaml new file mode 100644 index 0000000000..12f070f2ba --- /dev/null +++ b/releasenotes/notes/bug-1804656-netapp-cdot-add-port-ids-to-share-server-backend-424ca11a1eb44826.yaml @@ -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.