Merge "[SVf] Optimize lsmdiskgrp calls in creation of replicated volumes"
This commit is contained in:
commit
bf470073ba
|
@ -5284,6 +5284,16 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
|
|||
elif online_node and node_status == 'offline':
|
||||
self.assertEqual(nodes, empty_nodes_info)
|
||||
|
||||
@mock.patch.object(storwize_svc_common.StorwizeSVCCommonDriver,
|
||||
'_build_pool_stats')
|
||||
def test_update_volume_stats_non_replication(self, _build_pool_stats):
|
||||
self.driver._update_volume_stats()
|
||||
self.assertFalse(self.driver._replica_enabled)
|
||||
self.assertEqual(SVC_POOLS, self.driver._get_backend_pools())
|
||||
self.assertEqual(len(SVC_POOLS), _build_pool_stats.call_count)
|
||||
self.assertIsNotNone(self.driver._master_backend_helpers.stats)
|
||||
self.assertIsNone(self.driver._aux_backend_helpers)
|
||||
|
||||
@ddt.data((False, 'enabled', ''),
|
||||
(False, 'disabled', 'site 2 down'),
|
||||
(True, '', ''))
|
||||
|
@ -11102,6 +11112,38 @@ class StorwizeSVCReplicationTestCase(test.TestCase):
|
|||
vdisks = self.sim._cmd_lsvdisks_from_filter('mdisk_grp_name', pool)
|
||||
return vdisks
|
||||
|
||||
@mock.patch.object(storwize_svc_common.StorwizeSVCCommonDriver,
|
||||
'_build_pool_stats')
|
||||
def test_update_volume_stats_replication(self, _build_pool_stats):
|
||||
self.driver.configuration.set_override('replication_device',
|
||||
[self.rep_target])
|
||||
self.driver._update_volume_stats()
|
||||
self.assertTrue(self.driver._replica_enabled)
|
||||
target_pools = [self.driver._replica_target.get('pool_name')]
|
||||
# Expected call count = Number of primary Pools and Secondary Pools
|
||||
expected_call_count = len(SVC_POOLS) + len(target_pools)
|
||||
self.assertEqual(expected_call_count, _build_pool_stats.call_count)
|
||||
self.assertIsNotNone(self.driver._master_backend_helpers.stats)
|
||||
self.assertIsNotNone(self.driver._aux_backend_helpers.stats)
|
||||
|
||||
@ddt.data((False, False), (True, True))
|
||||
@mock.patch.object(storwize_svc_common.StorwizeHelpers,
|
||||
'get_pool_attrs')
|
||||
@ddt.unpack
|
||||
def test_build_pool_stats_calls(self, replication_enabled,
|
||||
target, get_pool_attrs):
|
||||
pool = "openstack"
|
||||
master_helper = self.driver._master_backend_helpers
|
||||
target_helper = self.driver._aux_backend_helpers
|
||||
if replication_enabled:
|
||||
self.driver.configuration.set_override('replication_device',
|
||||
[self.rep_target])
|
||||
self.driver._build_pool_stats(pool, target)
|
||||
if target:
|
||||
target_helper.get_pool_attrs.assert_called_once_with(pool)
|
||||
else:
|
||||
master_helper.get_pool_attrs.assert_called_once_with(pool)
|
||||
|
||||
def test_storwize_do_replication_setup_error(self):
|
||||
fake_targets = [self.rep_target, self.rep_target]
|
||||
self.driver.configuration.set_override('replication_device',
|
||||
|
|
|
@ -6492,6 +6492,11 @@ class StorwizeSVCCommonDriver(san.SanDriver,
|
|||
data['replication_enabled'] = self._replica_enabled
|
||||
data['replication_targets'] = self._get_replication_targets()
|
||||
data['consistent_group_replication_enabled'] = True
|
||||
remote_data = dict()
|
||||
remote_data['pools'] = [self._build_pool_stats(pool, target=True)
|
||||
for pool in
|
||||
[self._replica_target.get('pool_name')]]
|
||||
self._aux_backend_helpers.stats = remote_data
|
||||
|
||||
if self._helpers.is_system_topology_hyperswap(self._state):
|
||||
data['replication_enabled'] = True
|
||||
|
@ -6506,12 +6511,19 @@ class StorwizeSVCCommonDriver(san.SanDriver,
|
|||
|
||||
self._stats = data
|
||||
|
||||
def _build_pool_stats(self, pool):
|
||||
def _build_pool_stats(self, pool, target=False):
|
||||
"""Build pool status"""
|
||||
QoS_support = True
|
||||
pool_stats = {}
|
||||
is_dr_pool = False
|
||||
pool_data = self._helpers.get_pool_attrs(pool)
|
||||
if target:
|
||||
pool_data = self._aux_backend_helpers.get_pool_attrs(pool)
|
||||
system_id = self._aux_state['system_id']
|
||||
compression_enabled = self._aux_state['compression_enabled']
|
||||
else:
|
||||
pool_data = self._helpers.get_pool_attrs(pool)
|
||||
system_id = self._state['system_id']
|
||||
compression_enabled = self._state['compression_enabled']
|
||||
if pool_data:
|
||||
easy_tier = pool_data['easy_tier'] in ['on', 'auto']
|
||||
total_capacity_gb = float(pool_data['capacity']) / units.Gi
|
||||
|
@ -6528,7 +6540,7 @@ class StorwizeSVCCommonDriver(san.SanDriver,
|
|||
over_sub_ratio = self.configuration.safe_get(
|
||||
'max_over_subscription_ratio')
|
||||
location_info = ('StorwizeSVCDriver:%(sys_id)s:%(pool)s' %
|
||||
{'sys_id': self._state['system_id'],
|
||||
{'sys_id': system_id,
|
||||
'pool': pool_data['name']})
|
||||
multiattach = (self.configuration.
|
||||
storwize_svc_multihostmap_enabled)
|
||||
|
@ -6546,7 +6558,7 @@ class StorwizeSVCCommonDriver(san.SanDriver,
|
|||
'free_capacity_gb': free_capacity_gb,
|
||||
'allocated_capacity_gb': allocated_capacity_gb,
|
||||
'provisioned_capacity_gb': provisioned_capacity_gb,
|
||||
'compression_support': self._state['compression_enabled'],
|
||||
'compression_support': compression_enabled,
|
||||
'reserved_percentage':
|
||||
self.configuration.reserved_percentage,
|
||||
'QoS_support': QoS_support,
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
fixes:
|
||||
- |
|
||||
IBM Spectrum Virtualize family driver
|
||||
`Bug #1978290 <https://bugs.launchpad.net/cinder/+bug/1978290>`_:
|
||||
Optimize lsmdiskgrp SSH calls in creation of replicated volumes
|
||||
to reduce the computational time.
|
Loading…
Reference in New Issue