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

This commit is contained in:
Zuul 2021-12-22 12:48:56 +00:00 committed by Gerrit Code Review
commit 9ec37fabee
3 changed files with 17 additions and 5 deletions
cinder
tests/unit/volume/drivers/ibm
volume/drivers/ibm/storwize_svc
releasenotes/notes

View File

@ -11192,7 +11192,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')
@ -11202,6 +11205,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',
@ -11233,6 +11238,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.