Browse Source

Merge "[SVF]:Reduce slowness by caching pool information" into stable/train

changes/41/779141/4
Zuul 1 month ago
committed by Gerrit Code Review
parent
commit
343873840b
3 changed files with 96 additions and 1 deletions
  1. +57
    -1
      cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py
  2. +32
    -0
      cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py
  3. +7
    -0
      releasenotes/notes/bug-1890591-Pool-information-is-not-saved-in-stats-22f302d941cd9fe2.yaml

+ 57
- 1
cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py View File

@ -5533,7 +5533,7 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
self._set_flag('reserved_percentage', 25)
self._set_flag('storwize_svc_multihostmap_enabled', True)
self._set_flag('storwize_svc_vol_rsize', rsize)
stats = self.driver.get_volume_stats()
stats = self.driver.get_volume_stats(True)
for each_pool in stats['pools']:
self.assertIn(each_pool['pool_name'],
self._def_flags['storwize_svc_volpool_name'])
@ -8144,6 +8144,7 @@ port_speed!8Gb
list(resp.select('port_id', 'port_status')))
@ddt.ddt
class StorwizeHelpersTestCase(test.TestCase):
def setUp(self):
super(StorwizeHelpersTestCase, self).setUp()
@ -8310,6 +8311,61 @@ class StorwizeHelpersTestCase(test.TestCase):
self.storwize_svc_common.pretreatment_before_revert(vol)
stopfcmap.assert_called_once_with('4', split=True)
def test_storwize_check_flashcopy_rate_invalid1(self):
with mock.patch.object(storwize_svc_common.StorwizeHelpers,
'get_system_info') as get_system_info:
fake_system_info = {'code_level': (7, 6, 0, 0),
'topology': 'standard',
'system_name': 'storwize-svc-sim',
'system_id': '0123456789ABCDEF'}
get_system_info.return_value = fake_system_info
flashcopy_rate = 120
self.assertRaises(exception.VolumeDriverException,
self.storwize_svc_common.check_flashcopy_rate,
flashcopy_rate)
def test_storwize_check_flashcopy_rate_invalid2(self):
with mock.patch.object(storwize_svc_common.StorwizeHelpers,
'get_system_info') as get_system_info:
fake_system_info = {'code_level': (7, 8, 1, 2),
'topology': 'standard',
'system_name': 'storwize-svc-sim',
'system_id': '0123456789ABCDEF'}
get_system_info.return_value = fake_system_info
flashcopy_rate = 200
self.assertRaises(exception.InvalidInput,
self.storwize_svc_common.check_flashcopy_rate,
flashcopy_rate)
@ddt.data(({'mirror_pool': 'openstack2',
'volume_topology': None,
'peer_pool': None}, True, 1),
({'mirror_pool': 'openstack2',
'volume_topology': None,
'peer_pool': None}, False, 2),
({'mirror_pool': None,
'volume_topology': 'hyperswap',
'peer_pool': 'openstack1'}, True, 1),
({'mirror_pool': None,
'volume_topology': 'hyperswap',
'peer_pool': 'openstack1'}, False, 2))
@mock.patch.object(storwize_svc_common.StorwizeHelpers,
'is_data_reduction_pool')
@ddt.unpack
def test_is_volume_type_dr_pools_dr_pool(self, opts, is_drp, call_count,
is_data_reduction_pool):
is_data_reduction_pool.return_value = is_drp
pool = 'openstack'
rep_type = None
rep_target_pool = None
isdrpool = (self.storwize_svc_common.
is_volume_type_dr_pools(pool, opts, rep_type,
rep_target_pool))
self.assertEqual(is_drp, isdrpool)
is_data_reduction_pool.assert_called()
self.assertEqual(call_count, is_data_reduction_pool.call_count)
@ddt.ddt
class StorwizeSSHTestCase(test.TestCase):


+ 32
- 0
cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py View File

