]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Change 3PAR delete message when volume is busy
authorWalter A. Boring IV <walter.boring@hp.com>
Wed, 30 Jul 2014 21:20:46 +0000 (14:20 -0700)
committerWalter A. Boring IV <walter.boring@hp.com>
Thu, 31 Jul 2014 16:36:48 +0000 (09:36 -0700)
This patch traps for when a volume is busy at
delete time.   It then logs a more useful message
and raises a VolumeIsBusy exception.

Change-Id: I689c1a5ff5e2d4c748a98615f5610a029a027e35
Closes-Bug: 1349636

cinder/volume/drivers/san/hp/hp_3par_common.py

index 615d5c1c7dd1e1f745563ac0bcf3a2fffe9e0681..7b7505ebff4aa7c03469dba58aba1c79d4b2a3ee 100644 (file)
@@ -137,10 +137,11 @@ class HP3PARCommon(object):
         2.0.13 - Added support for managing/unmanaging of volumes
         2.0.14 - Modified manage volume to use standard 'source-name' element.
         2.0.15 - Added support for volume retype
+        2.0.16 - Add a better log during delete_volume time. Bug #1349636
 
     """
 
-    VERSION = "2.0.15"
+    VERSION = "2.0.16"
 
     stats = {}
 
@@ -1105,9 +1106,19 @@ class HP3PARCommon(object):
                         self.client.removeVolumeFromVolumeSet(vvset_name,
                                                               volume_name)
                     self.client.deleteVolume(volume_name)
+                elif (ex.get_code() == 151 or ex.get_code() == 32):
+                    # the volume is being operated on in a background
+                    # task on the 3PAR.
+                    # TODO(walter-boring) do a retry a few times.
+                    # for now lets log a better message
+                    msg = _("The volume is currently busy on the 3PAR"
+                            " and cannot be deleted at this time. "
+                            "You can try again later.")
+                    LOG.error(msg)
+                    raise exception.VolumeIsBusy(message=msg)
                 else:
                     LOG.error(ex)
-                    raise ex
+                    raise exception.VolumeIsBusy(message=ex.get_description())
 
         except hpexceptions.HTTPNotFound as ex:
             # We'll let this act as if it worked
@@ -1120,7 +1131,7 @@ class HP3PARCommon(object):
             raise exception.NotAuthorized(ex.get_description())
         except hpexceptions.HTTPConflict as ex:
             LOG.error(ex)
-            raise exception.VolumeIsBusy(ex.get_description())
+            raise exception.VolumeIsBusy(message=ex.get_description())
         except Exception as ex:
             LOG.error(ex)
             raise exception.CinderException(ex)