diff --git a/manila/share/drivers/netapp/dataontap/client/client_cmode.py b/manila/share/drivers/netapp/dataontap/client/client_cmode.py index bd573464da..628ef229a5 100644 --- a/manila/share/drivers/netapp/dataontap/client/client_cmode.py +++ b/manila/share/drivers/netapp/dataontap/client/client_cmode.py @@ -4918,16 +4918,18 @@ class NetAppCmodeClient(client_base.NetAppBaseClient): 'cutover-action': CUTOVER_ACTION_MAP[cutover_action], } - if self.features.FLEXVOL_ENCRYPTION and encrypt_destination: - api_args['encrypt-destination'] = 'true' + if self.features.FLEXVOL_ENCRYPTION: + if encrypt_destination: + api_args['encrypt-destination'] = 'true' + else: + api_args['encrypt-destination'] = 'false' elif encrypt_destination: msg = 'Flexvol encryption is not supported on this backend.' raise exception.NetAppException(msg) - else: - api_args['encrypt-destination'] = 'false' if validation_only: api_args['perform-validation-only'] = 'true' + self.send_request('volume-move-start', api_args) @na_utils.trace 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 0cdbc2805c..1512392ca3 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 @@ -7162,8 +7162,19 @@ class NetAppClientCmodeTestCase(test.TestCase): expected = [fake.SNAPSHOT_NAME] self.assertEqual(expected, result) - @ddt.data('start_volume_move', 'check_volume_move') - def test_volume_move_method(self, method_name): + @ddt.data( + {'method_name': 'start_volume_move', 'ontapi_version': (1, 20)}, + {'method_name': 'start_volume_move', 'ontapi_version': (1, 110)}, + {'method_name': 'check_volume_move', 'ontapi_version': (1, 20)}, + {'method_name': 'check_volume_move', 'ontapi_version': (1, 110)} + ) + @ddt.unpack + def test_volume_move_method(self, method_name, ontapi_version): + self.mock_object(client_base.NetAppBaseClient, + 'get_ontapi_version', + mock.Mock(return_value=ontapi_version)) + + self.client._init_features() method = getattr(self.client, method_name) self.mock_object(self.client, 'send_request') @@ -7176,8 +7187,14 @@ class NetAppClientCmodeTestCase(test.TestCase): 'vserver': fake.VSERVER_NAME, 'dest-aggr': fake.SHARE_AGGREGATE_NAME, 'cutover-action': 'wait', - 'encrypt-destination': 'false' } + + if ontapi_version >= (1, 110): + expected_api_args['encrypt-destination'] = 'false' + self.assertTrue(self.client.features.FLEXVOL_ENCRYPTION) + else: + self.assertFalse(self.client.features.FLEXVOL_ENCRYPTION) + if method_name.startswith('check'): expected_api_args['perform-validation-only'] = 'true' diff --git a/releasenotes/notes/bug-1915237-netapp-fix-encrypt-check-on-migrate-1e39bd7f19651972.yaml b/releasenotes/notes/bug-1915237-netapp-fix-encrypt-check-on-migrate-1e39bd7f19651972.yaml new file mode 100644 index 0000000000..1b0b64c0b1 --- /dev/null +++ b/releasenotes/notes/bug-1915237-netapp-fix-encrypt-check-on-migrate-1e39bd7f19651972.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + NetApp OnTap driver `Bug #1915237 + `_: + Fixed encryption compatibility check on manila share migrate.