Merge "[storwize]:Fixed check_flashcopy_rate issues"

This commit is contained in:
Zuul 2020-09-23 20:35:45 +00:00 committed by Gerrit Code Review
commit de8bc94fa5
3 changed files with 40 additions and 4 deletions

View File

@ -8426,6 +8426,32 @@ 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.ddt
class StorwizeSSHTestCase(test.TestCase):

View File

@ -754,6 +754,7 @@ class StorwizeHelpers(object):
def __init__(self, run_ssh):
self.ssh = StorwizeSSH(run_ssh)
self.check_fcmapping_interval = 3
self.code_level = None
@staticmethod
def handle_keyerror(cmd, out):
@ -1960,18 +1961,20 @@ class StorwizeHelpers(object):
return volume_model_updates
def check_flashcopy_rate(self, flashcopy_rate):
sys_info = self.get_system_info()
code_level = sys_info['code_level']
if not self.code_level:
sys_info = self.get_system_info()
self.code_level = sys_info['code_level']
if flashcopy_rate not in range(1, 151):
raise exception.InvalidInput(
reason=_('The configured flashcopy rate should be '
'between 1 and 150.'))
elif code_level < (7, 8, 1, 0) and flashcopy_rate > 100:
elif self.code_level < (7, 8, 1, 0) and flashcopy_rate > 100:
msg = (_('The configured flashcopy rate is %(fc_rate)s, The '
'storage code level is %(code_level)s, the flashcopy_rate'
' range is 1-100 if the storwize code level '
'below 7.8.1.') % {'fc_rate': flashcopy_rate,
'code_level': code_level})
'code_level': self.code_level})
LOG.error(msg)
raise exception.VolumeDriverException(message=msg)

View File

@ -0,0 +1,7 @@
---
fixes:
- |
`Bug #1890586 <https://bugs.launchpad.net/cinder/+bug/1890586>`_:
IBM Storwize: Fixed issues in check_flashcopy_rate that impacts
the performance during Group Snapshot/Clone operations for bulk
volumes.