Set DC discovery-mode to 'none' if server is specified in SS.

If the user is configuring "Servers" as AD Server in the Security
Service then the domain controller discovery mode should be changed
to "none" and only these servers should be used.

Closes-bug: #1987537
Change-Id: I5cc181ac32529174e5e73dfde4604a470bd32442
This commit is contained in:
Kiran Pawar 2022-08-25 09:56:15 +00:00
parent 45cbd7a0d6
commit 8f2303046f
3 changed files with 27 additions and 0 deletions

View File

@ -1464,6 +1464,7 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
elif security_service['type'].lower() == 'active_directory':
vserver_client.configure_active_directory(security_service,
vserver_name)
vserver_client.configure_cifs_options(security_service)
elif security_service['type'].lower() == 'kerberos':
vserver_client.create_kerberos_realm(security_service)
@ -1997,6 +1998,22 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
msg = _("Failed to update DNS configuration. %s")
raise exception.NetAppException(msg % e.message)
@na_utils.trace
def configure_cifs_options(self, security_service):
if not security_service['server']:
return
api_args = {'mode': 'none'}
try:
self.send_request(
'cifs-domain-server-discovery-mode-modify',
api_args)
except netapp_api.NaApiError as e:
msg = ('Failed to set cifs domain server discovery mode to '
'%(mode)s. Exception: %(exception)s')
msg_args = {'mode': api_args['mode'], 'exception': e.message}
LOG.warning(msg, msg_args)
@na_utils.trace
def set_preferred_dc(self, security_service):
# server is optional

View File

@ -2390,6 +2390,7 @@ class NetAppClientCmodeTestCase(test.TestCase):
self.mock_object(self.client, 'send_request')
self.mock_object(self.vserver_client, 'configure_active_directory')
self.mock_object(self.vserver_client, 'configure_cifs_options')
self.client.setup_security_services([fake.CIFS_SECURITY_SERVICE],
self.vserver_client,
@ -2410,6 +2411,8 @@ class NetAppClientCmodeTestCase(test.TestCase):
mock.call('vserver-modify', vserver_modify_args)])
self.vserver_client.configure_active_directory.assert_has_calls([
mock.call(fake.CIFS_SECURITY_SERVICE, fake.VSERVER_NAME)])
self.vserver_client.configure_cifs_options.assert_has_calls([
mock.call(fake.CIFS_SECURITY_SERVICE)])
def test_setup_security_services_kerberos(self):

View File

@ -0,0 +1,7 @@
---
features:
- |
If user is configuring 'Servers' in AD Server in the security service then,
for NetApp ONTAP, the discovery mode should be changed to 'none'. Value of
'none' indicates that domain controller discovery will not be done, and it
will depend only on preferred DC's configured.