Dell SC: Live Volumes not cleaned up
When a volume is deleted after failover/failback some live volumes might not be found and could be orphaned. Change-Id: If28cf815f8c9b0ad02bf5a58c97c265da35dcf98 Closes-Bug: #1632069
This commit is contained in:
parent
41b516234f
commit
84e4c2b220
@ -515,9 +515,10 @@ class DellSCSanISCSIDriverTestCase(test.TestCase):
|
||||
mock_open_connection,
|
||||
mock_init):
|
||||
backends = self.driver.backends
|
||||
vol = {'id': fake.VOLUME_ID}
|
||||
vol = {'id': fake.VOLUME_ID,
|
||||
'provider_id': '101.101'}
|
||||
mock_api = mock.MagicMock()
|
||||
sclivevol = {'instanceId': '101.101',
|
||||
sclivevol = {'instanceId': '101.102',
|
||||
'secondaryVolume': {'instanceId': '102.101',
|
||||
'instanceName': fake.VOLUME_ID},
|
||||
'secondaryScSerialNumber': 102,
|
||||
@ -525,23 +526,34 @@ class DellSCSanISCSIDriverTestCase(test.TestCase):
|
||||
mock_api.get_live_volume = mock.MagicMock(return_value=sclivevol)
|
||||
# No replication driver data.
|
||||
ret = self.driver._delete_live_volume(mock_api, vol)
|
||||
self.assertFalse(mock_api.get_live_volume.called)
|
||||
self.assertFalse(ret)
|
||||
# Bogus rdd
|
||||
vol = {'id': fake.VOLUME_ID, 'replication_driver_data': ''}
|
||||
vol = {'id': fake.VOLUME_ID,
|
||||
'provider_id': '101.101',
|
||||
'replication_driver_data': ''}
|
||||
ret = self.driver._delete_live_volume(mock_api, vol)
|
||||
self.assertFalse(mock_api.get_live_volume.called)
|
||||
self.assertFalse(ret)
|
||||
# Valid delete.
|
||||
mock_api.delete_live_volume = mock.MagicMock(return_value=True)
|
||||
vol = {'id': fake.VOLUME_ID, 'replication_driver_data': '102'}
|
||||
vol = {'id': fake.VOLUME_ID,
|
||||
'provider_id': '101.101',
|
||||
'replication_driver_data': '102'}
|
||||
ret = self.driver._delete_live_volume(mock_api, vol)
|
||||
mock_api.get_live_volume.assert_called_with('101.101', fake.VOLUME_ID)
|
||||
self.assertTrue(ret)
|
||||
# Wrong ssn.
|
||||
vol = {'id': fake.VOLUME_ID, 'replication_driver_data': '103'}
|
||||
vol = {'id': fake.VOLUME_ID,
|
||||
'provider_id': '101.101',
|
||||
'replication_driver_data': '103'}
|
||||
ret = self.driver._delete_live_volume(mock_api, vol)
|
||||
mock_api.get_live_volume.assert_called_with('101.101', fake.VOLUME_ID)
|
||||
self.assertFalse(ret)
|
||||
# No live volume found.
|
||||
mock_api.get_live_volume.return_value = None
|
||||
ret = self.driver._delete_live_volume(mock_api, vol)
|
||||
mock_api.get_live_volume.assert_called_with('101.101', fake.VOLUME_ID)
|
||||
self.assertFalse(ret)
|
||||
|
||||
self.driver.backends = backends
|
||||
|
@ -3133,7 +3133,7 @@ class StorageCenterApi(object):
|
||||
"""Get's the live ScLiveVolume object for the vol with primaryid.
|
||||
|
||||
:param primaryid: InstanceId of the primary volume.
|
||||
:parma name: Volume name associated with this live volume.
|
||||
:param name: Volume name associated with this live volume.
|
||||
:return: ScLiveVolume object or None
|
||||
"""
|
||||
sclivevol = None
|
||||
@ -3158,6 +3158,7 @@ class StorageCenterApi(object):
|
||||
if (name and sclivevol is None and
|
||||
lv['instanceName'].endswith(name)):
|
||||
sclivevol = lv
|
||||
LOG.debug('get_live_volume: %r', sclivevol)
|
||||
return sclivevol
|
||||
|
||||
def _get_hbas(self, serverid):
|
||||
|
@ -365,7 +365,8 @@ class DellCommonDriver(driver.ConsistencyGroupVD, driver.ManageableVD,
|
||||
ssnstrings = self._split_driver_data(replication_driver_data)
|
||||
if ssnstrings:
|
||||
ssn = int(ssnstrings[0])
|
||||
sclivevolume = api.get_live_volume(volume.get('provider_id'))
|
||||
sclivevolume = api.get_live_volume(volume.get('provider_id'),
|
||||
volume.get('id'))
|
||||
# Have we found the live volume?
|
||||
if (sclivevolume and
|
||||
sclivevolume.get('secondaryScSerialNumber') == ssn and
|
||||
|
Loading…
Reference in New Issue
Block a user