[SVF] Fix Retype issue of mirror volume

[Spectrum Virtualize Family] Retype of mirror-volume to volume-type
with different mirror-pool scenario is not working.

When there is a change of mirror-pool in retype operation then it is
checking whether source/target type has data reduction pool. If it
contains data reduction pool, it will throw an exception. If not,
it has to continue the retype operation with change of mirror pool.
Due to the incorrect place of raising an exception for
data-reduction pool,it is effecting the retype operation of
volume-type with different mirror-pool.

Updated the code to raise an exception correctly to fix this issue.

Closes-Bug: #1949061
Change-Id: I12018c3a1f6e4e59a4923ef81da85c2d7c74e96d
This commit is contained in:
Mounika Sreeram 2021-11-02 10:23:02 +00:00
parent aafaba0e95
commit 50e1731011
3 changed files with 40 additions and 1 deletions

View File

@ -7306,6 +7306,38 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
self.driver.delete_volume(vol1)
@ddt.data(({'mirror_pool': 'openstack1'}, {'mirror_pool': 'openstack2'}))
@ddt.unpack
def test_storwize_retype_from_mirror_to_different_mirror(self,
old_opts,
new_opts):
self.driver.do_setup(self.ctxt)
host = {'host': 'openstack@svc#openstack'}
ctxt = context.get_admin_context()
vol_type1 = self._create_volume_type(old_opts, 'old')
vol_type2 = self._create_volume_type(new_opts, 'new')
diff, _equal = volume_types.volume_types_diff(ctxt, vol_type1.id,
vol_type2.id)
vol1 = self._generate_vol_info(vol_type1)
self.driver.create_volume(vol1)
self._assert_vol_exists(vol1.name, True)
copies = self.driver._helpers.lsvdiskcopy(vol1.name)
self.assertEqual(len(copies), 2)
copies = self.driver._helpers.get_vdisk_copies(vol1.name)
self.assertEqual(copies['primary']['mdisk_grp_name'], 'openstack')
self.assertEqual(copies['secondary']['mdisk_grp_name'], 'openstack1')
self.driver.retype(self.ctxt, vol1, vol_type2, diff, host)
copies = self.driver._helpers.lsvdiskcopy(vol1.name)
self.assertEqual(len(copies), 2)
copies = self.driver._helpers.get_vdisk_copies(vol1.name)
self.assertEqual(copies['primary']['mdisk_grp_name'], 'openstack')
self.assertEqual(copies['secondary']['mdisk_grp_name'], 'openstack2')
self.driver.delete_volume(vol1)
@ddt.data(({}, {'mirror_pool': 'openstack1'}),
({'mirror_pool': ''}, {'mirror_pool': 'openstack1'}),
({'mirror_pool': 'openstack1'}, {}),

View File

@ -5190,7 +5190,7 @@ class StorwizeSVCCommonDriver(san.SanDriver,
msg = _('Unable to retype: the thin-provisioned or '
'compressed vol can not be migrated from a dr pool'
' or to a dr pool.')
raise exception.VolumeDriverException(message=msg)
raise exception.VolumeDriverException(message=msg)
if not old_opts['mirror_pool'] and new_opts['mirror_pool']:
need_check_dr_pool_param = True

View File

@ -0,0 +1,7 @@
---
fixes:
- |
IBM Spectrum Virtualize Family driver
`Bug #1949061 <https://bugs.launchpad.net/cinder/+bug/1949061>`_:
Fixed retype issue of mirror-volume to mirror-volume-type
with different mirror pool