Merge "[NetApp] update set_preferred_dc for ontapi 1.150" into stable/train

This commit is contained in:
Zuul 2020-07-22 01:09:13 +00:00 committed by Gerrit Code Review
commit 60d343a986
3 changed files with 38 additions and 2 deletions

View File

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

View File

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

View File

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