NetApp SolidFire: Fix multi-attach volume deletion

While deleting a multi-attached volume, all delete operations were
failing.

Change-Id: I67746e56125888983859774062c0eeceb60ea7be
Closes-bug: #1817611
This commit is contained in:
Erlon R. Cruz 2019-02-25 15:35:48 -03:00 committed by Erlon R. Cruz
parent bf7e6dd12c
commit e6e21b0117
3 changed files with 52 additions and 2 deletions

View File

@ -725,6 +725,49 @@ class SolidFireVolumeTestCase(test.TestCase):
self.assertEqual(get_vol_result['volumeID'], sfvol['volumeID'])
def test_delete_volume(self):
vol_id = 'a720b3c0-d1f0-11e1-9b23-0800200c9a66'
testvol = test_utils.create_volume(
self.ctxt,
id=vol_id,
display_name='test_volume',
provider_id='1 5 None',
multiattach=False)
fake_sfaccounts = [{'accountID': 5,
'name': 'testprjid',
'targetSecret': 'shhhh',
'username': 'john-wayne'}]
get_vol_result = {'volumeID': 5,
'name': 'test_volume',
'accountID': 25,
'sliceCount': 1,
'totalSize': 1 * units.Gi,
'enable512e': True,
'access': "readWrite",
'status': "active",
'attributes': {},
'qos': None,
'iqn': 'super_fake_iqn'}
mod_conf = self.configuration
mod_conf.sf_enable_vag = True
sfv = solidfire.SolidFireDriver(configuration=mod_conf)
with mock.patch.object(sfv,
'_get_sfaccounts_for_tenant',
return_value=fake_sfaccounts), \
mock.patch.object(sfv,
'_get_sfvol_by_cinder_vref',
return_value=get_vol_result), \
mock.patch.object(sfv,
'_issue_api_request'), \
mock.patch.object(sfv,
'_remove_volume_from_vags') as rem_vol:
sfv.delete_volume(testvol)
rem_vol.not_called(get_vol_result['volumeID'])
def test_delete_multiattach_volume(self):
vol_id = 'a720b3c0-d1f0-11e1-9b23-0800200c9a66'
testvol = test_utils.create_volume(
self.ctxt,

View File

@ -1549,12 +1549,15 @@ class SolidFireDriver(san.SanISCSIDriver):
self._issue_api_request('PurgeDeletedVolume', params,
endpoint=cluster['endpoint'])
# The multiattach volumes are only removed from the VAG on
# deletion.
if volume.get('multiattach'):
self._remove_volume_from_vags(sf_vol['volumeID'])
if sf_vol['status'] == 'active':
params = {'volumeID': sf_vol['volumeID']}
self._issue_api_request('DeleteVolume', params)
self._issue_api_request('PurgeDeletedVolume', params)
if volume.get('multiattach'):
self._remove_volume_from_vags(sf_vol['volumeID'])
else:
LOG.error("Volume ID %s was not found on "
"the SolidFire Cluster while attempting "

View File

@ -0,0 +1,4 @@
---
fixes:
- |
Fixed NetApp SolidFire bug that avoided multiatached volumes to be deleted.