From 609cae10659869da5e645b6df0a6b0f911bf81ac Mon Sep 17 00:00:00 2001 From: Patrick East Date: Thu, 3 Mar 2016 21:47:22 -0800 Subject: [PATCH] Fix issue with Pure drivers delete_snapshot exception handling We were checking for only a single possible error that can occur when the snapshot was missing. We now check for both which helps prevent any snapshots or volumes deleted out from underneath Cinder to get things stuck in an error state. This also adjusts the warning message to be a little more descriptive. Change-Id: I26f393a3e5232fc508b9f34921e9f53f8b5a77ef Closes-Bug: #1553029 --- cinder/volume/drivers/pure.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cinder/volume/drivers/pure.py b/cinder/volume/drivers/pure.py index b2f0fc06a..8d745c56d 100644 --- a/cinder/volume/drivers/pure.py +++ b/cinder/volume/drivers/pure.py @@ -89,6 +89,7 @@ REPLICATION_CG_NAME = "cinder-group" CHAP_SECRET_KEY = "PURE_TARGET_CHAP_SECRET" ERR_MSG_NOT_EXIST = "does not exist" +ERR_MSG_NO_SUCH_SNAPSHOT = "No such volume or snapshot" ERR_MSG_PENDING_ERADICATION = "has been destroyed" ERR_MSG_ALREADY_EXISTS = "already exists" ERR_MSG_COULD_NOT_BE_FOUND = "could not be found" @@ -380,11 +381,12 @@ class PureBaseVolumeDriver(san.SanDriver): except purestorage.PureHTTPError as err: with excutils.save_and_reraise_exception() as ctxt: if err.code == 400 and ( - ERR_MSG_NOT_EXIST in err.text): + ERR_MSG_NOT_EXIST in err.text or + ERR_MSG_NO_SUCH_SNAPSHOT in err.text): # Happens if the snapshot does not exist. ctxt.reraise = False - LOG.warning(_LW("Snapshot deletion failed with " - "message: %s"), err.text) + LOG.warning(_LW("Unable to delete snapshot, assuming " + "already deleted. Error: %s"), err.text) def ensure_export(self, context, volume): pass -- 2.45.2