@ -743,6 +743,8 @@ class StorwizeHelpers(object):
def __init__(self, run_ssh):
self.ssh = StorwizeSSH(run_ssh)
self.check_fcmapping_interval = 3
self.code_level = None
self.stats = {}
@staticmethod
def handle_keyerror(cmd, out):
@ -811,6 +813,12 @@ class StorwizeHelpers(object):
def is_data_reduction_pool(self, pool_name):
"""Check if pool is data reduction pool."""
# Check pool is data reduction pool or not from pool information
# saved in stats.
for pool in self.stats.get('pools', []):
if pool['pool_name'] == pool_name:
return pool['data_reduction']
pool_data = self.get_pool_attrs(pool_name)
if (pool_data and 'data_reduction' in pool_data and
pool_data['data_reduction'] == 'yes'):
@ -2729,6 +2737,9 @@ class StorwizeSVCCommonDriver(san.SanDriver,
# This is used to save the available pools in failed-over status
self._secondary_pools = None
# This dictionary is used to save pools information.
self._stats = {}
# Storwize has the limitation that can not burst more than 3 new ssh
# connections within 1 second. So slow down the initialization.
time.sleep(1)
@ -2746,6 +2757,12 @@ class StorwizeSVCCommonDriver(san.SanDriver,
# Get list of all volumes
self._get_all_volumes()
# Update the pool stats
self._update_volume_stats()
# Save the pool stats information in helpers class.
self._master_backend_helpers.stats = self._stats
# Build the list of in-progress vdisk copy operations
if ctxt is None:
admin_context = context.get_admin_context()
@ -3516,6 +3533,8 @@ class StorwizeSVCCommonDriver(san.SanDriver,
self._state = self._master_state
self._update_volume_stats()
self._master_backend_helpers.stats = self._stats
return storwize_const.FAILBACK_VALUE, volumes_update, groups_update
def _failback_replica_volumes(self, ctxt, rep_volumes):
@ -3765,6 +3784,8 @@ class StorwizeSVCCommonDriver(san.SanDriver,
self._state = self._aux_state
self._update_volume_stats()
self._aux_backend_helpers.stats = self._stats
return self._active_backend_id, volumes_update, groups_update
def _failover_replica_volumes(self, ctxt, rep_volumes):
@ -5563,6 +5584,7 @@ class StorwizeSVCCommonDriver(san.SanDriver,
"""Build pool status"""
QoS_support = True
pool_stats = {}
is_dr_pool = False
pool_data = self._helpers.get_pool_attrs(pool)
if pool_data:
easy_tier = pool_data['easy_tier'] in ['on', 'auto']
@ -5586,6 +5608,14 @@ class StorwizeSVCCommonDriver(san.SanDriver,
storwize_svc_multihostmap_enabled)
backend_state = ('up' if pool_data['status'] == 'online' else
'down')
# Get the data_reduction information for pool and set
# is_dr_pool flag.
if pool_data.get('data_reduction') == 'Yes':
is_dr_pool = True
elif pool_data.get('data_reduction') == 'No':
is_dr_pool = False
pool_stats = {
'pool_name': pool_data['name'],
'total_capacity_gb': total_capacity_gb,
@ -5605,6 +5635,7 @@ class StorwizeSVCCommonDriver(san.SanDriver,
'max_over_subscription_ratio': over_sub_ratio,
'consistent_group_snapshot_enabled': True,
'backend_state': backend_state,
'data_reduction': is_dr_pool,
}
if self._replica_enabled:
pool_stats.update({
@ -5626,6 +5657,7 @@ class StorwizeSVCCommonDriver(san.SanDriver,
'thick_provisioning_support': False,
'max_over_subscription_ratio': 0,
'reserved_percentage': 0,
'data_reduction': is_dr_pool,
'backend_state': 'down'}
return pool_stats


+ 7
- 0
releasenotes/notes/bug-1890591-Pool-information-is-not-saved-in-stats-22f302d941cd9fe2.yaml View File

@ -0,0 +1,7 @@
---
fixes:
- |
`Bug #1890591 <https://bugs.launchpad.net/cinder/+bug/1890591>`_:
IBM Spectrum Virtualize Family: Fixed issue in do_setup of
StorwizeSVCCommonDriver to save pool information in stats
during initialisation.

Loading…
Cancel
Save