Merge "Eqlx: Ignore missing snapshot on delete"

This commit is contained in:
Jenkins 2016-09-08 21:47:19 +00:00 committed by Gerrit Code Review
commit 6d253caaf4
2 changed files with 14 additions and 0 deletions

View File

@ -238,6 +238,17 @@ class DellEQLSanISCSIDriverTestCase(test.TestCase):
mock_eql_execute.configure_mock(**mock_attrs)
self.driver.delete_snapshot(snapshot)
def test_delete_absent_snapshot(self):
snapshot = {'name': 'fakesnap', 'volume_name': 'fakevolume_name'}
mock_attrs = {'args': ['volume', 'select', snapshot['volume_name'],
'snapshot', 'delete', snapshot['name']]}
with mock.patch.object(self.driver,
'_eql_execute') as mock_eql_execute:
mock_eql_execute.configure_mock(**mock_attrs)
mock_eql_execute.side_effect = processutils.ProcessExecutionError(
stdout='% Error ..... does not exist.\n')
self.driver.delete_snapshot(snapshot)
def test_extend_volume(self):
new_size = '200'
volume = {'name': self.volume_name, 'size': 100}

View File

@ -566,6 +566,9 @@ class DellEQLSanISCSIDriver(san.SanISCSIDriver):
try:
self._eql_execute('volume', 'select', snapshot['volume_name'],
'snapshot', 'delete', snapshot['name'])
except processutils.ProcessExecutionError as err:
if err.stdout.find('does not exist') > -1:
LOG.debug('Snapshot %s could not be found.', snapshot['name'])
except Exception:
with excutils.save_and_reraise_exception():
LOG.error(_LE('Failed to delete snapshot %(snap)s of '