diff --git a/manila/share/drivers/netapp/dataontap/client/client_cmode.py b/manila/share/drivers/netapp/dataontap/client/client_cmode.py index 02736b15c6..2d00105baa 100644 --- a/manila/share/drivers/netapp/dataontap/client/client_cmode.py +++ b/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: diff --git a/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py b/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py index 4b51be563b..a9c2b45c0e 100644 --- a/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py +++ b/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)]) diff --git a/releasenotes/notes/bug-1887643-netapp-add-cifs-dc-add-skip-check-c8ea9b952cedb643.yaml b/releasenotes/notes/bug-1887643-netapp-add-cifs-dc-add-skip-check-c8ea9b952cedb643.yaml new file mode 100644 index 0000000000..ee4d9b662e --- /dev/null +++ b/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.