[SVF]:Storwize hyperswap volume is not deleting.

[Spectrum Virtualize Family] During hyperswap volume delete operation
check_vdisk_fc_mappings is trying to delete the remote copy controlled
fcmaps which are created for hyperswap volumes.

This patch fixes the issue by ignoring the remote copy controlled fcmaps.

Closes-Bug: #1912564
Change-Id: I98f1c60810d675a51ce1cae8bcce51c6d88e6cd2
This commit is contained in:
GirishChilukuri 2021-01-21 10:22:12 +00:00
parent e39c0406de
commit fd77dfa223
3 changed files with 84 additions and 1 deletions

View File

@ -8932,6 +8932,77 @@ class StorwizeHelpersTestCase(test.TestCase):
self.assertEqual(0, rmfcmap.call_count)
self.assertEqual(0, chfcmap.call_count)
@ddt.data(([{'cp_rate': '0', 'prgs': '0', 'status': 'idle_or_copied',
'trg_vdisk': 'vdisk', 'src_vdisk': 'Hyp_vol'},
{'cp_rate': '50', 'prgs': '0', 'status': 'idle_or_copied',
'trg_vdisk': 'Hyp_vol', 'src_vdisk': 'vdisk'},
{'cp_rate': '50', 'prgs': '3', 'status': 'copying',
'trg_vdisk': 'Snap_vol', 'src_vdisk': 'Hyp_vol'},
{'cp_rate': '50', 'prgs': '0', 'status': 'copying',
'trg_vdisk': 'Snap_vol_1', 'src_vdisk': 'Hyp_vol'}], 0),
([{'cp_rate': '0', 'prgs': '0', 'status': 'idle_or_copied',
'trg_vdisk': 'vdisk', 'src_vdisk': 'Hyp_vol'},
{'cp_rate': '50', 'prgs': '0', 'status': 'idle_or_copied',
'trg_vdisk': 'Hyp_vol', 'src_vdisk': 'vdisk'},
{'cp_rate': '50', 'prgs': '100', 'status': 'copying',
'trg_vdisk': 'Snap_vol', 'src_vdisk': 'Hyp_vol'},
{'cp_rate': '50', 'prgs': '0', 'status': 'copying',
'trg_vdisk': 'Snap_vol_1', 'src_vdisk': 'Hyp_vol'}], 1))
@mock.patch.object(storwize_svc_common.StorwizeSSH, 'chfcmap')
@mock.patch.object(storwize_svc_common.StorwizeSSH, 'stopfcmap')
@mock.patch.object(storwize_svc_common.StorwizeSSH, 'rmfcmap')
@mock.patch.object(storwize_svc_common.StorwizeHelpers,
'_get_flashcopy_mapping_attributes')
@mock.patch.object(storwize_svc_common.StorwizeHelpers,
'_get_vdisk_fc_mappings')
@ddt.unpack
def test_check_vdisk_fc_mappings_rc_cont(self,
fc_data, stopfc_count,
get_vdisk_fc_mappings,
get_fc_mapping_attributes,
rmfcmap, stopfcmap, chfcmap):
vol = 'Hyp_vol'
get_vdisk_fc_mappings.return_value = ['4', '5', '7', '9']
get_fc_mapping_attributes.side_effect = [
{
'copy_rate': fc_data[0]['cp_rate'],
'progress': fc_data[0]['prgs'],
'status': fc_data[0]['status'],
'target_vdisk_name': fc_data[0]['trg_vdisk'],
'rc_controlled': 'yes',
'source_vdisk_name': fc_data[0]['src_vdisk']},
{
'copy_rate': fc_data[1]['cp_rate'],
'progress': fc_data[1]['prgs'],
'status': fc_data[1]['status'],
'target_vdisk_name': fc_data[1]['trg_vdisk'],
'rc_controlled': 'yes',
'source_vdisk_name': fc_data[1]['src_vdisk']},
{
'copy_rate': fc_data[2]['cp_rate'],
'progress': fc_data[2]['prgs'],
'status': fc_data[2]['status'],
'target_vdisk_name': fc_data[2]['trg_vdisk'],
'rc_controlled': 'no',
'source_vdisk_name': fc_data[2]['src_vdisk']},
{
'copy_rate': fc_data[3]['cp_rate'],
'progress': fc_data[3]['prgs'],
'status': fc_data[3]['status'],
'target_vdisk_name': fc_data[3]['trg_vdisk'],
'rc_controlled': 'no',
'source_vdisk_name': fc_data[3]['src_vdisk']}]
self.storwize_svc_common._check_vdisk_fc_mappings(vol, True, True)
get_vdisk_fc_mappings.assert_called()
get_fc_mapping_attributes.assert_called()
rmfcmap.assert_not_called()
chfcmap.assert_not_called()
self.assertEqual(4, get_fc_mapping_attributes.call_count)
self.assertEqual(stopfc_count, stopfcmap.call_count)
self.assertEqual(0, rmfcmap.call_count)
self.assertEqual(0, chfcmap.call_count)
def test_storwize_check_flashcopy_rate_invalid1(self):
with mock.patch.object(storwize_svc_common.StorwizeHelpers,
'get_system_info') as get_system_info:

View File

@ -2194,6 +2194,7 @@ class StorwizeHelpers(object):
"""FlashCopy mapping check helper."""
# if this is a remove disk we need to be down to one fc clone
mapping_ids = self._get_vdisk_fc_mappings(name)
Rc_mapping_ids = []
if len(mapping_ids) > 1 and allow_fctgt:
LOG.debug('Loopcall: vdisk %s has '
'more than one fc map. Waiting.', name)
@ -2201,6 +2202,10 @@ class StorwizeHelpers(object):
attrs = self._get_flashcopy_mapping_attributes(map_id)
if not attrs:
continue
if 'yes' == attrs.get('rc_controlled', None):
Rc_mapping_ids.append(map_id)
continue
source = attrs['source_vdisk_name']
target = attrs['target_vdisk_name']
copy_rate = attrs['copy_rate']
@ -2224,7 +2229,8 @@ class StorwizeHelpers(object):
# next attempts in case of any cli exception.
except exception.VolumeBackendAPIException as ex:
LOG.warning(ex)
return
if len(mapping_ids) - len(Rc_mapping_ids) > 1:
return
return self._check_delete_vdisk_fc_mappings(
name, allow_snaps=allow_snaps, allow_fctgt=allow_fctgt)

View File

@ -0,0 +1,6 @@
---
fixes:
- |
IBM Spectrum Virtualize Family driver `Bug #1912564
<https://bugs.launchpad.net/cinder/+bug/1912564>`_: Fixed HyperSwap
volume deletion issue.