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,6 +269,8 @@ class ZapiClient(BaseClient):
ssl_cert_path=ssl_cert_path, username=username, password=password, ssl_cert_path=ssl_cert_path, username=username, password=password,
port=port, trace=trace, api_trace_pattern=api_trace_pattern) port=port, trace=trace, api_trace_pattern=api_trace_pattern)
self.set_server_type(server_type) self.set_server_type(server_type)
if port is None:
# Not yet set in parent, use defaults
self._set_port() self._set_port()
def _set_port(self): def _set_port(self):
@ -444,6 +446,8 @@ class RestClient(BaseClient):
host, transport_type=transport_type, style=style, host, transport_type=transport_type, style=style,
ssl_cert_path=ssl_cert_path, username=username, password=password, ssl_cert_path=ssl_cert_path, username=username, password=password,
port=port, trace=trace, api_trace_pattern=api_trace_pattern) port=port, trace=trace, api_trace_pattern=api_trace_pattern)
if port is None:
# Not yet set in parent, use defaults
self._set_port() self._set_port()
def _set_port(self): def _set_port(self):

View File

@ -265,6 +265,11 @@ class NetAppApiServerZapiClientTests(test.TestCase):
expected_log_count = 2 if log else 0 expected_log_count = 2 if log else 0
self.assertEqual(expected_log_count, api.LOG.debug.call_count) 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 @ddt.ddt
class NetAppApiServerRestClientTests(test.TestCase): class NetAppApiServerRestClientTests(test.TestCase):
@ -462,3 +467,8 @@ class NetAppApiServerRestClientTests(test.TestCase):
url, fake.FAKE_HTTP_QUERY) url, fake.FAKE_HTTP_QUERY)
self.assertEqual(expected_formated_url, formatted_url) 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.