From c1db551775c512e42001a8183975f1abbc4c5253 Mon Sep 17 00:00:00 2001 From: Nahim Alves de Souza Date: Fri, 4 Jun 2021 21:12:48 +0000 Subject: [PATCH] [NetApp] Fix default thin_provisioned volumes on AFF The NetApp ONTAP driver was creating thin provisioned volumes on AFF systems even when the thin provisioned extra spec was saying the contrary. ONTAP AFF systems create thin provisioned volumes by default, which differs from FAS systems, that creates thick provisioned volumes by default. The NetApp ONTAP driver was modified to fix this misbehavior. Change-Id: I9218bf0d7cb607dd75e892ce86af958d43a7fcdb Closes-Bug: #1929421 --- .../netapp/dataontap/client/client_cmode.py | 3 +-- .../dataontap/client/test_client_cmode.py | 27 +++++++++++++++++-- ...olume-create-for-AFF-c22c72ce4c3fac16.yaml | 7 +++++ 3 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/bug-1929421-netapp-fix-thick-provision-volume-create-for-AFF-c22c72ce4c3fac16.yaml diff --git a/manila/share/drivers/netapp/dataontap/client/client_cmode.py b/manila/share/drivers/netapp/dataontap/client/client_cmode.py index bd573464da..e114ff316c 100644 --- a/manila/share/drivers/netapp/dataontap/client/client_cmode.py +++ b/manila/share/drivers/netapp/dataontap/client/client_cmode.py @@ -2109,11 +2109,10 @@ class NetAppCmodeClient(client_base.NetAppBaseClient): adaptive_qos_policy_group): api_args = { 'volume-type': volume_type, + 'space-reserve': ('none' if thin_provisioned else 'volume'), } if volume_type != 'dp': api_args['junction-path'] = '/%s' % volume_name - if thin_provisioned: - api_args['space-reserve'] = 'none' if snapshot_policy is not None: api_args['snapshot-policy'] = snapshot_policy if language is not None: 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..5039095a72 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 @@ -3119,6 +3119,28 @@ class NetAppClientCmodeTestCase(test.TestCase): else: self.client.set_volume_max_files.assert_not_called() + @ddt.data(True, False) + def test_create_volume_thin_provisioned(self, thin_provisioned): + + self.mock_object(self.client, 'send_request') + self.mock_object(self.client, 'update_volume_efficiency_attributes') + + self.client.create_volume( + fake.SHARE_AGGREGATE_NAME, fake.SHARE_NAME, 100, + thin_provisioned=thin_provisioned) + + volume_create_args = { + 'containing-aggr-name': fake.SHARE_AGGREGATE_NAME, + 'size': '100g', + 'volume': fake.SHARE_NAME, + 'volume-type': 'rw', + 'junction-path': '/%s' % fake.SHARE_NAME, + 'space-reserve': ('none' if thin_provisioned else 'volume'), + } + + self.client.send_request.assert_called_once_with('volume-create', + volume_create_args) + def test_create_volume_adaptive_not_supported(self): self.client.features.add_feature('ADAPTIVE_QOS', supported=False) @@ -3183,7 +3205,7 @@ class NetAppClientCmodeTestCase(test.TestCase): self.client.features.add_feature('FLEXVOL_ENCRYPTION') volume_type = 'rw' - thin_provisioned = 'none' + thin_provisioned = False snapshot_policy = 'default' language = 'en-US' reserve = 15 @@ -3198,7 +3220,7 @@ class NetAppClientCmodeTestCase(test.TestCase): expected_api_args = { 'volume-type': volume_type, 'junction-path': '/fake_share', - 'space-reserve': thin_provisioned, + 'space-reserve': 'volume', 'snapshot-policy': snapshot_policy, 'language-code': language, 'percentage-snapshot-reserve': str(reserve), @@ -3226,6 +3248,7 @@ class NetAppClientCmodeTestCase(test.TestCase): expected_api_args = { 'volume-type': volume_type, + 'space-reserve': 'volume', } self.assertEqual(expected_api_args, result_api_args) diff --git a/releasenotes/notes/bug-1929421-netapp-fix-thick-provision-volume-create-for-AFF-c22c72ce4c3fac16.yaml b/releasenotes/notes/bug-1929421-netapp-fix-thick-provision-volume-create-for-AFF-c22c72ce4c3fac16.yaml new file mode 100644 index 0000000000..cd22caefbd --- /dev/null +++ b/releasenotes/notes/bug-1929421-netapp-fix-thick-provision-volume-create-for-AFF-c22c72ce4c3fac16.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Fixed an issue with ONTAP AFF platforms while creating shares that forced + volumes to have efficient data saving even when the contrary was + specified. For more details, please refer to + `launchpad bug #1929421 `_