Pure - warn when deleting destroyed snapshot
Previously, error handling only accounted for eradicated or non-existant snapshot volumes. This adds a warning for the case of a snapshot that has been destroyed but is pending eradication, preventing errors under that condition. Change-Id: Idd061ea8613a37173e87b833dc122410974b507f Closes-Bug: 1616491
This commit is contained in:
parent
112a25c82d
commit
e71f621550
@ -741,15 +741,15 @@ class PureBaseVolumeDriverTestCase(PureBaseSharedDriverTestCase):
|
||||
self.assert_error_propagates([self.array.create_snapshot],
|
||||
self.driver.create_snapshot, SNAPSHOT)
|
||||
|
||||
def test_delete_snapshot(self):
|
||||
@ddt.data("does not exist", "has been destroyed")
|
||||
def test_delete_snapshot(self, error_text):
|
||||
snap_name = SNAPSHOT["volume_name"] + "-cinder." + SNAPSHOT["name"]
|
||||
self.driver.delete_snapshot(SNAPSHOT)
|
||||
expected = [mock.call.destroy_volume(snap_name)]
|
||||
self.array.assert_has_calls(expected)
|
||||
self.assertFalse(self.array.eradicate_volume.called)
|
||||
self.array.destroy_volume.side_effect = (
|
||||
self.purestorage_module.PureHTTPError(code=400, text="does not "
|
||||
"exist"))
|
||||
self.purestorage_module.PureHTTPError(code=400, text=error_text))
|
||||
self.driver.delete_snapshot(SNAPSHOT)
|
||||
self.array.destroy_volume.side_effect = None
|
||||
self.assert_error_propagates([self.array.destroy_volume],
|
||||
|
@ -413,7 +413,8 @@ class PureBaseVolumeDriver(san.SanDriver):
|
||||
with excutils.save_and_reraise_exception() as ctxt:
|
||||
if err.code == 400 and (
|
||||
ERR_MSG_NOT_EXIST in err.text or
|
||||
ERR_MSG_NO_SUCH_SNAPSHOT in err.text):
|
||||
ERR_MSG_NO_SUCH_SNAPSHOT in err.text or
|
||||
ERR_MSG_PENDING_ERADICATION in err.text):
|
||||
# Happens if the snapshot does not exist.
|
||||
ctxt.reraise = False
|
||||
LOG.warning(_LW("Unable to delete snapshot, assuming "
|
||||
|
Loading…
Reference in New Issue
Block a user