Merge "[SVf]:Fix retype failure for replication volume-type"

This commit is contained in:
Zuul 2022-04-20 17:18:46 +00:00 committed by Gerrit Code Review
commit 0eef543691
3 changed files with 34 additions and 14 deletions

View File

@ -1577,6 +1577,7 @@ port_speed!N/A
source = ''
target = ''
copyrate = kwargs['copyrate'] if 'copyrate' in kwargs else '50'
cleanrate = kwargs['cleanrate'] if 'clean_rate' in kwargs else '50'
if 'source' not in kwargs:
return self._errors['CMMVC5707E']
@ -1603,6 +1604,7 @@ port_speed!N/A
fcmap_info['id'] = self._find_unused_id(self._fcmappings_list)
fcmap_info['name'] = 'fcmap' + fcmap_info['id']
fcmap_info['copyrate'] = copyrate
fcmap_info['cleanrate'] = cleanrate
fcmap_info['progress'] = '0'
fcmap_info['autodelete'] = True if 'autodelete' in kwargs else False
fcmap_info['status'] = 'idle_or_copied'
@ -1727,7 +1729,7 @@ port_speed!N/A
except KeyError:
return self._errors['CMMVC5753E']
for key in ['name', 'copyrate', 'autodelete']:
for key in ['name', 'copyrate', 'cleanrate', 'autodelete']:
if key in kwargs:
fcmap[key] = kwargs[key]
return ('', '')
@ -5566,7 +5568,7 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
if self.USESIM:
# validate copyrate was set on the flash copy
for i, fcmap in self.sim._fcmappings_list.items():
if fcmap['target'] == vol1['name']:
if fcmap['target'] == vol2['name']:
self.assertEqual('49', fcmap['copyrate'])
self._assert_vol_exists(vol2['name'], True)
@ -5578,7 +5580,7 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
if self.USESIM:
# Validate copyrate was set on the flash copy
for i, fcmap in self.sim._fcmappings_list.items():
if fcmap['target'] == vol1['name']:
if fcmap['target'] == vol3['name']:
self.assertEqual('49', fcmap['copyrate'])
self._assert_vol_exists(vol3['name'], True)
@ -5589,7 +5591,7 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
if self.USESIM:
# Validate copyrate was set on the flash copy
for i, fcmap in self.sim._fcmappings_list.items():
if fcmap['target'] == vol1['name']:
if fcmap['target'] == vol4['name']:
self.assertEqual('50', fcmap['cleanrate'])
self._assert_vol_exists(vol4['name'], True)
@ -5628,13 +5630,13 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
if self.USESIM:
# Validate copyrate was set on the flash copy
for i, fcmap in self.sim._fcmappings_list.items():
if fcmap['target'] == vol1['name']:
if fcmap['target'] == volume2['name']:
self.assertEqual('49', fcmap['copyrate'])
self.driver.retype(ctxt, volume, new_type, diff, host)
if self.USESIM:
# Validate copyrate was set on the flash copy
for i, fcmap in self.sim._fcmappings_list.items():
if fcmap['target'] == vol1['name']:
if fcmap['source'] == volume['name']:
self.assertEqual('149', fcmap['copyrate'])
# create cloned volume with new type diffrent iogrp
@ -5682,16 +5684,23 @@ class StorwizeSVCCommonDriverTestCase(test.TestCase):
volume2 = testutils.create_volume(
self.ctxt,
volume_type_id=self.vt['id'])
self.driver.retype(ctxt, volume, new_type, diff, host)
if self.USESIM:
self.sim.error_injection('lsfcmap', 'speed_up')
self.driver.create_cloned_volume(volume2, volume)
# Create the snapshot of the source volume
snap = self._generate_snap_info(volume.id)
self.driver.create_snapshot(snap)
if self.USESIM:
# Validate cleanrate was set on the flash copy
for i, fcmap in self.sim._fcmappings_list.items():
if fcmap['target'] == volume['name']:
if fcmap['source'] == volume['name']:
self.assertEqual('50', fcmap['cleanrate'])
# Try to retype the source volume
self.driver.retype(ctxt, volume, new_type, diff, host)
if self.USESIM:
# Validate cleanrate was set on the flash copy
for i, fcmap in self.sim._fcmappings_list.items():
if fcmap['source'] == volume['name']:
self.assertEqual('100', fcmap['cleanrate'])
self._assert_vol_exists(volume2['name'], True)
# Delete the volumes
self.driver.delete_volume(volume2)

View File

@ -2280,8 +2280,11 @@ class StorwizeHelpers(object):
def update_clean_rate(self, volume_name, new_clean_rate):
mapping_ids = self._get_vdisk_fc_mappings(volume_name)
for map_id in mapping_ids:
self.ssh.chfcmap(map_id,
clean_rate=six.text_type(new_clean_rate))
attrs = self._get_flashcopy_mapping_attributes(map_id)
# chfcmap should not be called for rc_controlled fcmap
if attrs is not None and attrs['rc_controlled'] != 'yes':
self.ssh.chfcmap(map_id,
clean_rate=str(new_clean_rate))
def check_flashcopy_rate(self, flashcopy_rate):
if not self.code_level:

View File

@ -0,0 +1,8 @@
---
fixes:
- |
IBM Spectrum Virtualize Family driver: `Bug #1968159
<https://bugs.launchpad.net/cinder/+bug/1968159>`_:
Fix for retype failure for replicated volume-type.
Controlling chfcmap call for rc_controlled fcmap
for replication-type volumes during retype operation.