From f47d62c933bbd834ea922aa9efa0d16dab120ece Mon Sep 17 00:00:00 2001 From: "Walter A. Boring IV" Date: Wed, 30 Jul 2014 14:20:46 -0700 Subject: [PATCH] Change 3PAR delete message when volume is busy 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 | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/cinder/volume/drivers/san/hp/hp_3par_common.py b/cinder/volume/drivers/san/hp/hp_3par_common.py index 615d5c1c7..7b7505ebf 100644 --- a/cinder/volume/drivers/san/hp/hp_3par_common.py +++ b/cinder/volume/drivers/san/hp/hp_3par_common.py @@ -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) -- 2.45.2