NetApp: properly use netapp_server_port config

This config option was being ignored/overwritten with default values.

Closes-Bug: #1945365
Change-Id: Id1c95154b1c4c536ac8744f6f09d569bc34bbfb9
This commit is contained in:
Adam Harwell 2021-09-28 12:26:19 -07:00
parent 7d2bbed35e
commit 9974f6c8be
3 changed files with 23 additions and 2 deletions

View File

@ -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:

View File

@ -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())

View File

@ -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 <https://bugs.launchpad.net/manila/+bug/1945365>`_
for more details.