From 3de7da12d1098ef777305099e5f4a039e536bf99 Mon Sep 17 00:00:00 2001 From: Mike Perez Date: Sat, 23 Nov 2013 10:50:15 -0800 Subject: [PATCH] Continue to delete volumes that DNE in rbd backend If a volume has already been deleted in the RBD backend, catch the exception and let Cinder continue removing it in the database. Closes-Bug: #1254318 Change-Id: I99b591ce78d82c6eaabff0459d9c523e85c8e65f --- cinder/volume/drivers/rbd.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/cinder/volume/drivers/rbd.py b/cinder/volume/drivers/rbd.py index ea75f74a8..a6445d63a 100644 --- a/cinder/volume/drivers/rbd.py +++ b/cinder/volume/drivers/rbd.py @@ -587,14 +587,21 @@ class RBDDriver(driver.VolumeDriver): """Deletes a logical volume.""" volume_name = str(volume['name']) with RADOSClient(self) as client: - # Ensure any backup snapshots are deleted - self._delete_backup_snaps(client, volume_name) - # If the volume has non-clone snapshots this delete is expected to # raise VolumeIsBusy so do so straight away. - rbd_image = self.rbd.Image(client.ioctx, volume_name) + try: + rbd_image = self.rbd.Image(client.ioctx, volume_name) + except self.rbd.ImageNotFound: + LOG.debug(_("volume %s no longer exists in backend") + % (volume_name)) + return + clone_snap = None parent = None + + # Ensure any backup snapshots are deleted + self._delete_backup_snaps(client, volume_name) + try: snaps = rbd_image.list_snaps() for snap in snaps: -- 2.45.2