From b99e73e96cb6448f81a2f4b2e8e624bf36bbff0e Mon Sep 17 00:00:00 2001 From: haailani Date: Thu, 7 Apr 2022 11:37:14 +0000 Subject: [PATCH] [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 --- .../volume/drivers/ibm/test_storwize_svc.py | 33 ++++++++++++------- .../ibm/storwize_svc/storwize_svc_common.py | 7 ++-- ...lication_volume-type-4e0671b299315f4b.yaml | 8 +++++ 3 files changed, 34 insertions(+), 14 deletions(-) create mode 100644 releasenotes/notes/bug-1968159-ibm-svf-Retype_failure_for_replication_volume-type-4e0671b299315f4b.yaml diff --git a/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py b/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py index 1f809841ff3..984723ac226 100644 --- a/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py +++ b/cinder/tests/unit/volume/drivers/ibm/test_storwize_svc.py @@ -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 ('', '') @@ -5545,7 +5547,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) @@ -5557,7 +5559,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) @@ -5568,7 +5570,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) @@ -5607,13 +5609,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 @@ -5661,16 +5663,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) diff --git a/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py b/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py index b25d6f2717e..88420fb7ece 100644 --- a/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py +++ b/cinder/volume/drivers/ibm/storwize_svc/storwize_svc_common.py @@ -2277,8 +2277,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: diff --git a/releasenotes/notes/bug-1968159-ibm-svf-Retype_failure_for_replication_volume-type-4e0671b299315f4b.yaml b/releasenotes/notes/bug-1968159-ibm-svf-Retype_failure_for_replication_volume-type-4e0671b299315f4b.yaml new file mode 100644 index 00000000000..70493c53e6f --- /dev/null +++ b/releasenotes/notes/bug-1968159-ibm-svf-Retype_failure_for_replication_volume-type-4e0671b299315f4b.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - | + IBM Spectrum Virtualize Family driver: `Bug #1968159 + `_: + Fix for retype failure for replicated volume-type. + Controlling chfcmap call for rc_controlled fcmap + for replication-type volumes during retype operation.