Skip to content

Instantly share code, notes, and snippets.

@zioproto
Created April 14, 2016 14:18
Show Gist options
  • Save zioproto/75ecb9acafd0134d945a2deab188c0de to your computer and use it in GitHub Desktop.
Save zioproto/75ecb9acafd0134d945a2deab188c0de to your computer and use it in GitHub Desktop.
diff --git a/cinder/volume/drivers/rbd.py b/cinder/volume/drivers/rbd.py
index 7dae2ec..f1d4d85 100644
--- a/cinder/volume/drivers/rbd.py
+++ b/cinder/volume/drivers/rbd.py
@@ -710,9 +710,27 @@ class RBDDriver(driver.VolumeDriver):
with RBDVolumeProxy(self, volume_name) as volume:
try:
volume.unprotect_snap(snap_name)
+ except self.rbd.InvalidArgument:
+ LOG.info(_LI("Unable to unprotect snapshot %s. InvalidArgument"), snap_name)
+ except self.rbd.ImageNotFound:
+ LOG.info(_LI("Unable to unprotect snapshot %s. ImageNotFound"), snap_name)
except self.rbd.ImageBusy:
+ children_list = self._get_children_info(volume, snap_name)
+
+ if children_list:
+ for (pool, image) in children_list:
+ LOG.info(_LI('Image %(pool)s/%(image)s is dependent '
+ 'on the snapshot %(snap)s.'),
+ {'pool': pool,
+ 'image': image,
+ 'snap': snap_name})
+
raise exception.SnapshotIsBusy(snapshot_name=snap_name)
- volume.remove_snap(snap_name)
+ try:
+ volume.remove_snap(snap_name)
+ except self.rbd.ImageNotFound:
+ LOG.info(_LI("Snapshot %s does not exist in backend."),
+ snap_name)
def retype(self, context, volume, new_type, diff, host):
"""Retypes a volume, allows QoS change only."""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment