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

[Spectrum Virtualize family] While retyping GM to GM or MM to MM or
GMCV to GMCV, chfcmap() call is being made which is resulting in retype
operation failure.
Error: CMMVC7154E The task cannot be completed because the specified
FlashCopy mapping is controlled by a Metro Mirror or Global Mirror
relationship.

chfcmap() should not be called for any FC map which is rc_controlled.
Hence while retyping global mirror to global mirror or
metro mirror to metro mirror or GMCV to GMCV volume, this error comes
up as the FC map of the volume is rc_controlled for these replication
volume-types.

Closes-Bug: #1968159
Change-Id: Ic97a2501b4c895b2b655284bcc320036c2d4e217
This commit is contained in:
haailani 2022-04-07 11:37:14 +00:00 committed by Harsh Ailani
parent 85387cae8b
commit b99e73e96c
3 changed files with 34 additions and 14 deletions

View File

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

View File

@ -2277,8 +2277,11 @@ class StorwizeHelpers(object):
def update_clean_rate(self, volume_name, new_clean_rate): def update_clean_rate(self, volume_name, new_clean_rate):
mapping_ids = self._get_vdisk_fc_mappings(volume_name) mapping_ids = self._get_vdisk_fc_mappings(volume_name)
for map_id in mapping_ids: for map_id in mapping_ids:
self.ssh.chfcmap(map_id, attrs = self._get_flashcopy_mapping_attributes(map_id)
clean_rate=six.text_type(new_clean_rate)) # 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): def check_flashcopy_rate(self, flashcopy_rate):
if not self.code_level: 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.