Browse Source

[NetApp] update set_preferred_dc for ontapi 1.150

ONTAP 9.5 adds vserver cifs domain preferred-dc configuration
validation. The parameter 'skip-config-validation' is mandatory
for 'cifs-domain-preferred-dc-add' now and is set to false,
i.e. an invalid config will raise early.

Change-Id: I5eb97ba1b29ad24b296e12064f81eb93533c6b99
Closes-Bug: 1887643
(cherry picked from commit 3057d0643e)
changes/84/742084/1
Maurice Escher 1 year ago
parent
commit
7248532de8
  1. 6
      manila/share/drivers/netapp/dataontap/client/client_cmode.py
  2. 27
      manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py
  3. 7
      releasenotes/notes/bug-1887643-netapp-add-cifs-dc-add-skip-check-c8ea9b952cedb643.yaml

6
manila/share/drivers/netapp/dataontap/client/client_cmode.py

@ -70,6 +70,7 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
ontapi_1_2x = (1, 20) <= ontapi_version < (1, 30)
ontapi_1_30 = ontapi_version >= (1, 30)
ontapi_1_110 = ontapi_version >= (1, 110)
ontapi_1_150 = ontapi_version >= (1, 150)
self.features.add_feature('SNAPMIRROR_V2', supported=ontapi_1_20)
self.features.add_feature('SYSTEM_METRICS', supported=ontapi_1_2x)
@ -82,6 +83,8 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
self.features.add_feature('ADVANCED_DISK_PARTITIONING',
supported=ontapi_1_30)
self.features.add_feature('FLEXVOL_ENCRYPTION', supported=ontapi_1_110)
self.features.add_feature('CIFS_DC_ADD_SKIP_CHECK',
supported=ontapi_1_150)
def _invoke_vserver_api(self, na_element, vserver):
server = copy.copy(self.connection)
@ -1527,6 +1530,9 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
for dc_ip in security_service['server'].split(','):
api_args['preferred-dc'].append({'string': dc_ip.strip()})
if self.features.CIFS_DC_ADD_SKIP_CHECK:
api_args['skip-config-validation'] = 'false'
try:
self.send_request('cifs-domain-preferred-dc-add', api_args)
except netapp_api.NaApiError as e:

27
manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py

@ -2724,8 +2724,28 @@ class NetAppClientCmodeTestCase(test.TestCase):
self.client.configure_dns,
fake.KERBEROS_SECURITY_SERVICE)
@ddt.data('', '10.0.0.1', ['10.0.0.2', '10.0.0.3'])
def test_set_preferred_dc(self, server):
@ddt.data(
{
'server': '',
'check_feature': False
},
{
'server': ['10.0.0.2', '10.0.0.3'],
'check_feature': False
},
{
'server': '10.0.0.1',
'check_feature': False
},
{
'server': '10.0.0.1',
'check_feature': True
}
)
@ddt.unpack
def test_set_preferred_dc(self, server, check_feature):
if check_feature:
self.client.features.add_feature('CIFS_DC_ADD_SKIP_CHECK')
self.mock_object(self.client, 'send_request')
security_service = copy.deepcopy(fake.CIFS_SECURITY_SERVICE)
@ -2741,6 +2761,9 @@ class NetAppClientCmodeTestCase(test.TestCase):
'preferred-dc': [{'string': dc_ip} for dc_ip in server]
}
if check_feature:
preferred_dc_add_args['skip-config-validation'] = 'false'
self.client.send_request.assert_has_calls([
mock.call('cifs-domain-preferred-dc-add',
preferred_dc_add_args)])

7
releasenotes/notes/bug-1887643-netapp-add-cifs-dc-add-skip-check-c8ea9b952cedb643.yaml

@ -0,0 +1,7 @@
---
fixes:
- |
The NetApp cDOT driver now validates the configuration of preferred domain
controller(s) added in CIFS security service server setup. The mandatory
option ``skip-config-validation`` was introduced to
``cifs-domain-preferred-dc-add`` with ONTAP 9.5.
Loading…
Cancel
Save