diff --git a/manila/share/drivers/netapp/dataontap/cluster_mode/drv_multi_svm.py b/manila/share/drivers/netapp/dataontap/cluster_mode/drv_multi_svm.py index 5685547566..963f03f8e7 100644 --- a/manila/share/drivers/netapp/dataontap/cluster_mode/drv_multi_svm.py +++ b/manila/share/drivers/netapp/dataontap/cluster_mode/drv_multi_svm.py @@ -75,6 +75,9 @@ class NetAppCmodeMultiSvmShareDriver(driver.ShareDriver): super(NetAppCmodeMultiSvmShareDriver, self)._update_share_stats( data=data) + def get_share_server_pools(self, share_server): + return self.library.get_share_server_pools(share_server) + def get_network_allocations_number(self): return self.library.get_network_allocations_number() diff --git a/manila/share/drivers/netapp/dataontap/cluster_mode/drv_single_svm.py b/manila/share/drivers/netapp/dataontap/cluster_mode/drv_single_svm.py index b93f76ff32..4ba736351d 100644 --- a/manila/share/drivers/netapp/dataontap/cluster_mode/drv_single_svm.py +++ b/manila/share/drivers/netapp/dataontap/cluster_mode/drv_single_svm.py @@ -75,6 +75,9 @@ class NetAppCmodeSingleSvmShareDriver(driver.ShareDriver): super(NetAppCmodeSingleSvmShareDriver, self)._update_share_stats( data=data) + def get_share_server_pools(self, share_server): + return self.library.get_share_server_pools(share_server) + def get_network_allocations_number(self): return self.library.get_network_allocations_number() 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 38e0c7b0c8..99c985c125 100644 --- a/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py +++ b/manila/share/drivers/netapp/dataontap/cluster_mode/lib_base.py @@ -199,7 +199,25 @@ class NetAppCmodeFileStorageLibrary(object): 'storage_protocol': 'NFS_CIFS', 'total_capacity_gb': 0.0, 'free_capacity_gb': 0.0, + 'pools': self._get_pools(), } + return data + + @na_utils.trace + def get_share_server_pools(self, share_server): + """Return list of pools related to a particular share server. + + Note that the multi-SVM cDOT driver assigns all available pools to + each Vserver, so there is no need to filter the pools any further + by share_server. + + :param share_server: ShareServer class instance. + """ + return self._get_pools() + + @na_utils.trace + def _get_pools(self): + """Retrieve list of pools available to this backend.""" pools = [] aggr_space = self._get_aggregate_space() @@ -229,8 +247,7 @@ class NetAppCmodeFileStorageLibrary(object): pools.append(pool) - data['pools'] = pools - return data + return pools @na_utils.trace def _handle_ems_logging(self): 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 7fb58084fd..d5cbd4520d 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 @@ -284,9 +284,8 @@ class NetAppFileStorageLibraryTestCase(test.TestCase): def test_get_share_stats(self): self.mock_object(self.library, - '_get_aggregate_space', - mock.Mock(return_value=fake.AGGREGATE_CAPACITIES)) - self.library._ssc_stats = fake.SSC_INFO + '_get_pools', + mock.Mock(return_value=fake.POOLS)) result = self.library.get_share_stats() @@ -299,30 +298,31 @@ class NetAppFileStorageLibraryTestCase(test.TestCase): 'storage_protocol': 'NFS_CIFS', 'total_capacity_gb': 0.0, 'free_capacity_gb': 0.0, - 'pools': [ - {'pool_name': fake.AGGREGATES[0], - 'total_capacity_gb': 3.3, - 'free_capacity_gb': 1.1, - 'allocated_capacity_gb': 2.2, - 'QoS_support': 'False', - 'reserved_percentage': 0, - 'netapp_raid_type': 'raid4', - 'netapp_disk_type': 'FCAL' - }, - {'pool_name': fake.AGGREGATES[1], - 'total_capacity_gb': 6.0, - 'free_capacity_gb': 2.0, - 'allocated_capacity_gb': 4.0, - 'QoS_support': 'False', - 'reserved_percentage': 0, - 'netapp_raid_type': 'raid_dp', - 'netapp_disk_type': 'SSD' - }, - ] + 'pools': fake.POOLS, } - self.assertDictEqual(expected, result) + def test_get_share_server_pools(self): + + self.mock_object(self.library, + '_get_pools', + mock.Mock(return_value=fake.POOLS)) + + result = self.library.get_share_server_pools(fake.SHARE_SERVER) + + self.assertListEqual(fake.POOLS, result) + + def test_get_pools(self): + + self.mock_object(self.library, + '_get_aggregate_space', + mock.Mock(return_value=fake.AGGREGATE_CAPACITIES)) + self.library._ssc_stats = fake.SSC_INFO + + result = self.library._get_pools() + + self.assertListEqual(fake.POOLS, result) + def test_handle_ems_logging(self): self.mock_object(self.library, diff --git a/manila/tests/share/drivers/netapp/dataontap/fakes.py b/manila/tests/share/drivers/netapp/dataontap/fakes.py index da87ed54c7..511f63ed51 100644 --- a/manila/tests/share/drivers/netapp/dataontap/fakes.py +++ b/manila/tests/share/drivers/netapp/dataontap/fakes.py @@ -270,6 +270,27 @@ SSC_INFO = { } } +POOLS = [ + {'pool_name': AGGREGATES[0], + 'total_capacity_gb': 3.3, + 'free_capacity_gb': 1.1, + 'allocated_capacity_gb': 2.2, + 'QoS_support': 'False', + 'reserved_percentage': 0, + 'netapp_raid_type': 'raid4', + 'netapp_disk_type': 'FCAL' + }, + {'pool_name': AGGREGATES[1], + 'total_capacity_gb': 6.0, + 'free_capacity_gb': 2.0, + 'allocated_capacity_gb': 4.0, + 'QoS_support': 'False', + 'reserved_percentage': 0, + 'netapp_raid_type': 'raid_dp', + 'netapp_disk_type': 'SSD' + }, +] + SSC_RAID_TYPES = { AGGREGATES[0]: 'raid4', AGGREGATES[1]: 'raid_dp'