NetApp OnTap: Fix compatibility check for share migrate

The issue happens when the parameter 'encrypt-destination' is sent to
OnTap devices with version lower than 9.0 or OnTapi lower then 1.110.

This patch adds a condition to check these versions and ignore the flag
addition if needed on '_send_volume_move_request'.

Closes-Bug: 1915237
Change-Id: Id9faa4f73996cb7467b7361d0406c980f06905c2
This commit is contained in:
Fabio Oliveira 2021-12-07 11:13:29 -03:00
parent 21d93dc5d1
commit 9417ece456
3 changed files with 32 additions and 7 deletions

View File

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

View File

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

View File

@ -0,0 +1,6 @@
---
fixes:
- |
NetApp OnTap driver `Bug #1915237
<https://bugs.launchpad.net/manila/+bug/1915237>`_:
Fixed encryption compatibility check on manila share migrate.