[storwize]:Fixed check_flashcopy_rate issues

Fixed issues in check_flashcopy_rate that impacts the performance
during bulk Group Snapshot/Clone operations.

check_flashcopy_rate will not make lssystem calls everytime,
instead it uses code_level.

closes bug: #1890586

Change-Id: Icae65dd2473340450c1ff4135f1da86a884ea545
This commit is contained in:
katarimanojkumar 2020-08-09 17:39:09 +00:00
parent 422184c9f2
commit efe9dfb685
3 changed files with 40 additions and 4 deletions

View File

@ -8364,6 +8364,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

@ -747,6 +747,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):
@ -1951,18 +1952,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.