From 334c8a7f6ea61b7e9169b2bf6fd09f9b6971c226 Mon Sep 17 00:00:00 2001 From: chuan137 Date: Tue, 13 Sep 2022 11:11:28 +0200 Subject: [PATCH] ccloud: fix disabling cross-volume-deduplication Follow up of commit 445ea4de1. Some parent share has disabled cross-volume-deduplication, but the efficiency policy is 'auto'. Check policy name and set cross_volume_disabled only when policy name is 'inline-only'. Otherwise don't change the cross-volume-deduplication and policy name. --- .../netapp/dataontap/cluster_mode/lib_base.py | 6 ++++-- .../netapp/dataontap/cluster_mode/test_lib_base.py | 12 ++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py b/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py index e078006819..f1d1546842 100644 --- a/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py +++ b/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py @@ -752,11 +752,13 @@ def _get_logical_space_options(self, vserver_client, share_name): def _get_efficiency_options(self, vserver_client, share_name): status = vserver_client.get_volume_efficiency_status(share_name) + cross_dedup_disabled = (status.get('policy') == 'inline-only' + and status.get('cross_dedup_disabled')) provisioning_opts = { 'dedup_enabled': status.get('dedupe'), 'compression_enabled': status.get('compression'), - 'policy': status.get('policy'), - 'cross_dedup_disabled': status.get('cross_dedup_disabled'), + 'policy': None, + 'cross_dedup_disabled': cross_dedup_disabled, } return provisioning_opts diff --git a/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base.py b/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base.py index e75487f899..3ce5ae8435 100644 --- a/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base.py +++ b/manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base.py @@ -863,7 +863,7 @@ def test_create_share_from_snapshot(self, share_group_id): mock_allocate_container_from_snapshot.assert_called_once_with( share, fake.SNAPSHOT, fake.VSERVER1, vserver_client, compression_enabled=True, dedup_enabled=True, policy=None, - cross_dedup_disabled=None, logical_space_reporting=False) + cross_dedup_disabled=False, logical_space_reporting=False) mock_create_export.assert_called_once_with(share, fake.SHARE_SERVER, fake.VSERVER1, vserver_client) @@ -1003,7 +1003,7 @@ def test_create_share_from_snapshot_another_host(self, dest_cluster, self.mock_allocate_container.assert_called_once_with( self.fake_share, fake.VSERVER2, self.dest_vserver_client, replica=True, set_qos=False, compression_enabled=True, - dedup_enabled=True, policy=None, cross_dedup_disabled=None, + dedup_enabled=True, policy=None, cross_dedup_disabled=False, logical_space_reporting=False) self.mock_dm_create_snapmirror.assert_called_once() self.temp_src_share['replica_state'] = ( @@ -1013,7 +1013,7 @@ def test_create_share_from_snapshot_another_host(self, dest_cluster, self.mock_allocate_container_from_snapshot.assert_called_once_with( self.fake_share, fake.SNAPSHOT, fake.VSERVER1, self.src_vserver_client, split=True, compression_enabled=True, - dedup_enabled=True, policy=None, cross_dedup_disabled=None, + dedup_enabled=True, policy=None, cross_dedup_disabled=False, logical_space_reporting=False) state = self.library.STATE_SPLITTING_VOLUME_CLONE @@ -1058,7 +1058,7 @@ def test_create_share_from_snapshot_another_host_driver_error(self): self.mock_allocate_container_from_snapshot.assert_called_once_with( self.fake_share, fake.SNAPSHOT, fake.VSERVER1, self.src_vserver_client, split=True, compression_enabled=True, - dedup_enabled=True, policy=None, cross_dedup_disabled=None, + dedup_enabled=True, policy=None, cross_dedup_disabled=False, logical_space_reporting=False) mock_delete_snapmirror.assert_called_once_with(self.temp_src_share, self.fake_share) @@ -1348,7 +1348,7 @@ def test__create_from_snapshot_continue_state_splitting(self, src_host): fake.POOL_NAME, fake.SHARE_NAME, **fake.PROVISIONING_OPTIONS_WITH_QOS, logical_space_reporting=True, policy=None, - cross_dedup_disabled=None) + cross_dedup_disabled=False) self.mock_pvt_storage_delete.assert_called_once_with( fake.SHARE['id']) self.mock_create_export.assert_called_once_with( @@ -1457,7 +1457,7 @@ def test__create_from_snapshot_continue_state_snapmirror(self, fake.POOL_NAME, fake.SHARE_NAME, **fake.PROVISIONING_OPTIONS_WITH_QOS, logical_space_reporting=True, policy=None, - cross_dedup_disabled=None) + cross_dedup_disabled=False) expect_result['status'] = constants.STATUS_AVAILABLE self.mock_pvt_storage_delete.assert_called_once_with( fake.SHARE['id'])