NetApp cDOT driver switch volume efficiency

cDOT compression requires that deduplication is enabled.
Reflect that in update_volume_efficiency_attributes
method, which is now also used for create_volume.

Closes-Bug: #1778022
Change-Id: I1aa05aa07b1cb64c44b1f654ee77b620b6c5e6d0
(cherry picked from commit 04aa4ba141)
This commit is contained in:
Maurice Schreiber 2017-12-18 09:20:55 +01:00 committed by Lucio Seki
parent a1ab550bf1
commit d509dbb5e9
3 changed files with 30 additions and 15 deletions

View File

@ -1514,11 +1514,9 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
self.send_request('volume-create', api_args)
# cDOT compression requires that deduplication be enabled.
if dedup_enabled or compression_enabled:
self.enable_dedup(volume_name)
if compression_enabled:
self.enable_compression(volume_name)
self.update_volume_efficiency_attributes(volume_name,
dedup_enabled,
compression_enabled)
if max_files is not None:
self.set_volume_max_files(volume_name, max_files)
@ -1767,17 +1765,20 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
"""Update dedupe & compression attributes to match desired values."""
efficiency_status = self.get_volume_efficiency_status(volume_name)
if efficiency_status['compression'] != compression_enabled:
if compression_enabled:
self.enable_compression(volume_name)
else:
self.disable_compression(volume_name)
# cDOT compression requires dedup to be enabled
dedup_enabled = dedup_enabled or compression_enabled
if efficiency_status['dedupe'] != dedup_enabled:
if dedup_enabled:
self.enable_dedup(volume_name)
else:
self.disable_dedup(volume_name)
# enable/disable dedup if needed
if dedup_enabled and not efficiency_status['dedupe']:
self.enable_dedup(volume_name)
elif not dedup_enabled and efficiency_status['dedupe']:
self.disable_dedup(volume_name)
# enable/disable compression if needed
if compression_enabled and not efficiency_status['compression']:
self.enable_compression(volume_name)
elif not compression_enabled and efficiency_status['compression']:
self.disable_compression(volume_name)
@na_utils.trace
def volume_exists(self, volume_name):

View File

@ -2642,6 +2642,7 @@ class NetAppClientCmodeTestCase(test.TestCase):
def test_create_volume(self):
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)
@ -2664,6 +2665,10 @@ class NetAppClientCmodeTestCase(test.TestCase):
self.mock_object(self.client, 'enable_dedup')
self.mock_object(self.client, 'enable_compression')
self.mock_object(self.client, 'send_request')
self.mock_object(
self.client,
'get_volume_efficiency_status',
mock.Mock(return_value={'dedupe': False, 'compression': False}))
self.client.create_volume(
fake.SHARE_AGGREGATE_NAME, fake.SHARE_NAME, 100,
@ -2698,6 +2703,7 @@ class NetAppClientCmodeTestCase(test.TestCase):
def test_create_encrypted_volume(self):
self.mock_object(self.client, 'send_request')
self.mock_object(self.client, 'update_volume_efficiency_attributes')
self.client.features.add_feature('FLEXVOL_ENCRYPTION')
self.client.create_volume(
@ -2718,6 +2724,7 @@ class NetAppClientCmodeTestCase(test.TestCase):
def test_create_non_encrypted_volume(self):
self.mock_object(self.client, 'send_request')
self.mock_object(self.client, 'update_volume_efficiency_attributes')
self.client.features.add_feature('FLEXVOL_ENCRYPTION')
self.client.create_volume(

View File

@ -0,0 +1,7 @@
---
fixes:
- |
NetApp driver volume efficiency settings now behave consistently: like on
volume creation now also modification, which is currently consumed by
manage and migration, will make sure that deduplication and compression
settings are applied correctly.