[SVF]:Fix multiple lsiogrp,lsvdisk calls in Retype.

[Spectrum Virtualize Family] During Retype operation
there are multiple lsiogrp and lsvdisk calls
which can be optimized .

This patch fixes can optimize ssh calls by caching the
io_grp information and passing it as an argument to
_verify_retype_params function which can remove
get_volume_io_group function call inside
_verify_retype_params .

Closes Bug: #1951250

Change-Id: I98562783225523b6f7193edf499563b1b11daace
This commit is contained in:
gksk 2021-10-11 19:58:13 +00:00 committed by haailani
parent 05d397bed1
commit d49b001f13
3 changed files with 17 additions and 5 deletions

View File

@ -11160,7 +11160,10 @@ class StorwizeSVCReplicationTestCase(test.TestCase):
self.driver.retype(self.ctxt, volume,
new_type, diff, host)
def test_storwize_svc_retype_global_mirror_volume_to_thin(self):
@mock.patch.object(storwize_svc_common.StorwizeHelpers,
'get_volume_io_group')
def test_storwize_svc_retype_global_mirror_volume_to_thin(self,
get_vol_io_grp):
self.driver.do_setup(self.ctxt)
loc = ('StorwizeSVCDriver:' + self.driver._state['system_id'] +
':openstack')
@ -11170,6 +11173,8 @@ class StorwizeSVCReplicationTestCase(test.TestCase):
'capabilities': cap}
ctxt = context.get_admin_context()
get_vol_io_grp.return_value = 0
type_name = 'rep_global_none'
spec = {'replication_enabled': '<is> True',
'replication_type': '<in> global',
@ -11201,6 +11206,7 @@ class StorwizeSVCReplicationTestCase(test.TestCase):
self.driver.retype(self.ctxt, vol1, vol_type2, diff, host)
copies = self.driver._helpers.lsvdiskcopy(vol1.name)
self.assertEqual(2, len(copies))
get_vol_io_grp.assert_called_once_with(vol1.name)
self.driver.delete_volume(vol1)
def test_storwize_svc_retype_global_mirror_volume_to_none(self):

View File

@ -5142,7 +5142,7 @@ class StorwizeSVCCommonDriver(san.SanDriver,
def _verify_retype_params(self, volume, new_opts, old_opts, need_copy,
change_mirror, new_rep_type, old_rep_type,
vdisk_changes, old_pool, new_pool):
vdisk_changes, old_pool, new_pool, old_io_grp):
# Some volume parameters can not be changed or changed at the same
# time during volume retype operation. This function checks the
# retype parameters.
@ -5195,7 +5195,6 @@ class StorwizeSVCCommonDriver(san.SanDriver,
need_check_dr_pool_param = True
if new_rep_type != old_rep_type:
old_io_grp = self._helpers.get_volume_io_group(volume.name)
if (old_io_grp not in
StorwizeHelpers._get_valid_requested_io_groups(
self._state, new_opts)):
@ -5401,10 +5400,10 @@ class StorwizeSVCCommonDriver(san.SanDriver,
old_io_grp = self._helpers.get_volume_io_group(volume['name'])
new_io_grp = self._helpers.select_io_group(self._state,
new_opts, new_pool)
self._verify_retype_params(volume, new_opts, old_opts, need_copy,
change_mirror, new_rep_type, old_rep_type,
vdisk_changes, old_pool, new_pool)
vdisk_changes, old_pool, new_pool,
old_io_grp)
if old_opts['volume_topology'] or new_opts['volume_topology']:
self._check_hyperswap_retype_params(volume, new_opts, old_opts,

View File

@ -0,0 +1,7 @@
---
fixes:
- |
IBM Spectrum Virtualize Family driver
`Bug #1920870 <https://bugs.launchpad.net/cinder/+bug/1951250>`_:
Reduce multiple lsiogrp, lsvdisk calls in Retype operaton
to optimize the code.