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>
(cherry picked from commit b07c91abda
)
This commit is contained in:
parent
77d54c2124
commit
d7c240f01a
|
@ -2924,6 +2924,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 "
|
||||
|
@ -4292,6 +4295,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…
Reference in New Issue