Browse Source

Merge "NetApp cDOT driver switch volume efficiency" into stable/queens

tags/6.3.1^0
Zuul 2 months ago
parent
commit
e80d038854

+ 16
- 15
manila/share/drivers/netapp/dataontap/client/client_cmode.py View File

@@ -1510,11 +1510,9 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
1510 1510
 
1511 1511
         self.send_request('volume-create', api_args)
1512 1512
 
1513
-        # cDOT compression requires that deduplication be enabled.
1514
-        if dedup_enabled or compression_enabled:
1515
-            self.enable_dedup(volume_name)
1516
-        if compression_enabled:
1517
-            self.enable_compression(volume_name)
1513
+        self.update_volume_efficiency_attributes(volume_name,
1514
+                                                 dedup_enabled,
1515
+                                                 compression_enabled)
1518 1516
         if max_files is not None:
1519 1517
             self.set_volume_max_files(volume_name, max_files)
1520 1518
 
@@ -1725,17 +1723,20 @@ class NetAppCmodeClient(client_base.NetAppBaseClient):
1725 1723
         """Update dedupe & compression attributes to match desired values."""
1726 1724
         efficiency_status = self.get_volume_efficiency_status(volume_name)
1727 1725
 
1728
-        if efficiency_status['compression'] != compression_enabled:
1729
-            if compression_enabled:
1730
-                self.enable_compression(volume_name)
1731
-            else:
1732
-                self.disable_compression(volume_name)
1726
+        # cDOT compression requires dedup to be enabled
1727
+        dedup_enabled = dedup_enabled or compression_enabled
1733 1728
 
1734
-        if efficiency_status['dedupe'] != dedup_enabled:
1735
-            if dedup_enabled:
1736
-                self.enable_dedup(volume_name)
1737
-            else:
1738
-                self.disable_dedup(volume_name)
1729
+        # enable/disable dedup if needed
1730
+        if dedup_enabled and not efficiency_status['dedupe']:
1731
+            self.enable_dedup(volume_name)
1732
+        elif not dedup_enabled and efficiency_status['dedupe']:
1733
+            self.disable_dedup(volume_name)
1734
+
1735
+        # enable/disable compression if needed
1736
+        if compression_enabled and not efficiency_status['compression']:
1737
+            self.enable_compression(volume_name)
1738
+        elif not compression_enabled and efficiency_status['compression']:
1739
+            self.disable_compression(volume_name)
1739 1740
 
1740 1741
     @na_utils.trace
1741 1742
     def volume_exists(self, volume_name):

+ 7
- 0
manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py View File

@@ -2641,6 +2641,7 @@ class NetAppClientCmodeTestCase(test.TestCase):
2641 2641
     def test_create_volume(self):
2642 2642
 
2643 2643
         self.mock_object(self.client, 'send_request')
2644
+        self.mock_object(self.client, 'update_volume_efficiency_attributes')
2644 2645
 
2645 2646
         self.client.create_volume(
2646 2647
             fake.SHARE_AGGREGATE_NAME, fake.SHARE_NAME, 100)
@@ -2663,6 +2664,10 @@ class NetAppClientCmodeTestCase(test.TestCase):
2663 2664
         self.mock_object(self.client, 'enable_dedup')
2664 2665
         self.mock_object(self.client, 'enable_compression')
2665 2666
         self.mock_object(self.client, 'send_request')
2667
+        self.mock_object(
2668
+            self.client,
2669
+            'get_volume_efficiency_status',
2670
+            mock.Mock(return_value={'dedupe': False, 'compression': False}))
2666 2671
 
2667 2672
         self.client.create_volume(
2668 2673
             fake.SHARE_AGGREGATE_NAME, fake.SHARE_NAME, 100,
@@ -2697,6 +2702,7 @@ class NetAppClientCmodeTestCase(test.TestCase):
2697 2702
     def test_create_encrypted_volume(self):
2698 2703
 
2699 2704
         self.mock_object(self.client, 'send_request')
2705
+        self.mock_object(self.client, 'update_volume_efficiency_attributes')
2700 2706
         self.client.features.add_feature('FLEXVOL_ENCRYPTION')
2701 2707
 
2702 2708
         self.client.create_volume(
@@ -2717,6 +2723,7 @@ class NetAppClientCmodeTestCase(test.TestCase):
2717 2723
     def test_create_non_encrypted_volume(self):
2718 2724
 
2719 2725
         self.mock_object(self.client, 'send_request')
2726
+        self.mock_object(self.client, 'update_volume_efficiency_attributes')
2720 2727
         self.client.features.add_feature('FLEXVOL_ENCRYPTION')
2721 2728
 
2722 2729
         self.client.create_volume(

+ 7
- 0
releasenotes/notes/netapp-cdot-switch-volume-efficiency-bd22733445d146f0.yaml View File

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

Loading…
Cancel
Save