Merge "Catch exception in volume get"

This commit is contained in:
Zuul 2018-01-23 05:34:32 +00:00 committed by Gerrit Code Review
commit 75ccbeb8d0
1 changed files with 4 additions and 1 deletions

View File

@ -42,7 +42,10 @@ class CinderAPI(object):
def search_volume(self, volume):
if uuidutils.is_uuid_like(volume):
volume = self.cinder.volumes.get(volume)
try:
volume = self.cinder.volumes.get(volume)
except cinder_exception.NotFound:
raise exception.VolumeNotFound(volume=volume)
else:
try:
volume = self.cinder.volumes.find(name=volume)