Browse Source

Handle drivers that do not support list manageable

Listing manageable volumes and snapshots is not a required feature for
drivers and not all of them support it. If a user attempts to list
objects when using a backend that does not support it, they currently
get a somewhat cryptic and internally-exposing error message:

AttributeError: 'RBDDriver' object has no attribute 'get_manageable_snapshots'

This updates the manager to better handle the case where a driver does
not support listing volumes and snapshots.

Closes-bug: #1796784

Change-Id: Ib6cdbe22ad22841c7a166f722eee981913396af4
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
changes/88/608988/1
Sean McGinnis 3 years ago
parent
commit
b07c91abda
No known key found for this signature in database GPG Key ID: CE7EE4BFAF8D70C8
  1. 6
      cinder/volume/manager.py

6
cinder/volume/manager.py

@ -2922,6 +2922,9 @@ class VolumeManager(manager.CleanableManager,
if want_objects:
driver_entries = (objects.ManageableVolumeList.
from_primitives(ctxt, driver_entries))
except AttributeError:
LOG.debug('Driver does not support listing manageable volumes.')
return []
except Exception:
with excutils.save_and_reraise_exception():
LOG.exception("Listing manageable volumes failed, due "
@ -4290,6 +4293,9 @@ class VolumeManager(manager.CleanableManager,
if want_objects:
driver_entries = (objects.ManageableSnapshotList.
from_primitives(ctxt, driver_entries))
except AttributeError:
LOG.debug('Driver does not support listing manageable snapshots.')
return []
except Exception:
with excutils.save_and_reraise_exception():
LOG.exception("Listing manageable snapshots failed, due "

Loading…
Cancel
Save