[SVF]:Fix create volume on drp

[Spectrum Virtualize Family] While creating volumes on
data reduction pool, incorrect options were picked.

This patch fixes a bug caused by a case sensitive string
comparison that caused the code to incorrectly identify
whether DRP was enabled in a pool during intialization.

Closes-Bug: #1924568
Change-Id: I5a2914d77b85e4249774f6e366b93d8b997ea50f
This commit is contained in:
katarimanojkumar 2021-08-11 13:25:57 +00:00
parent 98b49d0572
commit 70a07ee7a2
3 changed files with 48 additions and 4 deletions

View File

@ -5437,6 +5437,45 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
if 'CMMVC7050E' not in e.stderr:
raise
@ddt.data(('yes'), ('Yes'), ('no'), ('NO'), (''))
@mock.patch.object(storwize_svc_common.StorwizeHelpers,
'get_pool_attrs')
def test_build_pool_stats_drp(self, is_drp, get_pool_attrs):
get_pool_attrs.return_value = {'id': 1, 'name': 'openstack',
'data_reduction': is_drp,
'easy_tier': 'on',
'capacity': '20',
'free_capacity': '40',
'used_capacity': '0',
'real_capacity': '0',
'virtual_capacity': '0',
'status': 'online',
'site_id': '1',
'site_name': 'site1'}
pool = 'openstack'
pool_stats = self.driver._build_pool_stats(pool)
if is_drp in ['yes', 'Yes']:
self.assertTrue(pool_stats['data_reduction'])
else:
self.assertFalse(pool_stats['data_reduction'])
@mock.patch.object(storwize_svc_common.StorwizeHelpers,
'get_pool_attrs')
def test_build_pool_stats_drp_none(self, get_pool_attrs):
get_pool_attrs.return_value = {'id': 1, 'name': 'openstack1',
'easy_tier': 'on',
'capacity': '20',
'free_capacity': '40',
'used_capacity': '0',
'real_capacity': '0',
'virtual_capacity': '0',
'status': 'online',
'site_id': '1',
'site_name': 'site1'}
pool = 'openstack1'
pool_stats = self.driver._build_pool_stats(pool)
self.assertFalse(pool_stats['data_reduction'])
@ddt.data(('IOPs_limit', "50"), ('bandwidth_limit_MB', "100"))
@mock.patch.object(storwize_svc_common.StorwizeHelpers, 'get_pool_volumes')
@mock.patch.object(storwize_svc_common.StorwizeSSH, 'lsthrottle')

View File

@ -6025,10 +6025,8 @@ class StorwizeSVCCommonDriver(san.SanDriver,
# 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
if pool_data.get('data_reduction'):
is_dr_pool = pool_data.get('data_reduction').lower() == 'yes'
pool_stats = {
'pool_name': pool_data['name'],

View File

@ -0,0 +1,7 @@
---
fixes:
- |
IBM Spectrum Virtualize Family driver
`Bug #1924568 <https://bugs.launchpad.net/cinder/+bug/1924568>`_:
Fixed issues that occurred while creating volume on data reduction
pool.