]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix issue with Pure drivers delete_snapshot exception handling
authorPatrick East <patrick.east@purestorage.com>
Fri, 4 Mar 2016 05:47:22 +0000 (21:47 -0800)
committerPatrick East <patrick.east@purestorage.com>
Fri, 4 Mar 2016 05:47:22 +0000 (21:47 -0800)
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

index b2f0fc06a3ab7e42e663a6d8c3bc7f724f083892..8d745c56da34b62956bb7859fb37ef1176a7d42e 100644 (file)
@@ -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