diff --git a/cinder/tests/unit/volume/drivers/test_eqlx.py b/cinder/tests/unit/volume/drivers/test_eqlx.py index 67863435edb..e02b7c12785 100644 --- a/cinder/tests/unit/volume/drivers/test_eqlx.py +++ b/cinder/tests/unit/volume/drivers/test_eqlx.py @@ -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} diff --git a/cinder/volume/drivers/eqlx.py b/cinder/volume/drivers/eqlx.py index 4e2f24a6b3c..9507c4b9a3c 100644 --- a/cinder/volume/drivers/eqlx.py +++ b/cinder/volume/drivers/eqlx.py @@ -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 '