diff --git a/manila/share/drivers/netapp/dataontap/client/api.py b/manila/share/drivers/netapp/dataontap/client/api.py index 856b9e838a..7c7aeee0a5 100644 --- a/manila/share/drivers/netapp/dataontap/client/api.py +++ b/manila/share/drivers/netapp/dataontap/client/api.py @@ -269,7 +269,9 @@ class ZapiClient(BaseClient): ssl_cert_path=ssl_cert_path, username=username, password=password, port=port, trace=trace, api_trace_pattern=api_trace_pattern) self.set_server_type(server_type) - self._set_port() + if port is None: + # Not yet set in parent, use defaults + self._set_port() def _set_port(self): """Defines which port will be used to communicate with ONTAP.""" @@ -444,7 +446,9 @@ class RestClient(BaseClient): host, transport_type=transport_type, style=style, ssl_cert_path=ssl_cert_path, username=username, password=password, port=port, trace=trace, api_trace_pattern=api_trace_pattern) - self._set_port() + if port is None: + # Not yet set in parent, use defaults + self._set_port() def _set_port(self): if self._protocol == TRANSPORT_TYPE_HTTP: diff --git a/manila/tests/share/drivers/netapp/dataontap/client/test_api.py b/manila/tests/share/drivers/netapp/dataontap/client/test_api.py index f2c9c6e911..8da9690511 100644 --- a/manila/tests/share/drivers/netapp/dataontap/client/test_api.py +++ b/manila/tests/share/drivers/netapp/dataontap/client/test_api.py @@ -265,6 +265,11 @@ class NetAppApiServerZapiClientTests(test.TestCase): expected_log_count = 2 if log else 0 self.assertEqual(expected_log_count, api.LOG.debug.call_count) + @ddt.data('1234', 5678) + def test_custom_port(self, port): + root = api.NaServer('127.0.0.1', port=port).zapi_client + self.assertEqual(str(port), root.get_port()) + @ddt.ddt class NetAppApiServerRestClientTests(test.TestCase): @@ -462,3 +467,8 @@ class NetAppApiServerRestClientTests(test.TestCase): url, fake.FAKE_HTTP_QUERY) self.assertEqual(expected_formated_url, formatted_url) + + @ddt.data('1234', 5678) + def test_custom_port(self, port): + root = api.NaServer('127.0.0.1', port=port).rest_client + self.assertEqual(str(port), root.get_port()) diff --git a/releasenotes/notes/bug-1945365-netapp-fix-port-conf-91552d3f61378c94.yaml b/releasenotes/notes/bug-1945365-netapp-fix-port-conf-91552d3f61378c94.yaml new file mode 100644 index 0000000000..c624d9f465 --- /dev/null +++ b/releasenotes/notes/bug-1945365-netapp-fix-port-conf-91552d3f61378c94.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + NetApp cDOT driver Custom port configuration using ``netapp_server_port`` + was accidentally ignored after a refactor. This option should now be + properly read. See `Launchpad bug 1945365 `_ + for more details.