NetApp cDOT: Fix reporting of replication capabilities

Host level replication capability was added to the NetApp
cDOT Block and File drivers through
I87b92e76d0d5022e9be610b9e237b89417309c05.
However, the replication capability was not being reported
at the pool level.

Add the field at pool level allowing for compatibility with
volume types that may include the `replication_enabled`
extra-spec.

Change-Id: Ic735a527c609166884668c84c589da521769500b
Closes-Bug: #1615451
This commit is contained in:
Goutham Pacha Ravi 2016-08-26 21:47:44 -04:00 committed by Yogesh
parent 7ff588cd95
commit 623990df64
5 changed files with 44 additions and 4 deletions

View File

@ -342,7 +342,8 @@ class NetAppBlockStorageCmodeLibraryTestCase(test.TestCase):
self.assertEqual(target_details_list[2], result)
def test_get_pool_stats(self):
@ddt.data([], ['target_1', 'target_2'])
def test_get_pool_stats(self, replication_backends):
ssc = {
'vola': {
@ -364,6 +365,8 @@ class NetAppBlockStorageCmodeLibraryTestCase(test.TestCase):
mock_get_aggrs = self.mock_object(self.library.ssc_library,
'get_ssc_aggregates',
mock.Mock(return_value=['aggr1']))
self.mock_object(self.library, 'get_replication_backend_names',
mock.Mock(return_value=replication_backends))
self.library.reserved_percentage = 5
self.library.max_over_subscription_ratio = 10
@ -414,7 +417,15 @@ class NetAppBlockStorageCmodeLibraryTestCase(test.TestCase):
'netapp_aggregate': 'aggr1',
'netapp_raid_type': 'raid_dp',
'netapp_disk_type': 'SSD',
'replication_enabled': False,
}]
if replication_backends:
expected[0].update({
'replication_enabled': True,
'replication_count': len(replication_backends),
'replication_targets': replication_backends,
'replication_type': 'async',
})
self.assertEqual(expected, result)
mock_get_ssc.assert_called_once_with()

View File

@ -143,7 +143,8 @@ class NetAppCmodeNfsDriverTestCase(test.TestCase):
self.assertEqual(1, mock_debug_log.call_count)
self.assertEqual(expected_stats, self.driver._stats)
def test_get_pool_stats(self):
@ddt.data([], ['target_1', 'target_2'])
def test_get_pool_stats(self, replication_backends):
self.driver.zapi_client = mock.Mock()
ssc = {
@ -168,6 +169,9 @@ class NetAppCmodeNfsDriverTestCase(test.TestCase):
'get_ssc_aggregates',
mock.Mock(return_value=['aggr1']))
self.mock_object(self.driver, 'get_replication_backend_names',
mock.Mock(return_value=replication_backends))
total_capacity_gb = na_utils.round_down(
fake.TOTAL_BYTES // units.Gi, '0.01')
free_capacity_gb = na_utils.round_down(
@ -224,7 +228,15 @@ class NetAppCmodeNfsDriverTestCase(test.TestCase):
'netapp_raid_type': 'raid_dp',
'netapp_disk_type': 'SSD',
'consistencygroup_support': True,
'replication_enabled': False,
}]
if replication_backends:
expected[0].update({
'replication_enabled': True,
'replication_count': len(replication_backends),
'replication_targets': replication_backends,
'replication_type': 'async',
})
self.assertEqual(expected, result)
mock_get_ssc.assert_called_once_with()

View File

@ -236,7 +236,9 @@ class NetAppBlockStorageCmodeLibrary(block_base.NetAppBlockStorageLibrary,
filter_function=filter_function,
goodness_function=goodness_function)
data['sparse_copy_volume'] = True
data.update(self.get_replication_backend_stats(self.configuration))
# Used for service state report
data['replication_enabled'] = self.replication_enabled
self.zapi_client.provide_ems(self, self.driver_name, self.app_version)
self._stats = data
@ -302,6 +304,10 @@ class NetAppBlockStorageCmodeLibrary(block_base.NetAppBlockStorageLibrary,
pool['filter_function'] = filter_function
pool['goodness_function'] = goodness_function
# Add replication capabilities/stats
pool.update(
self.get_replication_backend_stats(self.configuration))
pools.append(pool)
return pools

View File

@ -201,7 +201,9 @@ class NetAppCmodeNfsDriver(nfs_base.NetAppNfsDriver,
filter_function=self.get_filter_function(),
goodness_function=self.get_goodness_function())
data['sparse_copy_volume'] = True
data.update(self.get_replication_backend_stats(self.configuration))
# Used for service state report
data['replication_enabled'] = self.replication_enabled
self._spawn_clean_cache_job()
self.zapi_client.provide_ems(self, netapp_backend, self._app_version)
@ -258,6 +260,10 @@ class NetAppCmodeNfsDriver(nfs_base.NetAppNfsDriver,
pool['filter_function'] = filter_function
pool['goodness_function'] = goodness_function
# Add replication capabilities/stats
pool.update(
self.get_replication_backend_stats(self.configuration))
pools.append(pool)
return pools

View File

@ -0,0 +1,5 @@
---
fixes:
- NetApp cDOT block and file drivers now report replication capability
at the pool level; and are hence compatible with using the
``replication_enabled`` extra-spec in volume types.